forked from Shared/esg
update the esg
This commit is contained in:
30
src/claims/schemas/evaluation-request.schema.ts
Normal file
30
src/claims/schemas/evaluation-request.schema.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { HydratedDocument, Types } from 'mongoose';
|
||||
|
||||
export type EvaluationRequestDocument = HydratedDocument<EvaluationRequest>;
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class EvaluationHistoryEntry {
|
||||
@Prop({ type: Types.ObjectId, ref: 'FieldExpert', required: true })
|
||||
expertId!: Types.ObjectId;
|
||||
|
||||
@Prop()
|
||||
expertCode?: number;
|
||||
|
||||
@Prop({ required: true, default: () => new Date() })
|
||||
evaluatedAt!: Date;
|
||||
}
|
||||
|
||||
export const EvaluationHistoryEntrySchema =
|
||||
SchemaFactory.createForClass(EvaluationHistoryEntry);
|
||||
|
||||
@Schema({ timestamps: true, collection: 'evaluation_requests' })
|
||||
export class EvaluationRequest {
|
||||
@Prop({ required: true, unique: true, trim: true })
|
||||
requestId!: string;
|
||||
|
||||
@Prop({ type: [EvaluationHistoryEntrySchema], default: [] })
|
||||
evaluations!: EvaluationHistoryEntry[];
|
||||
}
|
||||
|
||||
export const EvaluationRequestSchema = SchemaFactory.createForClass(EvaluationRequest);
|
||||
18
src/claims/schemas/field-expert.schema.ts
Normal file
18
src/claims/schemas/field-expert.schema.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { HydratedDocument, Types } from 'mongoose';
|
||||
|
||||
export type FieldExpertDocument = HydratedDocument<FieldExpert>;
|
||||
|
||||
@Schema({ timestamps: true, collection: 'field_experts' })
|
||||
export class FieldExpert {
|
||||
@Prop({ required: true, trim: true })
|
||||
name!: string;
|
||||
|
||||
@Prop({ required: true, unique: true })
|
||||
expertCode!: number;
|
||||
|
||||
@Prop({ default: true })
|
||||
active!: boolean;
|
||||
}
|
||||
|
||||
export const FieldExpertSchema = SchemaFactory.createForClass(FieldExpert);
|
||||
Reference in New Issue
Block a user