From b1e14996a3f3e8d25af290baa84dbb49eb8a0889 Mon Sep 17 00:00:00 2001 From: Adrian Andersen Date: Fri, 14 Jun 2024 22:24:21 +0200 Subject: [PATCH] feat(match-service): basic service with locking --- package.json | 2 +- public_api.ts | 2 +- src/app/bl-connect/bl-connect.module.ts | 2 +- .../document-services/match/match.service.ts | 17 ----------- src/app/matches/match.service.ts | 30 +++++++++++++++++++ 5 files changed, 33 insertions(+), 20 deletions(-) delete mode 100644 src/app/document-services/match/match.service.ts create mode 100644 src/app/matches/match.service.ts diff --git a/package.json b/package.json index 5b50f55..64496c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@boklisten/bl-connect", - "version": "0.19.21", + "version": "0.20.4", "license": "MIT", "scripts": { "dev": "yarn serve", diff --git a/public_api.ts b/public_api.ts index ff3401f..e247ce7 100644 --- a/public_api.ts +++ b/public_api.ts @@ -28,7 +28,7 @@ export * from "./src/app/document-services/user-detail/user-detail.service"; export * from "./src/app/document-services/company/company.service"; -export * from "./src/app/document-services/match/match.service"; +export * from "./src/app/matches/match.service"; export * from "./src/app/document-services/unique-item/unique-item.service"; diff --git a/src/app/bl-connect/bl-connect.module.ts b/src/app/bl-connect/bl-connect.module.ts index e679bbc..75b6b6c 100644 --- a/src/app/bl-connect/bl-connect.module.ts +++ b/src/app/bl-connect/bl-connect.module.ts @@ -32,10 +32,10 @@ import { OrderPdfService } from "../order-pdf/order-pdf.service"; import { MessageService } from "../document-services/message/message.service"; import { InvoiceService } from "../document-services/invoice/invoice.service"; import { CompanyService } from "../document-services/company/company.service"; -import { MatchService } from "../document-services/match/match.service"; import { BookingService } from "../document-services/booking/booking.service"; import { UniqueItemService } from "../document-services/unique-item/unique-item.service"; import { SignatureService } from "../document-services/signature/signature.service"; +import { MatchService } from "../matches/match.service"; export function tokenGetter() { return localStorage.getItem(BL_CONFIG.token.accessToken); diff --git a/src/app/document-services/match/match.service.ts b/src/app/document-services/match/match.service.ts deleted file mode 100644 index c23e53f..0000000 --- a/src/app/document-services/match/match.service.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Injectable } from "@angular/core"; -import { Match } from "@boklisten/bl-model"; -import { ApiService } from "../../api/api.service"; -import { BL_CONFIG } from "../../bl-connect/bl-config"; -import { - CachedDocumentService, - CachedDocumentServiceOptions, -} from "../../document/cached-document.service"; -import { BlDocumentService } from "../../document/bl-document.service"; - -@Injectable() -export class MatchService extends BlDocumentService { - constructor(private cachedDocumentService: CachedDocumentService) { - super(cachedDocumentService); - this.setCollection(BL_CONFIG.collection.match); - } -} diff --git a/src/app/matches/match.service.ts b/src/app/matches/match.service.ts new file mode 100644 index 0000000..513281f --- /dev/null +++ b/src/app/matches/match.service.ts @@ -0,0 +1,30 @@ +import { Injectable } from "@angular/core"; +import { ApiService } from "../api/api.service"; +import { BL_CONFIG } from "../bl-connect/bl-config"; +import { ApiResponse } from "../api/api-response"; +import { BlDocumentService } from "../document/bl-document.service"; +import { Match } from "@boklisten/bl-model"; +import { CachedDocumentService } from "../document/cached-document.service"; + +@Injectable({ + providedIn: "root", +}) +export class MatchService extends BlDocumentService { + constructor( + private cachedDocumentService: CachedDocumentService, + private _apiService: ApiService + ) { + super(cachedDocumentService); + this.setCollection(BL_CONFIG.collection.match); + } + + public updateLocksForCustomer( + customer: string, + lock: boolean + ): Promise { + return this._apiService.add(BL_CONFIG.collection.match + "/lock", { + customer, + lock, + }); + } +}