GIF89a
import mongoose from "mongoose";
import { contentAccessType, contentStatus } from "../validators/constaints.js";
const contentSchema = new mongoose.Schema(
{
catId: {
type: mongoose.Schema.Types.ObjectId,
ref: "Category",
required: true
},
createdBy: {
type: mongoose.Schema.Types.ObjectId,
ref: "User" // Admin
},
contentOf: {
type: mongoose.Schema.Types.ObjectId,
ref: "User" // Artist
},
title: {
type: String,
required: true
},
about: String,
language: String,
tags: [String],
images: [
{
public_id: String,
url: String
}
],
videos: [
{
public_id: String,
url: String
}
],
IsNew: {
type: Boolean,
default: false
},
isRecommended: {
type: Boolean,
default: false
},
status: {
type: String,
enum: [contentStatus.active, contentStatus.inactive, contentStatus.draft],
default: contentStatus.active
},
contentPrice: {
type: String,
required: true
},
contentAccessType: {
type: String,
enum: [contentAccessType.rental, contentAccessType.ownership],
default: contentAccessType.rental
},
youtubeVideos: [
{
url: {
type: String,
required: true
}
}
]
},
{
timestamps: true
}
);
const Content = mongoose.model('Content', contentSchema)
export default Content