All files / src/domains/projects/schemas timesheet.schema.ts

0% Statements 0/16
0% Branches 0/27
100% Functions 0/0
0% Lines 0/14

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                                                       
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Schema as MongooseSchema } from 'mongoose';
 
@Schema({ collection: 'timesheets', timestamps: true })
export class Timesheet extends Document {
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true })
  tenantId!: MongooseSchema.Types.ObjectId;
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true })
  employeeId!: MongooseSchema.Types.ObjectId;
 
  @Prop({ required: true }) startDate!: Date;
  @Prop({ required: true }) endDate!: Date;
 
  @Prop({ default: 0 }) totalHours!: number;
  @Prop({ default: 0 }) billableHours!: number;
 
  @Prop({
    required: true,
    enum: ['draft', 'submitted', 'approved', 'rejected'],
  })
  status!: string;
  @Prop({ type: MongooseSchema.Types.ObjectId })
  approverId?: MongooseSchema.Types.ObjectId;
  @Prop() approvedAt?: Date;
  @Prop() rejectionReason?: string;
}
export const TimesheetSchema = SchemaFactory.createForClass(Timesheet);