@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
138 lines (132 loc) • 2.95 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
import {Project} from './Project';
declare var Object: any;
export interface BIPanelInterface {
name: string;
description?: string;
chart?: any;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
_series?: Array<any>;
projectId?: any;
series?: any[];
trackingLogs?: Log[];
project?: Project;
}
export class BIPanel implements BIPanelInterface {
name: string;
description: string;
chart: any;
created: Date;
modified: Date;
deleted: Date;
id: any;
_series: Array<any> = [];
projectId: any;
series?: any[];
trackingLogs?: Log[];
project?: Project;
constructor(data?: BIPanelInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `BIPanel`.
*/
public static getModelName(): string {
return 'BIPanel';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of BIPanel for dynamic purposes.
*/
public static factory(data: BIPanelInterface): BIPanel{
return new BIPanel(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: 'BIPanel',
plural: 'BIPanels',
path: 'BIPanels',
idName: 'id',
properties: {
name: {
name: 'name',
type: 'string'
},
description: {
name: 'description',
type: 'string'
},
chart: {
name: 'chart',
type: 'any'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
id: {
name: 'id',
type: 'any'
},
_series: {
name: '_series',
type: 'Array<any>',
default: []
},
projectId: {
name: 'projectId',
type: 'any'
},
},
relations: {
series: {
name: 'series',
type: 'any[]',
model: '',
relationType: 'embedsMany',
keyFrom: '_series',
keyTo: 'id'
},
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
project: {
name: 'project',
type: 'Project',
model: 'Project',
relationType: 'belongsTo',
keyFrom: 'projectId',
keyTo: 'id'
},
}
};
}
}