Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document } from 'mongoose'; @Schema({ timestamps: true, collection: 'module_definitions' }) export class ModuleDefinition extends Document { @Prop({ required: true, unique: true, index: true }) key: string; // e.g. "crm", "finance" @Prop({ required: true }) name: string; @Prop({ default: null }) description: string; @Prop({ default: null }) icon: string; @Prop({ default: '1.0.0' }) version: string; @Prop({ default: false }) isCore: boolean; @Prop({ default: true }) isActive: boolean; } export const ModuleDefinitionSchema = SchemaFactory.createForClass(ModuleDefinition); @Schema({ timestamps: true, collection: 'tenant_module_licenses' }) export class TenantModuleLicense extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true, index: true }) moduleKey: string; @Prop({ default: true }) isActive: boolean; @Prop({ default: () => new Date() }) activatedAt: Date; @Prop({ default: null }) expiresAt: Date; } export const TenantModuleLicenseSchema = SchemaFactory.createForClass(TenantModuleLicense); TenantModuleLicenseSchema.index( { tenantId: 1, moduleKey: 1 }, { unique: true }, ); |