/** * BasicModel for Activerecord ORM */ export abstract class BaseModel { id: string | number | undefined; /** * Is Model already saved * @return {boolean} */ public get persisted() : boolean { return !!this.id && this.id > 0; } /** * Is the model already persisted? * @param {BaseModel} model * @return {boolean} */ public static isPersisted(model: BaseModel) : boolean { return !!model.id && model.id > 0; } /** * Getting the Endpoint Adress * @return {string} */ public static get endpoint(): string { let name:string = this.prototype.constructor.name; name = name.toLowerCase(); return name; } }