Files
asan-service/server/models/Announcement.js
T
Swift ce91aa24de #1
2023-08-20 13:50:30 +03:30

19 lines
513 B
JavaScript

const mongoose = require('mongoose')
function image(img) {
if (img) return '/uploads/images/announcement/' + img
}
const AnnouncementSchema = mongoose.Schema({
title: String,
caption: String,
seenBy: [mongoose.ObjectId],
expireDate: Number,
expired: { type: Boolean, default: false },
isForAgents: { type: Boolean, default: false },
image: { type: String, get: image },
_creator: { type: mongoose.ObjectId, ref: 'User' }
})
module.exports = mongoose.model('Announcement', AnnouncementSchema)