cloud-ide-model-schema
Version:
Pachage for schema management of Cloud IDEsys LMS
51 lines (50 loc) • 1.86 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MTableQueries = void 0;
var MTableQueries = /** @class */ (function () {
function MTableQueries(init) {
this.total = 1;
this.pageIndex = 1;
this.pageSize = 10;
this.query = "";
this.sort = {
order: "",
key: ""
};
Object.assign(this, init);
}
MTableQueries.prototype.Validate = function () {
var _a, _b, _c, _d, _e;
var errorLogger = {};
if (this.sort) {
if (((_a = this.sort) === null || _a === void 0 ? void 0 : _a.order) != 'asc' && ((_b = this.sort) === null || _b === void 0 ? void 0 : _b.order) != 'desc' && ((_c = this.sort) === null || _c === void 0 ? void 0 : _c.order) != '') {
errorLogger.sort = "Incorect Sort order!";
}
if (typeof ((_d = this.sort) === null || _d === void 0 ? void 0 : _d.key) != 'string' && typeof ((_e = this.sort) === null || _e === void 0 ? void 0 : _e.key) != 'number') {
errorLogger.sort = "Incorect Sort key!";
}
}
else {
errorLogger.sort = "Sort order and key is required!";
}
if (typeof (this.pageIndex) == 'number') {
if (this.pageIndex < 1) {
errorLogger.pageIndex = "Incorect Page Index!";
}
}
else {
errorLogger.pageIndex = "Page index is required";
}
if (typeof (this.pageSize) == 'number') {
if (this.pageSize < 1) {
errorLogger.pageSize = "Incorect Page Size!";
}
}
else {
errorLogger.pageSize = "Page Size is required";
}
return errorLogger;
};
return MTableQueries;
}());
exports.MTableQueries = MTableQueries;