UNPKG

cloud-ide-model-schema

Version:

Pachage for schema management of Cloud IDEsys LMS

86 lines (85 loc) 1.96 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CWebhook = void 0; var mongoose_1 = require("mongoose"); var webhooks = new mongoose_1.Schema({ whk_webhook_url: { type: String, required: true, maxlength: 500, trim: true }, whk_event_type: { type: String, required: true, maxlength: 100 }, whk_secret: { type: String, maxlength: 500 }, whk_http_method: { type: String, required: true, enum: ['POST', 'PUT', 'PATCH'], default: 'POST' }, whk_headers: { type: Object }, whk_status: { type: String, required: true, enum: ['active', 'inactive', 'failed'], default: 'active' }, whk_last_triggered: { type: Date }, whk_success_count: { type: Number, default: 0, min: 0 }, whk_failure_count: { type: Number, default: 0, min: 0 }, whk_retry_on_failure: { type: Boolean, default: true }, whk_max_retries: { type: Number, default: 3, min: 0 }, whk_timeout: { type: Number, default: 30000, // 30 seconds min: 1000 }, whk_created_by: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "auth_user_mst" }, whk_created_at: { type: Date, default: Date.now }, whk_updated_at: { type: Date, default: Date.now }, whk_isactive: { type: Boolean, default: true } }, { collection: 'webhooks', timestamps: { createdAt: 'whk_created_at', updatedAt: 'whk_updated_at' } }); // Indexes webhooks.index({ whk_webhook_url: 1 }); webhooks.index({ whk_event_type: 1 }); webhooks.index({ whk_status: 1 }); var CWebhook = mongoose_1.default.model("webhooks", webhooks); exports.CWebhook = CWebhook;