UNPKG

cloud-ide-model-schema

Version:

Pachage for schema management of Cloud IDEsys LMS

77 lines (76 loc) 1.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CSubscription = void 0; var mongoose_1 = require("mongoose"); var subscriptions = new mongoose_1.Schema({ subs_entity_id: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "core_system_entity" }, subs_plan_id: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "subscription_plans", required: true }, subs_status: { type: String, required: true, enum: ['active', 'cancelled', 'expired', 'suspended', 'trial'], default: 'trial' }, subs_start_date: { type: Date, required: true, default: Date.now }, subs_end_date: { type: Date }, subs_trial_start_date: { type: Date }, subs_trial_end_date: { type: Date }, subs_auto_renew: { type: Boolean, default: true }, subs_next_billing_date: { type: Date }, subs_cancelled_at: { type: Date }, subs_cancellation_reason: { type: String, maxlength: 500 }, subs_payment_method: { type: String, maxlength: 50 }, subs_created_by: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "auth_user_mst" }, subs_created_at: { type: Date, default: Date.now }, subs_updated_at: { type: Date, default: Date.now }, subs_isactive: { type: Boolean, default: true } }, { collection: 'subscriptions', timestamps: { createdAt: 'subs_created_at', updatedAt: 'subs_updated_at' } }); // Indexes subscriptions.index({ subs_entity_id: 1 }); subscriptions.index({ subs_plan_id: 1 }); subscriptions.index({ subs_status: 1 }); subscriptions.index({ subs_end_date: 1 }); var CSubscription = mongoose_1.default.model("subscriptions", subscriptions); exports.CSubscription = CSubscription;