UNPKG

cloud-ide-model-schema

Version:

Pachage for schema management of Cloud IDEsys LMS

93 lines (92 loc) 2.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CBackupJob = void 0; var mongoose_1 = require("mongoose"); var backup_jobs = new mongoose_1.Schema({ bjob_name: { type: String, required: true, maxlength: 100, trim: true, unique: true }, bjob_backup_type: { type: String, required: true, enum: ['full', 'incremental', 'differential', 'file'], default: 'full' }, bjob_status: { type: String, required: true, enum: ['active', 'paused', 'disabled'], default: 'active' }, bjob_backup_policy_id: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "backup_policies", comment: "Reference to backup policy" }, bjob_description: { type: String, maxlength: 500, trim: true }, bjob_schedule_cron: { type: String, maxlength: 100, trim: true, comment: "Cron expression for backup schedule" }, bjob_last_run_at: { type: Date, comment: "Last backup execution time" }, bjob_next_run_at: { type: Date, comment: "Next scheduled backup execution time" }, bjob_total_runs: { type: Number, default: 0, min: 0, comment: "Total number of backup runs" }, bjob_successful_runs: { type: Number, default: 0, min: 0, comment: "Number of successful backup runs" }, bjob_failed_runs: { type: Number, default: 0, min: 0, comment: "Number of failed backup runs" }, bjob_created_by: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "auth_user_mst", comment: "User who created the backup job" }, bjob_created_at: { type: Date, default: Date.now }, bjob_updated_at: { type: Date, default: Date.now }, bjob_isactive: { type: Boolean, default: true } }, { collection: 'backup_jobs', timestamps: { createdAt: 'bjob_created_at', updatedAt: 'bjob_updated_at' } }); // Indexes // Note: bjob_name index is automatically created by unique: true backup_jobs.index({ bjob_status: 1 }); backup_jobs.index({ bjob_backup_type: 1 }); backup_jobs.index({ bjob_backup_policy_id: 1 }); backup_jobs.index({ bjob_isactive: 1 }); var CBackupJob = mongoose_1.default.model("backup_jobs", backup_jobs); exports.CBackupJob = CBackupJob;