import { Document, Schema, Model, model } from 'mongoose'; import { CategoryInterface } from '../helpers/interface'; import * as uuid from 'uuid'; interface CategoryModel extends CategoryInterface, Document {} const CategorySchema: Schema = new Schema( { uuid: { type: String, default: uuid.v4 }, title: { type: String }, slug: { type: String, unique: true }, deals: { type: Number, default: 0 }, header_description: { type: String }, // eslint-disable-next-line @typescript-eslint/camelcase full_description: { type: String }, // eslint-disable-next-line @typescript-eslint/camelcase thumb_uri: { type: String }, // eslint-disable-next-line @typescript-eslint/camelcase file_name: { type: String }, }, { collection: 'categories', timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' }, }, ); export const Category: Model = model('categories', CategorySchema);