7fife-backend/models/album.model.js

26 lines
676 B
JavaScript

const mongoose = require('mongoose');
const Schema = mongoose.Schema;
// Define the schema
const albumSchema = new mongoose.Schema({
categoryId: { type: Schema.Types.ObjectId, ref: 'Category' },
subcategoryId: { type: Schema.Types.ObjectId, ref: 'SubCategories' },
albumName: String,
shortDescription: String,
image: {
fileName: String,
fileAddress: String
},
status: {
type: String,
enum: ['activate', 'deactivate'],
default: 'activate'
}
}, { timestamps: true }); // This will add createdAt and updatedAt fields
// Create the model
const Album = mongoose.model('Album', albumSchema);
module.exports = Album;