@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
109 lines (103 loc) • 2.53 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Asset} from './Asset';
import {Log} from './Log';
declare var Object: any;
export interface AssetRestrictionTableInterface {
maxSensorsPerAsset?: number;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
assetId?: any;
asset?: Asset;
trackingLogs?: Log[];
}
export class AssetRestrictionTable implements AssetRestrictionTableInterface {
maxSensorsPerAsset: number;
created: Date;
modified: Date;
deleted: Date;
id: any;
assetId: any;
asset?: Asset;
trackingLogs?: Log[];
constructor(data?: AssetRestrictionTableInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `AssetRestrictionTable`.
*/
public static getModelName(): string {
return 'AssetRestrictionTable';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of AssetRestrictionTable for dynamic purposes.
*/
public static factory(data: AssetRestrictionTableInterface): AssetRestrictionTable{
return new AssetRestrictionTable(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: 'AssetRestrictionTable',
plural: 'AssetRestrictionTables',
path: 'AssetRestrictionTables',
idName: 'id',
properties: {
maxSensorsPerAsset: {
name: 'maxSensorsPerAsset',
type: 'number'
},
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'
},
}
};
}
}