introduce community store + community store ops logic to web worker
Linear task: https://linear.app/comm/issue/ENG-6534/implement-processing-community-store-ops
Depends on D11153
Differential D11164
[sqlite] implement processing community store ops on worker ginsu on Feb 25 2024, 11:39 PM. Authored by Tags None Referenced Files
Details introduce community store + community store ops logic to web worker Linear task: https://linear.app/comm/issue/ENG-6534/implement-processing-community-store-ops Depends on D11153 Ran the following code + confirmed things worked as expected const TEST_COMMUNITY_1: CommunityInfo = { enabledApps: { calendar: false, wiki: false, tasks: true, files: true, }, }; const TEST_COMMUNITY_2: CommunityInfo = { enabledApps: { calendar: true, wiki: false, tasks: false, files: false, }, }; const databaseModule = await getDatabaseModule(); let data = await databaseModule.schedule({ type: workerRequestMessageTypes.GET_CLIENT_STORE, }); console.log(data.store.communites); await databaseModule.schedule({ type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS, storeOperations: { communityStoreOperations: [ { type: 'replace_community', payload: { id: '1', communityInfo: TEST_COMMUNITY_1, }, }, { type: 'replace_community', payload: { id: '2', communityInfo: TEST_COMMUNITY_2, }, }, ], }, }); data = await databaseModule.schedule({ type: workerRequestMessageTypes.GET_CLIENT_STORE, }); console.log(data.store.communites); const community2Updated: CommunityInfo = { enabledApps: { calendar: true, wiki: true, tasks: true, files: true, }, }; await databaseModule.schedule({ type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS, storeOperations: { communityStoreOperations: [ { type: 'replace_community', payload: { id: '2', communityInfo: community2Updated, }, }, ], }, }); data = await databaseModule.schedule({ type: workerRequestMessageTypes.GET_CLIENT_STORE, }); console.log(data.store.communites); await databaseModule.schedule({ type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS, storeOperations: { communityStoreOperations: [ { type: 'remove_communites', payload: { ids: ['1'], }, }, ], }, }); data = await databaseModule.schedule({ type: workerRequestMessageTypes.GET_CLIENT_STORE, }); console.log(data.store.communities); await databaseModule.schedule({ type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS, storeOperations: { communityStoreOperations: [ { type: 'remove_all_communities', }, ], }, }); data = await databaseModule.schedule({ type: workerRequestMessageTypes.GET_CLIENT_STORE, }); console.log(data.store.communites);
Diff Detail
Event Timeline |