Files
kavehhn f04c797be6 Initial commit: teaching institution management API.
Express/MongoDB backend with JWT auth, RBAC, S3 uploads, notifications, and scheduled jobs.
2026-08-09 04:18:08 +02:00

82 lines
1.3 KiB
JavaScript

// /components/contactInquiries/contactInquiryModel.js
const mongoose = require('mongoose');
const CONTACT_METHODS = [
'WhatsApp',
'Telegram',
'Soroush',
'Bale',
'Eitaa',
'SMS',
'Call'
];
const CONTACT_STATUSES = [
'new',
'seen',
'call_later',
'contacted',
'closed'
];
const contactInquirySchema = new mongoose.Schema({
name: {
type: String,
required: true,
trim: true
},
surname: {
type: String,
required: true,
trim: true
},
nationalIdCode: {
type: String,
trim: true,
index: true
},
phoneNumber: {
type: String,
trim: true,
index: true
},
email: {
type: String,
trim: true,
lowercase: true
},
message: {
type: String,
trim: true,
maxlength: 2000
},
preferredContactMethods: [{
type: String,
enum: CONTACT_METHODS
}],
courses: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'Course'
}],
status: {
type: String,
enum: CONTACT_STATUSES,
default: 'new',
index: true
},
notes: {
type: String,
trim: true,
maxlength: 5000,
default: ''
}
}, {
timestamps: true
});
contactInquirySchema.statics.CONTACT_METHODS = CONTACT_METHODS;
contactInquirySchema.statics.CONTACT_STATUSES = CONTACT_STATUSES;
module.exports = mongoose.model('ContactInquiry', contactInquirySchema);