问卷
This commit is contained in:
@@ -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>; // 将所有字段变成可选项
|
||||
Reference in New Issue
Block a user