Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable adding role for community creator #164

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() },
// ],
// },
Comment on lines +48 to +54
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The search results indicate that the old options structure is still being referenced in commented-out code within both the platform.model.test.ts and community.model.test.ts files. This suggests that the restructuring of the options object might not be fully reflected across all relevant tests.

Actionable Directive

Review and update the test cases in platform.model.test.ts and community.model.test.ts to ensure they align with the new structure of the options object. This is crucial to maintain consistency and accuracy in your test suite.

Analysis chain

Commented out test cases related to platform options in the module.

Ensure that the restructuring of the options object is correctly reflected in other tests that might interact with this structure.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any tests that might still be using the old `options` structure.
rg --type ts "options: { platforms:"

Length of output: 153



Script:

#!/bin/bash
# Correcting the regex error and re-running the search for any tests that might still be using the old `options` structure.
rg --type ts "options: \{ platforms:"

Length of output: 299

// });
// 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
Loading