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

36 lines
879 B
JavaScript

// song.model.js
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const songSchema = new Schema({
categoryId: { type: Schema.Types.ObjectId, ref: 'Category' },
subcategoryId: { type: Schema.Types.ObjectId, ref: 'SubCategories' },
albumId: { type: Schema.Types.ObjectId, ref: 'Album' },
artistId: [{
type: Schema.Types.ObjectId,
ref: 'Artist',
}],
title: String,
musicLink: String,
trackerID: String,
lyrics: String,
languageId: { type: Schema.Types.ObjectId, ref: 'Language' },
coverArtImage: {
filename: String,
fileAddress: String,
imageUrl: String
},
musicFile: {
filename: String,
fileAddress: String,
url: String
},
status: {
type: String,
enum: ['activate', 'deactivate'],
default: 'activate'
}
}, { timestamps: true });
module.exports = mongoose.model('Song', songSchema);