问卷
This commit is contained in:
@@ -52,6 +52,11 @@ export default class Survey extends BaseModel {
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async findByCode(code: string) {
|
||||
let rec: SurveyType = await SurveyModel.findOne({ code }).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async updateSurvey(code: string, param: SurveyUpdate, select = '') {
|
||||
if(code == 'new') code = genCode(6);
|
||||
let rec: SurveyType = await SurveyModel.findOneAndUpdate({ code }, { $set: {...param, code} }, {new: true, upsert: true}).select(select).lean();
|
||||
|
||||
Reference in New Issue
Block a user