UNPKG

cloud-ide-model-schema

Version:

Pachage for schema management of Cloud IDEsys LMS

121 lines (120 loc) 3.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CNotificationPreference = void 0; var mongoose_1 = require("mongoose"); /* SCHEMA START */ var notification_preference = new mongoose_1.Schema({ npref_id_user: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "auth_user_mst", required: true, unique: true, comment: "User reference" }, npref_channels: { in_app: { enabled: { type: Boolean, default: true, comment: "In-app notifications enabled" }, categories: { type: [String], default: [], comment: "Allowed categories" }, priority_levels: { type: [String], default: ['low', 'normal', 'high', 'urgent'], comment: "Allowed priority levels" } }, email: { enabled: { type: Boolean, default: false, comment: "Email notifications enabled" }, categories: { type: [String], default: [], comment: "Allowed categories" }, priority_levels: { type: [String], default: ['high', 'urgent'], comment: "Allowed priority levels" }, email_address: { type: String, maxlength: 255, comment: "Email address for notifications" } }, sms: { enabled: { type: Boolean, default: false, comment: "SMS notifications enabled" }, categories: { type: [String], default: [], comment: "Allowed categories" }, priority_levels: { type: [String], default: ['urgent'], comment: "Allowed priority levels" }, phone_number: { type: String, maxlength: 20, comment: "Phone number for SMS" } } }, npref_quiet_hours: { enabled: { type: Boolean, default: false, comment: "Quiet hours enabled" }, start_time: { type: String, default: "22:00", comment: "Quiet hours start time" }, end_time: { type: String, default: "08:00", comment: "Quiet hours end time" }, timezone: { type: String, default: "Asia/Kolkata", comment: "Timezone for quiet hours" } }, npref_do_not_disturb: { type: Boolean, default: false, comment: "Do not disturb mode" }, npref_updated_at: { type: Date, default: Date.now, comment: "Last update timestamp" }, npref_created_at: { type: Date, default: Date.now, comment: "Creation timestamp" } }, { timestamps: { createdAt: 'npref_created_at', updatedAt: 'npref_updated_at' }, collection: 'notification_preferences' }); // Note: npref_id_user index is automatically created by unique: true var CNotificationPreference = mongoose_1.default.model("notification_preference", notification_preference); exports.CNotificationPreference = CNotificationPreference;