Skip to content

Commit 7d749da

Browse files
Merge pull request #474 from TogetherCrew/migration-script-to-add-modules
Migration script to add modules
2 parents 646e338 + f316e47 commit 7d749da

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

src/docs/module.doc.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@ paths:
2020
- hivemind
2121
- violationDetection
2222
- dynamicNft
23+
- communityInsights
24+
- communityHealth
25+
- announcements
2326
community:
2427
type: string
2528
format: objectId
29+
activated:
30+
type: boolean
31+
description: Activation status of the module. Determines whether the module is enabled.
2632
responses:
2733
'201':
2834
description: Module created successfully.
@@ -52,6 +58,9 @@ paths:
5258
- hivemind
5359
- violationDetection
5460
- dynamicNft
61+
- communityInsights
62+
- communityHealth
63+
- announcements
5564
- in: query
5665
name: community
5766
schema:
@@ -263,6 +272,9 @@ paths:
263272
tokenId:
264273
type: string
265274
description: Metadata for the dynamicNft.
275+
activated:
276+
type: boolean
277+
description: Activation status of the module. Required for all modules.
266278
minProperties: 1
267279
responses:
268280
'200':
@@ -300,3 +312,40 @@ paths:
300312
'404':
301313
description: NotFound
302314
$ref: '#/components/responses/NotFound'
315+
316+
components:
317+
schemas:
318+
Module:
319+
type: object
320+
properties:
321+
id:
322+
type: string
323+
description: Unique identifier for the module
324+
name:
325+
type: string
326+
enum:
327+
- hivemind
328+
- violationDetection
329+
- dynamicNft
330+
- communityInsights
331+
- communityHealth
332+
- announcements
333+
description: Name of the module
334+
community:
335+
type: string
336+
format: objectId
337+
description: ID of the community the module belongs to
338+
options:
339+
type: object
340+
description: Module-specific configuration options, varies by module type
341+
activated:
342+
type: boolean
343+
description: Indicates whether the module is currently activated
344+
createdAt:
345+
type: string
346+
format: date-time
347+
description: Date and time when the module was created
348+
updatedAt:
349+
type: string
350+
format: date-time
351+
description: Date and time when the module was last updated

src/validations/module.validation.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,15 @@ const dynamicModuleUpdate = (req: any) => {
230230
}),
231231
};
232232
break;
233+
case ModuleNames.CommunityInsights:
234+
case ModuleNames.CommunityHealth:
235+
case ModuleNames.Announcements:
236+
bodyOption = {
237+
body: Joi.object().required().keys({
238+
activated: Joi.boolean(),
239+
}),
240+
};
241+
break;
233242
default:
234243
req.allowInput = false;
235244
return {};

0 commit comments

Comments
 (0)