All files / visitor/schemas appointment.schema.ts

100% Statements 14/14
79.16% Branches 19/24
100% Functions 0/0
100% Lines 12/12

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 301x 1x     1x   1x     1x     1x     1x     1x     1x     1x     1x 1x  
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Schema as MongooseSchema } from 'mongoose';
 
@Schema({ timestamps: true, collection: 'visitor_appointments' })
export class VisitorAppointment extends Document {
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true })
  tenantId: MongooseSchema.Types.ObjectId;
 
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'VisitorProfile', required: true, index: true })
  visitorProfileId: MongooseSchema.Types.ObjectId;
 
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Employee', required: true, index: true })
  hostEmployeeId: MongooseSchema.Types.ObjectId;
 
  @Prop({ required: true, index: true })
  appointmentDate: Date;
 
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Booking' })
  meetingRoomBookingId?: MongooseSchema.Types.ObjectId; // References Calendar Platform Booking
 
  @Prop({ default: 'pending', index: true })
  status: string; // 'pending' | 'approved' | 'rejected' | 'cancelled'
 
  @Prop({ default: '' })
  purposeOfVisit: string;
}
 
export const VisitorAppointmentSchema = SchemaFactory.createForClass(VisitorAppointment);
VisitorAppointmentSchema.index({ tenantId: 1, hostEmployeeId: 1, appointmentDate: 1 });