export class Transaction { public static fromJson (obj: any) { return new Transaction( obj.id, obj.amount, obj.desc, obj.notes, obj.created, obj.type, obj.currency); } public toJson() { let transaction: any = {} transaction.id = this.id; transaction.amount = this.amount; transaction.desc = this.desc; transaction.created = this.created; transaction.notes = this.notes; transaction.type = this.type; transaction.currency = this.currency; return transaction; } constructor( // TODO have a unique itemId for each AccountItem private id : string, private amount: number, private desc: string, private notes: string, private created: string, private type: string, private currency: string ) { } // updateItemQuantity(updatedQuantity: number) { // this.quantity = updatedQuantity; // this.cost = this.product.getPrice() * this.quantity; // } getId() { return this.id; } getCost() { return this.amount; } getDescription() { return this.desc; } /* amount:undefined created:2017-05-06T14:01:13.021Z desc:undefined notes:undefined type:undefined userId:"57b5317988f36daa64d5dfdf" */ }