import { Injectable } from "@angular/core"; import { Api } from "./api"; import { InventoryItem, Track } from "../../public-api"; @Injectable({ providedIn: 'root' }) export class InventoryService { get route() { return this.api.base + 'inventory' } constructor(private api: Api) { } getByID(id:string) { return this.api.get(this.route + '/unit/' + id) } getByIDs(ids: string[]) { return this.api.post(this.route + '/unit',ids) } post(item: InventoryItem) { return this.api.post(this.route, item) } postMany(items: InventoryItem[]) { return this.api.post(this.route + '/many', items) } put(item: InventoryItem) { return this.api.put(this.route, item) } clear(id:string) { return this.api.put(this.route + "/clear", id) } delete(id: string) { return this.api.delete(this.route + '/' + id); } }