forked from Chatbot/v3-api
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
import { Document } from 'mongoose';
|
|
import {
|
|
ExpertPreparedMessageCategory,
|
|
EXPERT_PREPARED_MESSAGE_CATEGORIES,
|
|
} from 'src/common/types/expert-prepared-message-category.type';
|
|
|
|
@Schema({
|
|
timestamps: { createdAt: 'createdAt', updatedAt: 'updatedAt' },
|
|
versionKey: false,
|
|
collection: 'expert_prepared_messages',
|
|
_id: true,
|
|
})
|
|
export class ExpertPreparedMessageModel extends Document {
|
|
@Prop({ type: String, required: true, trim: true })
|
|
message: string;
|
|
|
|
@Prop({
|
|
type: String,
|
|
required: true,
|
|
enum: EXPERT_PREPARED_MESSAGE_CATEGORIES,
|
|
})
|
|
category: ExpertPreparedMessageCategory;
|
|
|
|
@Prop({ type: String, trim: true, default: '' })
|
|
label: string;
|
|
|
|
@Prop({ type: Boolean, default: true })
|
|
isEnabled: boolean;
|
|
|
|
@Prop({ type: Number, default: 0 })
|
|
sortOrder: number;
|
|
|
|
@Prop({ type: String, default: 'fa', trim: true })
|
|
locale: string;
|
|
|
|
@Prop({ type: String })
|
|
createdBy?: string;
|
|
|
|
@Prop({ type: String })
|
|
updatedBy?: string;
|
|
|
|
@Prop({ type: Date, default: Date.now })
|
|
createdAt: Date;
|
|
|
|
@Prop({ type: Date, default: Date.now })
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export const ExpertPreparedMessageSchema = SchemaFactory.createForClass(
|
|
ExpertPreparedMessageModel,
|
|
);
|
|
|
|
ExpertPreparedMessageSchema.index({ isEnabled: 1, category: 1, sortOrder: 1 });
|