UNPKG

cloud-ide-model-schema

Version:

Pachage for schema management of Cloud IDEsys LMS

85 lines (84 loc) 2.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CNotificationTemplate = void 0; var mongoose_1 = require("mongoose"); /* SCHEMA START */ var notification_template = new mongoose_1.Schema({ ntemp_template_name: { type: String, required: true, unique: true, maxlength: 100, comment: "Unique template identifier" }, ntemp_template_type: { type: String, enum: ['in_app', 'email', 'sms', 'all'], required: true, default: 'all', comment: "Template type" }, ntemp_category: { type: String, required: true, maxlength: 50, comment: "Notification category" }, ntemp_subject: { type: String, maxlength: 200, comment: "Subject for email/SMS" }, ntemp_title: { type: String, required: true, maxlength: 200, comment: "Title for in-app notification" }, ntemp_message: { type: String, required: true, maxlength: 1000, comment: "Message template with variables" }, ntemp_variables: { type: [String], default: [], comment: "Available template variables" }, ntemp_default_priority: { type: String, enum: ['low', 'normal', 'high', 'urgent'], default: 'normal', comment: "Default priority" }, ntemp_default_channels: { type: [String], default: ['in_app'], comment: "Default channels" }, ntemp_is_active: { type: Boolean, default: true, comment: "Template active status" }, ntemp_created_at: { type: Date, default: Date.now, comment: "Creation timestamp" }, ntemp_updated_at: { type: Date, default: Date.now, comment: "Last update timestamp" } }, { timestamps: { createdAt: 'ntemp_created_at', updatedAt: 'ntemp_updated_at' }, collection: 'notification_templates' }); // Indexes // Note: ntemp_template_name index is automatically created by unique: true notification_template.index({ ntemp_category: 1 }); notification_template.index({ ntemp_is_active: 1 }); var CNotificationTemplate = mongoose_1.default.model("notification_template", notification_template); exports.CNotificationTemplate = CNotificationTemplate;