@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
184 lines (178 loc) • 4.04 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
import {Asset} from './Asset';
import {Sensor} from './Sensor';
import {Dataset} from './Dataset';
import {SummaryForAsset} from './SummaryForAsset';
declare var Object: any;
export interface SummaryInterface {
id?: string;
type: string;
from: Date;
to: Date;
length: number;
detail: any;
updated: boolean;
created?: Date;
modified?: Date;
deleted?: Date;
assetId?: any;
sensorId?: any;
summaryForAssetId?: string;
trackingLogs?: Log[];
asset?: Asset;
sensor?: Sensor;
datasets?: Dataset[];
summaryForAsset?: SummaryForAsset;
}
export class Summary implements SummaryInterface {
id: string;
type: string;
from: Date;
to: Date;
length: number;
detail: any;
updated: boolean;
created: Date;
modified: Date;
deleted: Date;
assetId: any;
sensorId: any;
summaryForAssetId: string;
trackingLogs?: Log[];
asset?: Asset;
sensor?: Sensor;
datasets?: Dataset[];
summaryForAsset?: SummaryForAsset;
constructor(data?: SummaryInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `Summary`.
*/
public static getModelName(): string {
return 'Summary';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of Summary for dynamic purposes.
*/
public static factory(data: SummaryInterface): Summary{
return new Summary(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: 'Summary',
plural: 'Summaries',
path: 'Summaries',
idName: 'id',
properties: {
id: {
name: 'id',
type: 'string'
},
type: {
name: 'type',
type: 'string'
},
from: {
name: 'from',
type: 'Date'
},
to: {
name: 'to',
type: 'Date'
},
length: {
name: 'length',
type: 'number'
},
detail: {
name: 'detail',
type: 'any'
},
updated: {
name: 'updated',
type: 'boolean'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
assetId: {
name: 'assetId',
type: 'any'
},
sensorId: {
name: 'sensorId',
type: 'any'
},
summaryForAssetId: {
name: 'summaryForAssetId',
type: 'string'
},
},
relations: {
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
asset: {
name: 'asset',
type: 'Asset',
model: 'Asset',
relationType: 'belongsTo',
keyFrom: 'assetId',
keyTo: 'id'
},
sensor: {
name: 'sensor',
type: 'Sensor',
model: 'Sensor',
relationType: 'belongsTo',
keyFrom: 'sensorId',
keyTo: 'id'
},
datasets: {
name: 'datasets',
type: 'Dataset[]',
model: 'Dataset',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'summaryId'
},
summaryForAsset: {
name: 'summaryForAsset',
type: 'SummaryForAsset',
model: 'SummaryForAsset',
relationType: 'belongsTo',
keyFrom: 'summaryForAssetId',
keyTo: 'id'
},
}
};
}
}