From ae3d83eb5c81d2a178bf9e2ca7e1e52dbecc6565 Mon Sep 17 00:00:00 2001 From: Mathieu Marchois Date: Fri, 5 Mar 2021 16:12:58 +0100 Subject: [PATCH] Remove leave request --- client/i18n/fr.json | 1 + client/src/components/links/DeleteLink.svelte | 21 +++++ .../leaves/requests/_Table.svelte | 13 ++- .../leaves/requests/index.svelte | 15 ++- .../Command/DeleteLeaveRequestCommand.ts | 9 ++ .../DeleteLeaveRequestCommandHandler.spec.ts | 94 +++++++++++++++++++ .../DeleteLeaveRequestCommandHandler.ts | 33 +++++++ .../LeaveRequestCantBeRemovedException.ts | 5 + .../Repository/ILeaveRequestRepository.ts | 1 + .../CanLeaveRequestBeRemoved.spec.ts | 41 ++++++++ .../Specification/CanLeaveRequestBeRemoved.ts | 8 ++ .../Leave/Action/DeleteLeaveRequestAction.ts | 39 ++++++++ .../Repository/LeaveRequestRepository.ts | 4 + .../HumanResource/humanResource.module.ts | 8 +- 14 files changed, 288 insertions(+), 4 deletions(-) create mode 100644 client/src/components/links/DeleteLink.svelte create mode 100644 server/src/Application/HumanResource/Leave/Command/DeleteLeaveRequestCommand.ts create mode 100644 server/src/Application/HumanResource/Leave/Command/DeleteLeaveRequestCommandHandler.spec.ts create mode 100644 server/src/Application/HumanResource/Leave/Command/DeleteLeaveRequestCommandHandler.ts create mode 100644 server/src/Domain/HumanResource/Leave/Exception/LeaveRequestCantBeRemovedException.ts create mode 100644 server/src/Domain/HumanResource/Leave/Specification/CanLeaveRequestBeRemoved.spec.ts create mode 100644 server/src/Domain/HumanResource/Leave/Specification/CanLeaveRequestBeRemoved.ts create mode 100644 server/src/Infrastructure/HumanResource/Leave/Action/DeleteLeaveRequestAction.ts diff --git a/client/i18n/fr.json b/client/i18n/fr.json index 42cbd401..49812193 100644 --- a/client/i18n/fr.json +++ b/client/i18n/fr.json @@ -261,6 +261,7 @@ "moderate_by": "Modéré par", "end_date": "Date de fin", "start_date": "Date de début", + "confirm": "Etes-vous sûr de vouloir supprimer cette demande de congé ?", "add": { "title": "Faire une demande de congé" }, diff --git a/client/src/components/links/DeleteLink.svelte b/client/src/components/links/DeleteLink.svelte new file mode 100644 index 00000000..ab4b0494 --- /dev/null +++ b/client/src/components/links/DeleteLink.svelte @@ -0,0 +1,21 @@ + + + diff --git a/client/src/routes/human_resources/leaves/requests/_Table.svelte b/client/src/routes/human_resources/leaves/requests/_Table.svelte index 2f7807eb..7bdf4b11 100644 --- a/client/src/routes/human_resources/leaves/requests/_Table.svelte +++ b/client/src/routes/human_resources/leaves/requests/_Table.svelte @@ -1,16 +1,22 @@ @@ -53,6 +59,11 @@ diff --git a/client/src/routes/human_resources/leaves/requests/index.svelte b/client/src/routes/human_resources/leaves/requests/index.svelte index 7a0d3926..43398120 100644 --- a/client/src/routes/human_resources/leaves/requests/index.svelte +++ b/client/src/routes/human_resources/leaves/requests/index.svelte @@ -9,7 +9,7 @@
+ {#if $session.user && $session.user.id === user.id} + dispatch('delete', id)} + confirmMessage={$_("human_resources.leaves.requests.confirm")} /> + {/if}