@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
157 lines (151 loc) • 3.33 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
import {Project} from './Project';
import {GeoPoint} from './BaseModels';
declare var Object: any;
export interface GisInterface {
name?: string;
center?: GeoPoint;
zoom?: number;
type: string;
mapType?: string;
created?: Date;
modified?: Date;
deleted?: Date;
id?: any;
projectId?: any;
container?: any;
layers?: any[];
trackingLogs?: Log[];
project?: Project;
}
export class Gis implements GisInterface {
name: string;
center: GeoPoint;
zoom: number = 13;
type: string = 'GENERIC';
mapType: string = 'ROADMAP';
created: Date;
modified: Date;
deleted: Date;
id: any;
projectId: any;
container?: any;
layers?: any[];
trackingLogs?: Log[];
project?: Project;
constructor(data?: GisInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `Gis`.
*/
public static getModelName(): string {
return 'Gis';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of Gis for dynamic purposes.
*/
public static factory(data: GisInterface): Gis{
return new Gis(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: 'Gis',
plural: 'Gis',
path: 'Gis',
idName: 'id',
properties: {
name: {
name: 'name',
type: 'string'
},
center: {
name: 'center',
type: 'GeoPoint'
},
zoom: {
name: 'zoom',
type: 'number',
default: 13
},
type: {
name: 'type',
type: 'string',
default: 'GENERIC'
},
mapType: {
name: 'mapType',
type: 'string',
default: 'ROADMAP'
},
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'
},
},
relations: {
container: {
name: 'container',
type: 'any',
model: '',
relationType: 'hasOne',
keyFrom: 'id',
keyTo: 'gisId'
},
layers: {
name: 'layers',
type: 'any[]',
model: '',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'gisId'
},
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'
},
}
};
}
}