All files / src/platform/calendar/schemas meeting.schema.ts

0% Statements 0/27
0% Branches 0/20
100% Functions 0/0
0% Lines 0/23

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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104                                                                                                                                                                                                               
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Schema as MongooseSchema } from 'mongoose';
 
@Schema({ timestamps: true, collection: 'calendar_meetings' })
export class MeetingDefinition extends Document {
  @Prop({ required: true, index: true })
  tenantId: string;
 
  @Prop({ required: true, unique: true, index: true })
  meetingId: string;
 
  @Prop({ required: true, index: true })
  eventId: string; // Links to calendar_events
 
  @Prop({ type: [{
    topic: { type: String, required: true },
    durationMinutes: { type: Number, default: 15 },
    presenterId: { type: String }
  }], default: [] })
  agenda: Array<{
    topic: string;
    durationMinutes: number;
    presenterId?: string;
  }>;
 
  @Prop({ type: [{
    decisionText: { type: String, required: true },
    decidedByParticipantIds: [{ type: String }],
    decidedAt: { type: Date, default: Date.now }
  }], default: [] })
  decisions: Array<{
    decisionText: string;
    decidedByParticipantIds: string[];
    decidedAt: Date;
  }>;
 
  @Prop({ type: [{
    description: { type: String, required: true },
    assigneeId: { type: String, required: true },
    dueDate: { type: Date },
    status: { type: String, default: 'pending', enum: ['pending', 'in_progress', 'completed'] },
    externalTaskId: { type: String } // optional project/task reference
  }], default: [] })
  actionItems: Array<{
    description: string;
    assigneeId: string;
    dueDate?: Date;
    status: string;
    externalTaskId?: string;
  }>;
 
  @Prop()
  meetingMinutesText?: string;
}
 
export const MeetingDefinitionSchema = SchemaFactory.createForClass(MeetingDefinition);
MeetingDefinitionSchema.index({ tenantId: 1, meetingId: 1 }, { unique: true });
MeetingDefinitionSchema.index({ tenantId: 1, eventId: 1 });
 
@Schema({ timestamps: true, collection: 'calendar_meeting_polls' })
export class MeetingAvailabilityPoll extends Document {
  @Prop({ required: true, index: true })
  tenantId: string;
 
  @Prop({ required: true, unique: true, index: true })
  pollId: string;
 
  @Prop({ required: true })
  title: string;
 
  @Prop({ required: true })
  durationMinutes: number;
 
  @Prop({ type: [{
    optionId: { type: String, required: true },
    startAt: { type: Date, required: true },
    endAt: { type: Date, required: true }
  }], required: true })
  options: Array<{
    optionId: string;
    startAt: Date;
    endAt: Date;
  }>;
 
  @Prop({ type: [{
    responderId: { type: String, required: true },
    preferredOptionIds: [{ type: String }],
    availableOptionIds: [{ type: String }],
    respondedAt: { type: Date, default: Date.now }
  }], default: [] })
  responses: Array<{
    responderId: string;
    preferredOptionIds: string[];
    availableOptionIds: string[];
    respondedAt: Date;
  }>;
 
  @Prop({ default: 'open', enum: ['open', 'closed'] })
  status: string;
}
 
export const MeetingAvailabilityPollSchema = SchemaFactory.createForClass(MeetingAvailabilityPoll);
MeetingAvailabilityPollSchema.index({ tenantId: 1, pollId: 1 }, { unique: true });