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 | 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: 'qms_audits' })
export class QmsAudit extends Document {
@Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true })
tenantId: MongooseSchema.Types.ObjectId;
@Prop({ required: true })
auditCode: string;
@Prop({ required: true })
auditName: string;
@Prop({ default: 'planned', index: true })
status: string; // 'planned' | 'scheduled' | 'in_progress' | 'findings_issued' | 'closed'
@Prop({ type: [{ question: String, answer: String, isFinding: Boolean, details: String }], default: [] })
checklist: Array<{
question: string;
answer?: string; // 'pass' | 'fail' | 'na'
isFinding: boolean;
details?: string;
}>;
}
export const QmsAuditSchema = SchemaFactory.createForClass(QmsAudit);
QmsAuditSchema.index({ tenantId: 1, auditCode: 1 }, { unique: true });
QmsAuditSchema.index({ tenantId: 1, status: 1 });
|