import { Injectable } from "@angular/core"; import { Api } from "./api"; import { Observable } from "rxjs"; import { IRslt, Selling } from "../../public-api"; @Injectable({ providedIn: 'root' }) export class SellService { get route() { return this.api.base + 'sell' } constructor(private api: Api) { } setToken(token:string){ this.api.token = token; } get(id:string): Observable> { return this.api.get(this.route + '/product/' + id) } getByProduct(id:string): Observable> { return this.api.get(this.route + '/product/' + id) } getByProducts(ids:string[]): Observable> { return this.api.post(this.route + '/product',ids) } // getByID(id: string): Observable> { // return this.api.get(this.route + id) // } post(sell: Selling): Observable> { return this.api.post(this.route, sell) } put(sell: Selling): Observable> { return this.api.put(this.route, sell) } delete(sell: Selling): Observable> { return this.api.delete(this.route + '/' + sell._id); } }