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
F3391009: D11151.diff
Sat, Nov 30, 1:54 AM
Unknown Object (File)
Tue, Nov 26, 11:51 PM
Unknown Object (File)
Tue, Nov 12, 9:36 AM
Unknown Object (File)
Mon, Nov 11, 11:04 AM
Unknown Object (File)
Wed, Nov 6, 3:24 PM
Unknown Object (File)
Oct 27 2024, 5:12 AM
Unknown Object (File)
Oct 20 2024, 11:07 PM
Unknown Object (File)
Oct 15 2024, 6:49 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
No Lint Coverage
Unit
No Test Coverage

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