All files / src/domains/projects/schemas project-configuration.schema.ts

0% Statements 0/15
0% Branches 0/9
100% Functions 0/0
0% Lines 0/13

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                                           
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Schema as MongooseSchema } from 'mongoose';
 
@Schema({ collection: 'project_configurations', timestamps: true })
export class ProjectConfiguration extends Document {
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true })
  tenantId!: MongooseSchema.Types.ObjectId;
  @Prop({ default: 'monthly', enum: ['weekly', 'biweekly', 'monthly'] })
  timesheetFrequency!: string;
  @Prop({ default: 1 }) timesheetStartDayOfWeek!: number; // 1 = Monday
  @Prop({ default: true }) requireTimesheetApproval!: boolean;
  @Prop({ default: 'standard_cost', enum: ['standard_cost', 'actual_cost'] })
  costCalculationMethod!: string;
  @Prop({ default: 'INR' }) defaultCurrency!: string;
  @Prop({ default: false }) allowTimeLoggingWithoutTask!: boolean;
  @Prop({ type: MongooseSchema.Types.Mixed, default: {} })
  customFields!: Record<string, unknown>;
}
export const ProjectConfigurationSchema =
  SchemaFactory.createForClass(ProjectConfiguration);
ProjectConfigurationSchema.index({ tenantId: 1 }, { unique: true });