mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Merge branch 'feature/chatStorage' of https://bitbucket.org/equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -68,6 +68,13 @@ export class WsChatMethodsService {
|
||||
|
||||
}
|
||||
|
||||
getRoomFromDb() {
|
||||
this.storage.get('Rooms').then((rooms) => {
|
||||
rooms.result.update.forEach((roomData: room) => {
|
||||
this.prepareRoom(roomData);
|
||||
});
|
||||
})
|
||||
};
|
||||
openRoom(roomId) {
|
||||
|
||||
if(this.currentRoom) {
|
||||
@@ -92,9 +99,12 @@ export class WsChatMethodsService {
|
||||
|
||||
async getAllRooms () {
|
||||
this.loadingWholeList = true
|
||||
|
||||
this.getRoomFromDb();
|
||||
const rooms = await this.WsChatService.getRooms();
|
||||
|
||||
this.storage.set('Rooms', rooms);
|
||||
|
||||
// console.log("ROOMS" + JSON.stringify(rooms))
|
||||
this.WsChatService.registerCallback({
|
||||
type:'Onmessage',
|
||||
funx:(message)=>{
|
||||
|
||||
@@ -127,7 +127,8 @@ export class SqliteService {
|
||||
DateEnd varchar(255),
|
||||
Detail varchar(255),
|
||||
Description varchar(255),
|
||||
publications Text
|
||||
publications Text,
|
||||
publicationsDetails Text
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
console.log("Sucess action Table created: ", res)
|
||||
@@ -195,8 +196,8 @@ export class SqliteService {
|
||||
public addactions(data) {
|
||||
console.log('Action insert', data)
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR IGNORE INTO ${this.actions} (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,publications)
|
||||
VALUES ('${data.ActionType}','${data.DateBegin}', '${data.DateEnd}','${data.Description}','${data.Detail}','${data.ProcessId}','${data.publications}')`, [])
|
||||
INSERT OR IGNORE INTO ${this.actions} (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,publications,publicationsDetails)
|
||||
VALUES ('${data.ActionType}','${data.DateBegin}', '${data.DateEnd}','${data.Description}','${data.Detail}','${data.ProcessId}','${data.publications}','${data.publicationsDetails}')`, [])
|
||||
.then(() => {
|
||||
console.log("action add with Success");
|
||||
|
||||
@@ -319,6 +320,22 @@ export class SqliteService {
|
||||
|
||||
}
|
||||
|
||||
//updatePublicationsDetails
|
||||
public updatePublicationsDetails(id, data) {
|
||||
try {
|
||||
console.log("update action data", data)
|
||||
this.dbInstance.executeSql(`
|
||||
UPDATE ${this.actions} SET publicationsDetails = ? WHERE ProcessId = ${id}`, [data])
|
||||
.then(() => {
|
||||
console.log("action update with Success");
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
} catch(error) {}
|
||||
|
||||
}
|
||||
|
||||
//updateChatMsg
|
||||
public updateChatMsg(id, data) {
|
||||
let jsonId = JSON.stringify(id)
|
||||
|
||||
Reference in New Issue
Block a user