import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Types } from 'mongoose'; import { ReactEnum } from 'src/common/types/react.type'; import { Sender } from 'src/common/types/sender.type'; @Schema({ timestamps: { createdAt: 'createdAt' }, collection: 'reacts', versionKey: false, _id: true, }) export class ReactsModel { @Prop({ _id: true, default: new Types.ObjectId() }) sessionId: Types.ObjectId; @Prop({ _id: true, default: new Types.ObjectId() }) messageId: Types.ObjectId; @Prop({ _id: true, default: new Types.ObjectId() }) userId: Types.ObjectId; @Prop({ default: false }) question: string; @Prop({ default: false }) answer: string; @Prop({ default: null, type: String, enum: Sender }) sender: Sender; @Prop({ default: null, enum: ReactEnum }) react: string; @Prop({ type: [String], required: true }) createdAt: [string, string]; // [time, date] @Prop({ type: Date, default: Date.now }) createdISO: Date; } export const ReactSchema = SchemaFactory.createForClass(ReactsModel);