export class Store { public static fromJson (obj: any) { // TODO check if fields exist to get the error return new Store( obj.id, obj.userId, obj.tenantId, obj.name, obj.description, obj.web, obj.email, obj.notes, obj.imgUri, obj.markerUri, obj.coords, obj.address, obj.__v ); } public toJson() { let obj: any = {}; obj.id = this.getId(); obj.userId = this.getUserId(); obj.tenantId = this.getTenantId(); obj.name = this.getName(); obj.description = this.getDescription(); obj.web = this.getWeb(); obj.email = this.getEmail(); obj.notes = this.getNotes(); obj.imgUri = this.getImgUri(); obj.markerUri = this.getMarkerUri(); obj.coords = this.getCoords(); obj.address = this.getAddress(); obj.__v = this.__v ? this.__v : ''; return obj; } // turn to private constructor( public id: string , public userId: string , public tenantId: string , public name: string , public description: string , public web: string , public email: string , public notes: string , public imgUri: string , public markerUri: string // , public created: string // class coords? , public coords: any // class address ?? , public address: any , public __v? : string ) {} getId() { return this.id; } getUserId() { return this.userId; } getTenantId() { return this.tenantId; } getName() { return this.name; } getDescription() { return this.description; } getWeb() { return this.web; } getEmail() { return this.email; } getNotes() { return this.notes; } getMarkerUri() { return this.markerUri; } getImgUri() { return this.imgUri; } getCoords() { return this.coords; } getAddress() { return this.address; } }