feat: modeldata接口。fix: 部分权限校验bug

This commit is contained in:
archer
2023-03-28 17:56:31 +08:00
parent c3ccbcb7f6
commit 586607a9ce
13 changed files with 260 additions and 7 deletions

View File

@@ -0,0 +1,36 @@
/* 模型的知识库 */
import { Schema, model, models, Model as MongoModel } from 'mongoose';
import { ModelDataSchema as ModelDataType } from '@/types/mongoSchema';
const ModelDataSchema = new Schema({
modelId: {
type: Schema.Types.ObjectId,
ref: 'model',
required: true
},
userId: {
type: Schema.Types.ObjectId,
ref: 'user',
required: true
},
q: {
type: String,
required: true
},
a: {
type: String,
default: ''
},
status: {
type: Number,
enum: [0, 1, 2],
default: 1
},
createTime: {
type: Date,
default: () => new Date()
}
});
export const ModelData: MongoModel<ModelDataType> =
models['modelData'] || model('modelData', ModelDataSchema);