@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
121 lines (115 loc) • 2.69 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Asset} from './Asset';
import {Log} from './Log';
declare var Object: any;
export interface AssetMilestoneInterface {
creationDate?: Date;
firstSyncDate?: Date;
activationDate?: Date;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
assetId?: any;
asset?: Asset;
trackingLogs?: Log[];
}
export class AssetMilestone implements AssetMilestoneInterface {
creationDate: Date;
firstSyncDate: Date;
activationDate: Date;
created: Date;
modified: Date;
deleted: Date;
id: any;
assetId: any;
asset?: Asset;
trackingLogs?: Log[];
constructor(data?: AssetMilestoneInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `AssetMilestone`.
*/
public static getModelName(): string {
return 'AssetMilestone';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of AssetMilestone for dynamic purposes.
*/
public static factory(data: AssetMilestoneInterface): AssetMilestone{
return new AssetMilestone(data);
}
/**
* @method getModelDefinition
* @author Julien Ledun
* @license MIT
* This method returns an object that represents some of the model
* definitions.
*/
public static getModelDefinition(): ModelDefinition {
return {
name: 'AssetMilestone',
plural: 'AssetMilestones',
path: 'AssetMilestones',
idName: 'id',
properties: {
creationDate: {
name: 'creationDate',
type: 'Date'
},
firstSyncDate: {
name: 'firstSyncDate',
type: 'Date'
},
activationDate: {
name: 'activationDate',
type: 'Date'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
id: {
name: 'id',
type: 'any'
},
assetId: {
name: 'assetId',
type: 'any'
},
},
relations: {
asset: {
name: 'asset',
type: 'Asset',
model: 'Asset',
relationType: 'belongsTo',
keyFrom: 'assetId',
keyTo: 'id'
},
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
}
};
}
}