Skip to content

Commit

Permalink
Merge pull request #164 from TogetherCrew/disable-adding-role-for-com…
Browse files Browse the repository at this point in the history
…munity-creator

Disable adding role for community creator
  • Loading branch information
cyri113 authored Apr 15, 2024
2 parents e1bb36d + fa7a3b0 commit 7302939
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 27 deletions.
32 changes: 19 additions & 13 deletions __tests__/unit/models/platform.model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ describe('Platform model', () => {
// const module2 = new Module({
// name: 'hivemind',
// community: community._id,
// options: { platforms: [{ platform: new Types.ObjectId() }, { platform: platform._id }, { platform: new Types.ObjectId() }] },
// options: {
// platforms: [
// { platform: new Types.ObjectId() },
// { platform: platform._id },
// { platform: new Types.ObjectId() },
// ],
// },
// });
// await module2.save();

Expand Down Expand Up @@ -82,18 +88,18 @@ describe('Platform model', () => {
// if (communityDoc?.platforms && communityDoc?.roles) {
// const idAsString = platform.id.toHexString ? platform.id.toHexString() : platform.id;
// expect(communityDoc.platforms[0].toHexString()).toBe(idAsString);
// expect(JSON.parse(JSON.stringify(communityDoc.roles))).toEqual([
// {
// _id: expect.anything(),
// roleType: 'admin',
// source: {
// platform: 'discord',
// identifierType: 'member',
// identifierValues: [user.discordId],
// platformId: platform._id.toHexString(),
// },
// },
// ]);
// // expect(JSON.parse(JSON.stringify(communityDoc.roles))).toEqual([
// // {
// // _id: expect.anything(),
// // roleType: 'admin',
// // source: {
// // platform: 'discord',
// // identifierType: 'member',
// // identifierValues: [user.discordId],
// // platformId: platform._id.toHexString(),
// // },
// // },
// // ]);
// }
// });
// });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@togethercrew.dev/db",
"version": "3.0.50",
"version": "3.0.51",
"description": "All interactions with DB",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
26 changes: 13 additions & 13 deletions src/models/schemas/Platform.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ platformSchema.post('save', async function () {
{
$addToSet: {
platforms: platform._id,
roles: {
$each: [
{
roleType: 'admin',
source: {
platform: 'discord',
identifierType: 'member',
identifierValues: [user.discordId],
platformId: platform._id,
},
},
],
},
// roles: {
// $each: [
// {
// roleType: 'admin',
// source: {
// platform: 'discord',
// identifierType: 'member',
// identifierValues: [user.discordId],
// platformId: platform._id,
// },
// },
// ],
// },
},
},
);
Expand Down

0 comments on commit 7302939

Please sign in to comment.