From 7e55a336f244956941ab7069e894c6ebc1390da8 Mon Sep 17 00:00:00 2001 From: Denis Lugowski Date: Sat, 9 Aug 2025 10:09:00 +0200 Subject: [PATCH] feat(fullstack): Add notifications, user is now an entity, add testcontainers, rework custom permissions, get user from JWT in endpoints --- .run/local-server-backend-h2.run.xml | 2 +- .../api/legalconsenthub.yml | 303 ++++++++++++++++-- legalconsenthub-backend/build.gradle | 11 + .../application_form/ApplicationForm.kt | 20 +- .../application_form/ApplicationFormMapper.kt | 18 +- .../ApplicationFormService.kt | 58 +++- .../legalconsenthub/comment/Comment.kt | 10 +- .../legalconsenthub/comment/CommentMapper.kt | 6 +- .../legalconsenthub/config/SecurityConfig.kt | 3 + .../config/TestContainersConfig.kt | 40 +++ .../legalconsenthub/error/ExceptionHandler.kt | 18 +- .../error/UserAlreadyExistsException.kt | 3 + .../error/UserNotFoundException.kt | 3 + .../notification/Notification.kt | 52 +++ .../notification/NotificationController.kt | 102 ++++++ .../notification/NotificationMapper.kt | 38 +++ .../notification/NotificationRepository.kt | 47 +++ .../notification/NotificationService.kt | 87 +++++ .../notification/PagedNotificationMapper.kt | 25 ++ .../legalconsenthub/user/User.kt | 34 +- .../legalconsenthub/user/UserController.kt | 29 ++ .../legalconsenthub/user/UserMapper.kt | 4 + .../legalconsenthub/user/UserRepository.kt | 7 + .../legalconsenthub/user/UserService.kt | 46 +++ ...tion-local-h2.yaml => application-h2.yaml} | 0 .../resources/application-testcontainers.yaml | 35 ++ .../resources/db/migrations/001-schema.sql | 76 ++++- ....998Z.sql => 2025-08-07T06-04-32.922Z.sql} | 0 .../components/NotificationsSlideover.vue | 89 +++++ legalconsenthub/composables/index.ts | 4 + .../notification/useNotification.ts | 118 +++++++ .../notification/useNotificationApi.ts | 55 ++++ legalconsenthub/composables/useAuth.ts | 4 +- legalconsenthub/composables/usePermissions.ts | 12 +- legalconsenthub/composables/user/useUser.ts | 58 ++++ .../composables/user/useUserApi.ts | 39 +++ legalconsenthub/layouts/default.vue | 15 + legalconsenthub/package.json | 6 +- legalconsenthub/pages/index.vue | 22 +- legalconsenthub/pages/signup.vue | 24 +- legalconsenthub/pnpm-lock.yaml | 41 ++- legalconsenthub/server/utils/auth.ts | 44 ++- legalconsenthub/server/utils/permissions.ts | 100 ++++-- testdata.json | 2 - 44 files changed, 1571 insertions(+), 139 deletions(-) create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/config/TestContainersConfig.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/error/UserAlreadyExistsException.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/error/UserNotFoundException.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/notification/Notification.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/notification/NotificationController.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/notification/NotificationMapper.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/notification/NotificationRepository.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/notification/NotificationService.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/notification/PagedNotificationMapper.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/user/UserController.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/user/UserRepository.kt create mode 100644 legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/user/UserService.kt rename legalconsenthub-backend/src/main/resources/{application-local-h2.yaml => application-h2.yaml} (100%) create mode 100644 legalconsenthub-backend/src/main/resources/application-testcontainers.yaml rename legalconsenthub/better-auth_migrations/{2025-05-29T08-34-09.998Z.sql => 2025-08-07T06-04-32.922Z.sql} (100%) create mode 100644 legalconsenthub/components/NotificationsSlideover.vue create mode 100644 legalconsenthub/composables/notification/useNotification.ts create mode 100644 legalconsenthub/composables/notification/useNotificationApi.ts create mode 100644 legalconsenthub/composables/user/useUser.ts create mode 100644 legalconsenthub/composables/user/useUserApi.ts diff --git a/.run/local-server-backend-h2.run.xml b/.run/local-server-backend-h2.run.xml index 0a60a7a..ff394c8 100644 --- a/.run/local-server-backend-h2.run.xml +++ b/.run/local-server-backend-h2.run.xml @@ -1,6 +1,6 @@ -