UNPKG

@coko/server

Version:

Reusable server for use by Coko's projects

67 lines 1.94 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const base_model_1 = __importDefault(require("../base.model")); const user_model_1 = __importDefault(require("../user/user.model")); const types_1 = require("../_helpers/types"); const affectedObject = { type: 'object', additionalProperties: false, required: ['id', 'objectType'], properties: { id: types_1.id, objectType: types_1.stringNotEmpty, }, }; const affectedObjects = { type: 'array', default: [], items: affectedObject, }; class ActivityLog extends base_model_1.default { actorId; actionType; message; valueBefore; valueAfter; affectedObjects; additionalData; constructor() { super(); this.type = 'activityLog'; } static get tableName() { return 'activityLogs'; } static get schema() { return { type: 'object', required: ['actorId', 'actionType'], properties: { actorId: types_1.id, actionType: types_1.stringNotEmpty, message: types_1.stringNullable, valueBefore: types_1.objectNullable, valueAfter: types_1.objectNullable, affectedObjects, additionalData: types_1.object, }, }; } static get relationMappings() { return { user: { relation: base_model_1.default.BelongsToOneRelation, modelClass: user_model_1.default, join: { from: 'activityLogs.actorId', to: 'users.id', }, }, }; } } exports.default = ActivityLog; //# sourceMappingURL=activityLog.model.js.map