UNPKG

cloud-ide-model-schema

Version:

Pachage for schema management of Cloud IDEsys LMS

94 lines (93 loc) 4.1 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.CCoreSytm = void 0; var mongoose_1 = require("mongoose"); // Mongose Type for ICoreSytmLayout (sytm_layout) var CCoreSytmLayout = /** @class */ (function (_super) { __extends(CCoreSytmLayout, _super); function CCoreSytmLayout(key, options) { return _super.call(this, key, options, "CCoreSytmLayout") || this; } CCoreSytmLayout.prototype.cast = function (val) { var _a, _b, _c, _d, _e; if (typeof val !== 'object') { throw new Error('Invalid value for sytm_layout'); } if (val.hasOwnProperty('sytm_layout_sidebar') && typeof ((_a = val === null || val === void 0 ? void 0 : val.sytm_layout_sidebar) === null || _a === void 0 ? void 0 : _a.status) !== 'boolean') { throw new Error('Invalid value for sytm_layout_sidebar.status'); } if (val.hasOwnProperty('sytm_layout_header') && typeof ((_b = val === null || val === void 0 ? void 0 : val.sytm_layout_header) === null || _b === void 0 ? void 0 : _b.status) !== 'boolean') { throw new Error('Invalid value for sytm_layout_header.status'); } if (val.hasOwnProperty('sytm_layout_footer') && typeof ((_c = val === null || val === void 0 ? void 0 : val.sytm_layout_footer) === null || _c === void 0 ? void 0 : _c.status) !== 'boolean') { throw new Error('Invalid value for sytm_layout_footer.status'); } if (val.hasOwnProperty('sytm_layout_breadcrumb') && typeof ((_d = val === null || val === void 0 ? void 0 : val.sytm_layout_breadcrumb) === null || _d === void 0 ? void 0 : _d.status) !== 'boolean') { throw new Error('Invalid value for sytm_layout_breadcrumb.status'); } if (val.hasOwnProperty('sytm_layout_console') && typeof ((_e = val === null || val === void 0 ? void 0 : val.sytm_layout_console) === null || _e === void 0 ? void 0 : _e.status) !== 'boolean') { throw new Error('Invalid value for sytm_layout_console.status'); } return val; }; return CCoreSytmLayout; }(mongoose_1.default.SchemaType)); // @ts-ignore: We need to ignore this because TypeScript doesn't know about custom types beforehand. mongoose_1.default.Schema.Types.CCoreSytmLayout = CCoreSytmLayout; /* SCHEMA START */ var core_system_pages_theme = new mongoose_1.Schema({ sytm_preview_id_fm: { type: mongoose_1.default.Schema.Types.ObjectId, required: false }, sytm_page_id_sypg: { type: mongoose_1.default.Schema.Types.ObjectId, required: true }, sytm_theme_code: { type: String, minlength: 8, maxlength: 40, unique: true, trim: true }, sytm_title: { type: String, minlength: 8, maxlength: 100, trim: true }, sytm_desc: { type: String, minlength: 8, maxlength: 255, trim: true }, sytm_configuration: { type: Object }, sytm_layout: { type: CCoreSytmLayout }, sytm_isactive: { type: Boolean, default: true } }, { collection: 'core_system_pages_theme' }); var CCoreSytm = mongoose_1.default.model("core_system_pages_theme", core_system_pages_theme); exports.CCoreSytm = CCoreSytm;