HomePhabricator
Diffusion Comm b1f35f4bd8e6

[sqlite] implement c++ code to get communities

Description

[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

Screenshot 2024-02-23 at 3.25.08 AM.png (1×3 px, 1 MB)

Screenshot 2024-02-23 at 3.25.00 AM.png (1×1 px, 648 KB)

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

Details

Provenance
ginsuAuthored on Feb 20 2024, 1:13 PM
Reviewer
kamil
Differential Revision
D11153: [sqlite] implement c++ code to get communities
Parents
rCOMM571ae32fcd45: [sqlite] implement C++ community store ops
Branches
Unknown
Tags
Unknown