cloud-ide-lms-model
Version:
Package for Model management of Cloud IDEsys LMS
97 lines (96 loc) • 3.33 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MUserRoleToggleStatusPayload = exports.MUserRoleWithRightsPayload = exports.MUserRoleDeletePayload = exports.MUserRoleGetByIdPayload = exports.MUserRole = void 0;
const common_1 = require("../../common-types/common");
/* INTERFACE END */
/* MODEL START */
class MUserRole extends common_1.MTableQueries {
constructor(init) {
super(init);
this.syusrol_role_entity_id_syen = "";
Object.assign(this, init);
}
Validate() {
let errorLogger = {};
if (!this.syusrol_role_entity_id_syen) {
errorLogger.syusrol_role_entity_id_syen = "Entity ID is required!";
}
return errorLogger;
}
}
exports.MUserRole = MUserRole;
class MUserRoleGetByIdPayload {
constructor(init) {
Object.assign(this, init);
}
Validate() {
let errorLogger = {};
if (!this.syusrol_id) {
errorLogger.syusrol_id = "User Role ID is Required!";
}
return errorLogger;
}
}
exports.MUserRoleGetByIdPayload = MUserRoleGetByIdPayload;
class MUserRoleDeletePayload {
constructor(init) {
Object.assign(this, init);
}
Validate() {
let errorLogger = {};
if (!this.syusrol_id) {
errorLogger.syusrol_id = "User Role ID is Required!";
}
return errorLogger;
}
}
exports.MUserRoleDeletePayload = MUserRoleDeletePayload;
class MUserRoleToggleStatusPayload {
constructor(init) {
Object.assign(this, init);
}
Validate() {
let errorLogger = {};
if (!this.syusrol_id) {
errorLogger.syusrol_id = "User Role ID is Required!";
}
return errorLogger;
}
}
exports.MUserRoleToggleStatusPayload = MUserRoleToggleStatusPayload;
class MUserRoleWithRightsPayload {
constructor(init) {
Object.assign(this, init);
}
Validate() {
let errorLogger = {};
// Validate Core User Role
if (!this.core_user_role) {
errorLogger.core_user_role = "Role information is required!";
}
else {
if (!this.core_user_role.syusrol_role_name) {
errorLogger.core_user_role = "Role name is required!";
}
if (!this.core_user_role.syusrol_role_description) {
errorLogger.core_user_role = "Role description is required!";
}
if (!this.core_user_role.syusrol_role_entity_id_syen) {
errorLogger.core_user_role = "Entity ID is required!";
}
}
// Validate Core User Role Rights
if (this.core_user_role_rights && this.core_user_role_rights.length > 0) {
this.core_user_role_rights.forEach((right, index) => {
if (!right.syusrgt_menu_id_syme) {
errorLogger[`core_user_role_rights[${index}].syusrgt_menu_id_syme`] = "Menu ID is required!";
}
if (!right.syusrgt_role_permissions_id_sygms) {
errorLogger[`core_user_role_rights[${index}].syusrgt_role_permissions_id_sygms`] = "Permission ID is required!";
}
});
}
return errorLogger;
}
}
exports.MUserRoleWithRightsPayload = MUserRoleWithRightsPayload;