From 1e2bf7a4a989d5dbdf81e37c191c5578c35d52d2 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 11 Nov 2024 14:32:50 +0400 Subject: [PATCH] chore: support null value for module.options.platform.name --- __tests__/unit/models/module.model.test.ts | 4 ++-- package.json | 2 +- src/interfaces/Module.interface.ts | 4 ++-- src/models/schemas/Module.schema.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/__tests__/unit/models/module.model.test.ts b/__tests__/unit/models/module.model.test.ts index e056a41..97d7ea0 100644 --- a/__tests__/unit/models/module.model.test.ts +++ b/__tests__/unit/models/module.model.test.ts @@ -17,11 +17,11 @@ describe('Module model', () => { options: { platforms: [ { - platform: new Types.ObjectId(), + platform: null, metadata: { selectedChannels: ['c1', 'c2'], }, - name: PlatformNames.Discord, + name: null, }, ], }, diff --git a/package.json b/package.json index 0bf77c6..252311b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/interfaces/Module.interface.ts b/src/interfaces/Module.interface.ts index f076ae4..ae9b222 100644 --- a/src/interfaces/Module.interface.ts +++ b/src/interfaces/Module.interface.ts @@ -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; // dynamic object since structure can change }>; }; diff --git a/src/models/schemas/Module.schema.ts b/src/models/schemas/Module.schema.ts index de330e4..7df69af 100644 --- a/src/models/schemas/Module.schema.ts +++ b/src/models/schemas/Module.schema.ts @@ -28,7 +28,7 @@ const moduleSchema = new Schema( }, name: { type: String, - enum: Object.values(PlatformNames), + enum: [...Object.values(PlatformNames), null], default: null, }, },