UNPKG

@becomes/cms

Version:

Simple CMS for building APIs.

120 lines 4.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Key = exports.KeyMethod = void 0; var mongoose_1 = require("mongoose"); var KeyMethod; (function (KeyMethod) { KeyMethod["GET_ALL"] = "GET_ALL"; KeyMethod["POST"] = "POST"; KeyMethod["PUT"] = "PUT"; KeyMethod["GET"] = "GET"; KeyMethod["DELETE"] = "DELETE"; })(KeyMethod = exports.KeyMethod || (exports.KeyMethod = {})); var Key = (function () { function Key(_id, createdAt, updatedAt, userId, name, desc, blocked, secret, access) { this._id = _id; this.createdAt = createdAt; this.updatedAt = updatedAt; this.userId = userId; this.name = name; this.desc = desc; this.blocked = blocked; this.secret = secret; this.access = access; } Object.defineProperty(Key, "schema", { get: function () { return new mongoose_1.Schema({ _id: mongoose_1.Types.ObjectId, createdAt: Number, updatedAt: Number, userId: String, name: String, desc: String, blocked: Object, secret: String, access: Object, }); }, enumerable: false, configurable: true }); Object.defineProperty(Key, "objectSchema", { get: function () { var keyMethodSchema = { __type: 'array', __required: true, __child: { __type: 'string', }, }; var keyAccessSchema = { __type: 'object', __required: true, __child: { global: { __type: 'object', __required: true, __child: { methods: keyMethodSchema, }, }, templates: { __type: 'array', __required: true, __child: { __type: 'object', __content: { _id: { __type: 'string', __required: true, }, methods: keyMethodSchema, entry: { __type: 'object', __required: true, __child: { methods: keyMethodSchema, }, }, }, }, }, functions: { __type: 'array', __required: true, __child: { __type: 'object', __content: { name: { __type: 'string', __required: true, }, }, }, }, }, }; return { name: { __type: 'string', __required: true, }, desc: { __type: 'string', __required: true, }, blocked: { __type: 'boolean', __required: true, }, access: keyAccessSchema, }; }, enumerable: false, configurable: true }); return Key; }()); exports.Key = Key; //# sourceMappingURL=key.model.js.map