From dc0efe2b5bd8eb2c871cdd1985515a1b19aed825 Mon Sep 17 00:00:00 2001 From: Nicolas Hallaert <39910164+Rossb0b@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:25:34 +0100 Subject: [PATCH] Accounting folder operations (#219) * feat(/events/accountingFolder): delete operation * doc(/events/accountingFolder: delete operation * test(UT/utils/index): updated ut accountingFolder operation --- docs/events.md | 2 +- docs/json-schema/events/accountingFolder.md | 2 +- src/schema/events/accountingFolder.json | 11 +++++++++++ src/types/events.ts | 2 +- test/UT/utils/index.spec.ts | 6 +++--- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/events.md b/docs/events.md index 7ea965d9..a1d4284a 100644 --- a/docs/events.md +++ b/docs/events.md @@ -52,7 +52,7 @@ Event notifying the creation of a new Accounting Folder (a company). ```ts export type AccountingFolderOperation = Operation[ - keyof Pick + keyof Pick ]; export type AccountingFolderScope = Scope & Required>; diff --git a/docs/json-schema/events/accountingFolder.md b/docs/json-schema/events/accountingFolder.md index 98bb07da..2ce201ce 100644 --- a/docs/json-schema/events/accountingFolder.md +++ b/docs/json-schema/events/accountingFolder.md @@ -10,7 +10,7 @@ "operation": { "type": "string", "description": "Operation operated next to the event", - "enum": ["CREATE", "UPDATE"] + "enum": ["CREATE", "UPDATE", "DELETE"] }, "scope": { "type": "object", diff --git a/src/schema/events/accountingFolder.json b/src/schema/events/accountingFolder.json index 1ab42337..eecc5ad4 100644 --- a/src/schema/events/accountingFolder.json +++ b/src/schema/events/accountingFolder.json @@ -22,6 +22,17 @@ "required": ["id"], "additionalProperties": false }, + "delete": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^[0-9]+" + } + }, + "required": ["id"], + "additionalProperties": false + }, "scope": { "type": "object", "properties": { diff --git a/src/types/events.ts b/src/types/events.ts index b9496508..b6eb20d5 100644 --- a/src/types/events.ts +++ b/src/types/events.ts @@ -33,7 +33,7 @@ export interface Connector { } export type AccountingFolderOperation = Operation[ - keyof Pick + keyof Pick ]; export type AccountingFolderScope = Scope & Required>; diff --git a/test/UT/utils/index.spec.ts b/test/UT/utils/index.spec.ts index 5b7cd257..a96f13ea 100644 --- a/test/UT/utils/index.spec.ts +++ b/test/UT/utils/index.spec.ts @@ -36,14 +36,14 @@ describe("eventsValidationFn", () => { accountingFolder = eventsValidationFn.get("accountingFolder"); }); - test("accountingFolder should have a validation function for \"create\" & \"update\" & \"scope\"", () => { + test("accountingFolder should have a validation function for \"create\", \"update\", \"delete\", \"scope\"", () => { expect(accountingFolder.has("create")).toBe(true); expect(accountingFolder.has("update")).toBe(true); + expect(accountingFolder.has("delete")).toBe(true); expect(accountingFolder.has("scope")).toBe(true); }); - test("accountingFolder should not have a validation function for \"delete\", \"void\"", () => { - expect(accountingFolder.has("delete")).toBe(false); + test("accountingFolder should not have a validation function for \"void\"", () => { expect(accountingFolder.has("void")).toBe(false); }); });