Storage Service: Write
This commit is contained in:
parent
8a2c17f65f
commit
1ce0959fa1
15 changed files with 1374 additions and 540 deletions
|
@ -129,7 +129,7 @@ const dataInterface: ClientInterface = {
|
|||
updateConversations,
|
||||
removeConversation,
|
||||
|
||||
eraseStorageIdFromConversations,
|
||||
eraseStorageServiceStateFromConversations,
|
||||
getAllConversations,
|
||||
getAllConversationIds,
|
||||
getAllPrivateConversations,
|
||||
|
@ -773,8 +773,8 @@ async function _removeConversations(ids: Array<string>) {
|
|||
await channels.removeConversation(ids);
|
||||
}
|
||||
|
||||
async function eraseStorageIdFromConversations() {
|
||||
await channels.eraseStorageIdFromConversations();
|
||||
async function eraseStorageServiceStateFromConversations() {
|
||||
await channels.eraseStorageServiceStateFromConversations();
|
||||
}
|
||||
|
||||
async function getAllConversations({
|
||||
|
|
|
@ -67,7 +67,7 @@ export interface DataInterface {
|
|||
removeAllSessions: () => Promise<void>;
|
||||
getAllSessions: () => Promise<Array<SessionType>>;
|
||||
|
||||
eraseStorageIdFromConversations: () => Promise<void>;
|
||||
eraseStorageServiceStateFromConversations: () => Promise<void>;
|
||||
getConversationCount: () => Promise<number>;
|
||||
saveConversation: (data: ConversationType) => Promise<void>;
|
||||
saveConversations: (array: Array<ConversationType>) => Promise<void>;
|
||||
|
|
|
@ -104,7 +104,7 @@ const dataInterface: ServerInterface = {
|
|||
updateConversation,
|
||||
updateConversations,
|
||||
removeConversation,
|
||||
eraseStorageIdFromConversations,
|
||||
eraseStorageServiceStateFromConversations,
|
||||
getAllConversations,
|
||||
getAllConversationIds,
|
||||
getAllPrivateConversations,
|
||||
|
@ -2243,12 +2243,12 @@ async function getConversationById(id: string) {
|
|||
return jsonToObject(row.json);
|
||||
}
|
||||
|
||||
async function eraseStorageIdFromConversations() {
|
||||
async function eraseStorageServiceStateFromConversations() {
|
||||
const db = getInstance();
|
||||
|
||||
await db.run(
|
||||
`UPDATE conversations SET
|
||||
json = json_remove(json, '$.storageID');
|
||||
json = json_remove(json, '$.storageID', '$.needsStorageServiceSync', '$.unknownFields');
|
||||
`
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue