67 lines
2.4 KiB
JavaScript
67 lines
2.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ApplicationData = void 0;
|
|
class ApplicationData {
|
|
id;
|
|
code;
|
|
name;
|
|
description;
|
|
icon;
|
|
url;
|
|
applicationsClaim;
|
|
isActive;
|
|
displayOrder;
|
|
createdAt;
|
|
updatedAt;
|
|
constructor(id, code, name, description, icon, url, applicationsClaim, isActive, displayOrder, createdAt, updatedAt) {
|
|
this.id = id;
|
|
this.code = code;
|
|
this.name = name;
|
|
this.description = description;
|
|
this.icon = icon;
|
|
this.url = url;
|
|
this.applicationsClaim = applicationsClaim;
|
|
this.isActive = isActive;
|
|
this.displayOrder = displayOrder;
|
|
this.createdAt = createdAt;
|
|
this.updatedAt = updatedAt;
|
|
}
|
|
static create(data) {
|
|
return new ApplicationData(crypto.randomUUID(), data.code, data.name, data.description ?? null, data.icon ?? null, data.url ?? null, data.applicationsClaim, true, data.displayOrder ?? 0, new Date(), new Date());
|
|
}
|
|
static restore(props) {
|
|
return new ApplicationData(props.id, props.code, props.name, props.description ?? null, props.icon ?? null, props.url ?? null, props.applicationsClaim, props.isActive !== undefined ? props.isActive : true, props.displayOrder ?? 0, props.createdAt ?? null, props.updatedAt ?? null);
|
|
}
|
|
update(data) {
|
|
if (data.code !== undefined)
|
|
this.code = data.code;
|
|
if (data.name !== undefined)
|
|
this.name = data.name;
|
|
if (data.description !== undefined)
|
|
this.description = data.description;
|
|
if (data.icon !== undefined)
|
|
this.icon = data.icon;
|
|
if (data.url !== undefined)
|
|
this.url = data.url;
|
|
if (data.applicationsClaim !== undefined)
|
|
this.applicationsClaim = data.applicationsClaim;
|
|
if (data.isActive !== undefined)
|
|
this.isActive = data.isActive;
|
|
if (data.displayOrder !== undefined)
|
|
this.displayOrder = data.displayOrder;
|
|
this.updatedAt = new Date();
|
|
}
|
|
toResponse() {
|
|
return {
|
|
id: this.id,
|
|
code: this.code,
|
|
name: this.name,
|
|
description: this.description,
|
|
icon: this.icon,
|
|
url: this.url,
|
|
displayOrder: this.displayOrder,
|
|
};
|
|
}
|
|
}
|
|
exports.ApplicationData = ApplicationData;
|
|
//# sourceMappingURL=application.entity.js.map
|