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

27 lines
806 B
JavaScript
Raw Normal View History

2024-03-07 13:01:44 +00:00
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
// Define the schema
const albumSchema = new mongoose.Schema({
2024-03-11 12:29:54 +00:00
categoryId: { type: mongoose.Schema.Types.ObjectId, ref: 'Category', required: true },
subcategoryId: { type: mongoose.Schema.Types.ObjectId, ref: 'SubCategories', required: true },
albumName: { type: String, required: true },
shortDescription: { type: String, required: true },
image: {
fileName: { type: String },
fileAddress: { type: String },
},
imageUrl: { type: String },
status: {
type: String,
enum: ['activate', 'deactivate'],
default: 'activate'
}
2024-03-07 13:01:44 +00:00
}, { timestamps: true }); // This will add createdAt and updatedAt fields
// Create the model
const Album = mongoose.model('Album', albumSchema);
module.exports = Album;