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); }); });