From f6caff6798cc5f69f4e33ca76508f4b72334b700 Mon Sep 17 00:00:00 2001 From: Behzad-rabiei Date: Wed, 9 Apr 2025 13:03:24 +0200 Subject: [PATCH] feat: add activated field to module schema --- CHANGELOG.md | 6 ------ __tests__/unit/models/module.model.test.ts | 8 +++++--- src/interfaces/Module.interface.ts | 6 ++++-- src/models/schemas/Module.schema.ts | 10 ++++++++-- 4 files changed, 17 insertions(+), 13 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index cfe4dad..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,6 +0,0 @@ -# [3.3.0](https://github.com/TogetherCrew/mongo-lib/compare/v3.2.3...v3.3.0) (2025-02-16) - - -### Features - -* add website platform and hivemind option ([357e13f](https://github.com/TogetherCrew/mongo-lib/commit/357e13f9133afca7a822513a6d37142b28eb1cfb)) diff --git a/__tests__/unit/models/module.model.test.ts b/__tests__/unit/models/module.model.test.ts index 97d7ea0..647662a 100644 --- a/__tests__/unit/models/module.model.test.ts +++ b/__tests__/unit/models/module.model.test.ts @@ -1,7 +1,8 @@ -import { Module, Platform, Community, User } from '../../../src/models'; -import { IModule } from '../../../src/interfaces'; import { Types } from 'mongoose'; -import { ModuleNames, PlatformNames } from '../../../src/config/enums'; + +import { ModuleNames } from '../../../src/config/enums'; +import { IModule } from '../../../src/interfaces'; +import { Module } from '../../../src/models'; // import setupTestDB from '../../utils/setupTestDB'; @@ -14,6 +15,7 @@ describe('Module model', () => { module = { name: ModuleNames.Hivemind, community: new Types.ObjectId(), + activated: false, options: { platforms: [ { diff --git a/src/interfaces/Module.interface.ts b/src/interfaces/Module.interface.ts index ae9b222..1eb2efb 100644 --- a/src/interfaces/Module.interface.ts +++ b/src/interfaces/Module.interface.ts @@ -1,9 +1,11 @@ -import { type Model, type Types } from 'mongoose'; -import { type PlatformNames, type ModuleNames } from '../config/enums'; +import { Model, Types } from 'mongoose'; + +import { ModuleNames, PlatformNames } from '../config/enums'; export interface IModule { name: ModuleNames; community: Types.ObjectId; + activated: boolean; options?: { platforms: Array<{ platform: Types.ObjectId | null; diff --git a/src/models/schemas/Module.schema.ts b/src/models/schemas/Module.schema.ts index 7df69af..f754149 100644 --- a/src/models/schemas/Module.schema.ts +++ b/src/models/schemas/Module.schema.ts @@ -1,7 +1,8 @@ import { Schema } from 'mongoose'; -import { toJSON, paginate } from './plugins'; + +import { ModuleNames, PlatformNames } from '../../config/enums'; import { type IModule, type ModuleModel } from '../../interfaces'; -import { PlatformNames, ModuleNames } from '../../config/enums'; +import { paginate, toJSON } from './plugins'; const moduleSchema = new Schema( { @@ -15,6 +16,11 @@ const moduleSchema = new Schema( ref: 'Community', required: true, }, + activated: { + type: Boolean, + required: true, + default: false, + }, options: { platforms: [ {