Skip to content

Commit

Permalink
Merge pull request #178 from TogetherCrew/module-platform-agnostic-up…
Browse files Browse the repository at this point in the history
…date

chore: support null value for module.options.platform.name
  • Loading branch information
cyri113 authored Nov 11, 2024
2 parents 10d571c + 1e2bf7a commit 572f9ff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions __tests__/unit/models/module.model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ describe('Module model', () => {
options: {
platforms: [
{
platform: new Types.ObjectId(),
platform: null,
metadata: {
selectedChannels: ['c1', 'c2'],
},
name: PlatformNames.Discord,
name: null,
},
],
},
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.71",
"version": "3.0.72",
"description": "All interactions with DB",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/Module.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export interface IModule {
community: Types.ObjectId;
options?: {
platforms: Array<{
platform: Types.ObjectId;
name: PlatformNames;
platform: Types.ObjectId | null;
name: PlatformNames | null;
metadata?: Record<string, any>; // dynamic object since structure can change
}>;
};
Expand Down
2 changes: 1 addition & 1 deletion src/models/schemas/Module.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const moduleSchema = new Schema<IModule, ModuleModel>(
},
name: {
type: String,
enum: Object.values(PlatformNames),
enum: [...Object.values(PlatformNames), null],
default: null,
},
},
Expand Down

0 comments on commit 572f9ff

Please sign in to comment.