Page MenuHomePhabricator

[sqlite] add methods to operate on communities table
ClosedPublic

Authored by ginsu on Feb 22 2024, 11:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 8, 11:02 AM
Unknown Object (File)
Mon, Apr 15, 11:55 PM
Unknown Object (File)
Apr 1 2024, 9:35 PM
Unknown Object (File)
Mar 13 2024, 1:29 AM
Unknown Object (File)
Mar 8 2024, 3:26 AM
Unknown Object (File)
Mar 4 2024, 6:08 PM
Unknown Object (File)
Mar 2 2024, 1:18 AM

Details

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]);

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ginsu added a subscriber: marcin.

Also adding @marcin as a reviewer since he did some work recently to deprecate our use of ORM

LGTM!

Could you add tests to this?
Here are some examples:

This should be quick and it's better to make sure queries work and make it safe to introduce some changes in the future.

This revision is now accepted and ready to land.Feb 23 2024, 6:05 AM