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