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 | 1x 1x 1x 1x 1x 1x 1x 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_inspection_plans' })
export class QualityInspectionPlan extends Document {
@Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true })
tenantId: MongooseSchema.Types.ObjectId;
@Prop({ required: true })
planName: string;
@Prop({ type: MongooseSchema.Types.ObjectId, required: true })
specificationId: MongooseSchema.Types.ObjectId;
}
export const QualityInspectionPlanSchema = SchemaFactory.createForClass(QualityInspectionPlan);
@Schema({ timestamps: true, collection: 'qms_inspection_lots' })
export class QmsInspectionLot extends Document {
@Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true })
tenantId: MongooseSchema.Types.ObjectId;
@Prop({ required: true })
lotNumber: string;
@Prop({ required: true })
sourceType: string; // 'procurement' | 'manufacturing' | 'asset' | 'ad_hoc'
@Prop({ type: MongooseSchema.Types.ObjectId, required: true })
sourceRecordId: MongooseSchema.Types.ObjectId;
@Prop({ default: 'created', index: true })
status: string; // 'created' | 'sampling' | 'in_progress' | 'approved' | 'rejected' | 'quarantine'
@Prop({ type: [{ characteristicName: String, measuredValue: Number, passed: Boolean }], default: [] })
results: Array<{
characteristicName: string;
measuredValue?: number;
passed: boolean;
}>;
@Prop()
completedAt?: Date;
}
export const QmsInspectionLotSchema = SchemaFactory.createForClass(QmsInspectionLot);
QmsInspectionLotSchema.index({ tenantId: 1, lotNumber: 1 }, { unique: true });
QmsInspectionLotSchema.index({ tenantId: 1, sourceType: 1, sourceRecordId: 1 });
|