@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
151 lines (145 loc) • 3.67 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
import {Project} from './Project';
import {VirtualGroup} from './VirtualGroup';
import {VirtualVariable} from './VirtualVariable';
declare var Object: any;
export interface VirtualExpressionInterface {
name: string;
description?: string;
expression: string;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
projectId?: any;
virtualGroupId?: any;
trackingLogs?: Log[];
project?: Project;
virtualGroup?: VirtualGroup;
virtualVariables?: VirtualVariable[];
}
export class VirtualExpression implements VirtualExpressionInterface {
name: string;
description: string;
expression: string;
created: Date;
modified: Date;
deleted: Date;
id: any;
projectId: any;
virtualGroupId: any;
trackingLogs?: Log[];
project?: Project;
virtualGroup?: VirtualGroup;
virtualVariables?: VirtualVariable[];
constructor(data?: VirtualExpressionInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `VirtualExpression`.
*/
public static getModelName(): string {
return 'VirtualExpression';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of VirtualExpression for dynamic purposes.
*/
public static factory(data: VirtualExpressionInterface): VirtualExpression{
return new VirtualExpression(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: 'VirtualExpression',
plural: 'VirtualExpressions',
path: 'VirtualExpressions',
idName: 'id',
properties: {
name: {
name: 'name',
type: 'string'
},
description: {
name: 'description',
type: 'string'
},
expression: {
name: 'expression',
type: 'string'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
id: {
name: 'id',
type: 'any'
},
projectId: {
name: 'projectId',
type: 'any'
},
virtualGroupId: {
name: 'virtualGroupId',
type: 'any'
},
},
relations: {
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'
},
virtualGroup: {
name: 'virtualGroup',
type: 'VirtualGroup',
model: 'VirtualGroup',
relationType: 'belongsTo',
keyFrom: 'virtualGroupId',
keyTo: 'id'
},
virtualVariables: {
name: 'virtualVariables',
type: 'VirtualVariable[]',
model: 'VirtualVariable',
relationType: 'hasMany',
modelThrough: 'VirtualVariableVirtualExpression',
keyThrough: 'virtualVariableId',
keyFrom: 'id',
keyTo: 'virtualExpressionId'
},
}
};
}
}