91 lines
2.0 KiB
JavaScript
91 lines
2.0 KiB
JavaScript
const mongoose = require("mongoose");
|
|
const timestamp = require("mongoose-timestamp");
|
|
const mongoosePaginate = require("mongoose-paginate-v2");
|
|
|
|
const modelSchema = new mongoose.Schema({
|
|
price: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
cuorse_name: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
category:{
|
|
type: String
|
|
},
|
|
offer: {
|
|
type: String
|
|
},
|
|
academyId:{
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'Academy'
|
|
},
|
|
caption: {
|
|
type: String,
|
|
required: false,
|
|
trim: true,
|
|
minLength: 1,
|
|
maxLength: 1000,
|
|
default: null,
|
|
},
|
|
status: {
|
|
type: String,
|
|
required: false,
|
|
trim: true,
|
|
enum: ['pending', 'temp_accept', 'accept', 'reject'],
|
|
default: 'temp_accept',
|
|
},
|
|
user_id: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'User',
|
|
},
|
|
likes: {
|
|
type: Number,
|
|
required: false,
|
|
trim: true,
|
|
default: 0,
|
|
},
|
|
comments: {
|
|
type: Object,
|
|
default: null,
|
|
},
|
|
type: {
|
|
type: String,
|
|
required: false,
|
|
trim: true,
|
|
enum: ['normal', 'pro', 'legend'],
|
|
default: "normal",
|
|
},
|
|
course_time: {
|
|
type: String
|
|
},
|
|
number_of_course_content: {
|
|
type: String
|
|
},
|
|
teacher_number: {
|
|
type: String
|
|
},
|
|
course_image: {
|
|
type: String
|
|
},
|
|
teacher_name: {
|
|
type: String
|
|
},
|
|
is_free: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
contactInfo: {
|
|
mobile: { type: String, default: null },
|
|
telegramLink: { type: String, default: null },
|
|
whatsappNumber: { type: String, default: null },
|
|
instagramLink: { type: String, default: null },
|
|
},
|
|
});
|
|
|
|
modelSchema.plugin(timestamp);
|
|
modelSchema.plugin(mongoosePaginate);
|
|
const PostModel = mongoose.model("Course", modelSchema);
|
|
module.exports = PostModel;
|