@xompass/sdk-cloud-api
Version:
Xompass Client for cloud-api
120 lines (114 loc) • 2.67 kB
text/typescript
import {ModelDefinition} from './BaseModels';
import {Log} from './Log';
declare var Object: any;
export interface DeviceEventCommentInterface {
id?: string;
content: string;
edited?: boolean;
created?: Date;
modified?: Date;
deleted?: Date;
userId?: string;
principalType?: string;
user?: any;
trackingLogs?: Log[];
}
export class DeviceEventComment implements DeviceEventCommentInterface {
id: string;
content: string;
edited: boolean;
created: Date;
modified: Date;
deleted: Date;
userId: string;
principalType: string;
user?: any;
trackingLogs?: Log[];
constructor(data?: DeviceEventCommentInterface) {
Object.assign(this, data);
}
/**
* The name of the model represented by this $resource,
* i.e. `DeviceEventComment`.
*/
public static getModelName(): string {
return 'DeviceEventComment';
}
/**
* @method factory
* @author Jonathan Casarrubias
* @license MIT
* This method creates an instance of DeviceEventComment for dynamic purposes.
*/
public static factory(data: DeviceEventCommentInterface): DeviceEventComment{
return new DeviceEventComment(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: 'DeviceEventComment',
plural: 'DeviceEventComments',
path: 'DeviceEventComments',
idName: 'id',
properties: {
id: {
name: 'id',
type: 'string'
},
content: {
name: 'content',
type: 'string'
},
edited: {
name: 'edited',
type: 'boolean'
},
created: {
name: 'created',
type: 'Date'
},
modified: {
name: 'modified',
type: 'Date'
},
deleted: {
name: 'deleted',
type: 'Date',
default: undefined
},
userId: {
name: 'userId',
type: 'string'
},
principalType: {
name: 'principalType',
type: 'string'
},
},
relations: {
user: {
name: 'user',
type: 'any',
model: '',
relationType: 'belongsTo',
keyFrom: 'userId',
keyTo: 'id'
},
trackingLogs: {
name: 'trackingLogs',
type: 'Log[]',
model: 'Log',
relationType: 'hasMany',
keyFrom: 'id',
keyTo: 'trackingModelId'
},
}
};
}
}