This commit is contained in:
luying
2022-04-02 17:43:12 +08:00
parent f50c32079c
commit 89744aeb13
11 changed files with 193 additions and 7 deletions
+32
View File
@@ -0,0 +1,32 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
@index({ id: 1 })
@index({ seasonNum: 1 })
export default class Survey extends BaseModel {
@prop({ required: true })
surveyId: string; // 问卷id
@prop({ required: true })
surveyName: string; // 问卷id
@prop({ required: true })
roleIndex: number; // 问卷id
@prop({ required: true })
reward: string; // 奖励
@prop({ required: true })
mailContent: string; // 邮件文字
public static async findBySurveyId(surveyId: string) {
let rec: SurveyType = await SurveyModel.findOne({ surveyId }).lean();
return rec;
}
}
export const SurveyModel = getModelForClass(Survey);
export interface SurveyType extends Pick<DocumentType<Survey>, keyof Survey> {};
export type SurveyUpdate = Partial<SurveyType>; // 将所有字段变成可选项