feat: collection model
This commit is contained in:
18
src/service/models/collection.ts
Normal file
18
src/service/models/collection.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Schema, model, models, Model as MongoModel } from 'mongoose';
|
||||
import { CollectionSchema as CollectionType } from '@/types/mongoSchema';
|
||||
|
||||
const CollectionSchema = new Schema({
|
||||
userId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'user',
|
||||
required: true
|
||||
},
|
||||
modelId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'model',
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
export const Collection: MongoModel<CollectionType> =
|
||||
models['collection'] || model('collection', CollectionSchema);
|
||||
Reference in New Issue
Block a user