HomePhabricator
Diffusion Comm 68a6672a3569

[sqlite] add methods to operate on communities table

Description

[sqlite] add methods to operate on communities table

Summary:
This diff introduces the logic + boilerplate for how we will represent a community in the table data row, the methods to add, modify and remove those data rows and the emscripten binding

Linear task: https://linear.app/comm/issue/ENG-6531/add-methods-to-operate-on-operate-on-communities-table

Depends on D11087

Test Plan:
Locally built some buttons + actions for each method and confirmed that when I triggered the actions the client db communities table was correctly being modified.

For reference, here is the local code with the callbacks that dispatch the actions to my community reducer (The community reducer will be introduced in subsequent diff)

const dispatch = useDispatch();

const fakeCommunityID = '256|84261';

const onPressAddCommunity = React.useCallback(() => {
  const communityInfo: CommunityInfo = {
    enabledApps: {
      calendar: true,
      wiki: false,
      tasks: true,
      files: true,
    },
  };

  dispatch({
    type: addCommunityActionType,
    payload: {
      id: fakeCommunityID,
      newCommunityInfo: communityInfo,
    },
  });
}, [dispatch]);

const onPressRemoveCommunity = React.useCallback(() => {
  dispatch({
    type: removeCommunityActionType,
    payload: {
      id: fakeCommunityID,
    },
  });
}, [dispatch]);

const onPressRemoveAllCommunities = React.useCallback(() => {
  dispatch({
    type: removeAllCommunitesActionType,
  });
}, [dispatch]);

Reviewers: atul, inka, kamil, marcin

Reviewed By: kamil

Subscribers: marcin, ashoat, tomek

Differential Revision: https://phab.comm.dev/D11151

Details

Provenance
ginsuAuthored on Feb 14 2024, 11:45 PM
Reviewer
kamil
Differential Revision
D11151: [sqlite] add methods to operate on communities table
Parents
rCOMM5d3f1a74764f: [sqlite] add communites table for community store data
Branches
Unknown
Tags
Unknown