[sqlite] implement c++ code to get communities
Summary:
Introduced all the necessary code for native ops for getting communities from the community store
Linear task: https://linear.app/comm/issue/ENG-6533/implement-c-code-to-get-communities
Depends on D11152
Test Plan:
In a subsequent diff I will introduce logic to read communities from sqlite on app start and I was able to see that using the c++ code introduced in this diff I was able to get the communities into my redux store
Also called the following code:
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, }, }; let data = await commCoreModule.getClientDBStore(); console.log(data.communities); await commCoreModule.processCommunityStoreOperations([ { type: 'replace_community', payload: { id: '1', communityInfo: TEST_COMMUNITY_1, }, }, { type: 'replace_community', payload: { id: '2', communityInfo: TEST_COMMUNITY_2, }, }, ]); data = await commCoreModule.getClientDBStore(); console.log(data.communities); const community2Updated: CommunityInfo = { enabledApps: { calendar: true, wiki: true, tasks: true, files: true, }, }; await commCoreModule.processCommunityStoreOperations([ { type: 'replace_community', payload: { id: '2', communityInfo: community2Updated, }, }, ]); data = await commCoreModule.getClientDBStore(); console.log(data.communities); await commCoreModule.processCommunityStoreOperations([ { type: 'remove_communities', payload: { ids: ['1'], }, }, ]); data = await commCoreModule.getClientDBStore(); console.log(data.communities); await commCoreModule.processCommunityStoreOperations([ { type: 'remove_all_communities', }, ]); data = await commCoreModule.getClientDBStore(); console.log(data.communities);
Reviewers: atul, inka, kamil
Reviewed By: kamil
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D11153