UNPKG

idea-toolbox

Version:
33 lines (32 loc) 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RCAttachedResource = void 0; const resource_model_1 = require("./resource.model"); /** * A Resource Center's resource attached to other Objects. */ class RCAttachedResource extends resource_model_1.Resource { load(x) { super.load(x); this.resourceId = this.clean(x.resourceId, String); this.folderId = this.clean(x.folderId, String); this.name = this.clean(x.name, String); this.originalName = this.clean(x.originalName, String, this.name); this.format = this.clean(x.format, String); this.version = this.clean(x.version, a => new Date(a).getTime(), Date.now()); } safeLoad(newData, safeData) { super.safeLoad(newData, safeData); this.resourceId = safeData.resourceId; this.folderId = safeData.folderId; this.originalName = safeData.originalName; this.format = safeData.format; } validate() { const e = super.validate(); if (this.iE(this.name)) e.push('name'); return e; } } exports.RCAttachedResource = RCAttachedResource;