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 56 57 58 59 60 61 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document, Schema as MongooseSchema, Types } from 'mongoose'; @Schema({ timestamps: true, collection: 'support_groups' }) export class SupportGroup extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true }) groupName: string; // e.g. "IT Tier 1", "Finance Support" @Prop({ default: null }) description?: string; @Prop({ type: [String], default: [] }) memberAgentIds: string[]; // employeeIds who belong to this group } export const SupportGroupSchema = SchemaFactory.createForClass(SupportGroup); @Schema({ timestamps: true, collection: 'support_queues' }) export class SupportQueue extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true }) queueName: string; // e.g. "IT Incident Queue", "Billing Discrepancies" @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'SupportGroup' }) routingGroupId?: MongooseSchema.Types.ObjectId; @Prop({ default: 'round_robin' }) routingAlgorithm: string; // 'round_robin' | 'least_assigned' | 'manual' } export const SupportQueueSchema = SchemaFactory.createForClass(SupportQueue); @Schema({ timestamps: true, collection: 'agent_availabilities' }) export class AgentAvailability extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true, unique: true }) agentId: string; // employeeId @Prop({ default: true }) isOnline: boolean; @Prop({ default: 5 }) maxCapacity: number; // Max concurrent tickets allowed @Prop({ default: 0 }) activeTicketsCount: number; @Prop({ type: [String], default: [] }) skills: string[]; // ['hardware', 'payroll', 'networking'] } export const AgentAvailabilitySchema = SchemaFactory.createForClass(AgentAvailability); AgentAvailabilitySchema.index({ tenantId: 1, agentId: 1 }, { unique: true }); |