@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
117 lines (111 loc) • 2.49 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
import {Manager} from './Manager';
declare var Object: any;
export interface ViewInterface {
name: string;
description?: string;
module: string;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
trackingLogs?: Log[];
managers?: Manager[];
}
export class View implements ViewInterface {
name: string;
description: string;
module: string;
created: Date;
modified: Date;
deleted: Date;
id: any;
trackingLogs?: Log[];
managers?: Manager[];
constructor(data?: ViewInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `View`.
*/
public static getModelName(): string {
return 'View';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of View for dynamic purposes.
*/
public static factory(data: ViewInterface): View{
return new View(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: 'View',
plural: 'Views',
path: 'Views',
idName: 'id',
properties: {
name: {
name: 'name',
type: 'string'
},
description: {
name: 'description',
type: 'string'
},
module: {
name: 'module',
type: 'string'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
id: {
name: 'id',
type: 'any'
},
},
relations: {
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
managers: {
name: 'managers',
type: 'Manager[]',
model: 'Manager',
relationType: 'hasMany',
modelThrough: 'ManagerView',
keyThrough: 'managerId',
keyFrom: 'id',
keyTo: 'viewId'
},
}
};
}
}