feat(fullstack): Add notifications, user is now an entity, add testcontainers, rework custom permissions, get user from JWT in endpoints

This commit is contained in:
2025-08-09 10:09:00 +02:00
parent a5eae07eaf
commit 7e55a336f2
44 changed files with 1571 additions and 139 deletions

View File

@@ -339,6 +339,34 @@ paths:
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
####### Users #######
/users:
post:
summary: Create a new user
operationId: createUser
tags:
- user
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUserDto"
responses:
"201":
description: User successfully created
content:
application/json:
schema:
$ref: "#/components/schemas/UserDto"
"400":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/BadRequest"
"401":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
"500":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
"503":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
/users/{id}:
parameters:
- name: id
@@ -346,7 +374,6 @@ paths:
required: true
schema:
type: string
format: uuid
get:
summary: Get a specific user
operationId: getUserById
@@ -602,6 +629,142 @@ paths:
"503":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
####### Notifications #######
/notifications:
get:
summary: Get notifications for the current user
operationId: getNotifications
tags:
- notification
parameters:
- in: query
name: page
schema:
type: integer
default: 0
description: Page number
- in: query
name: size
schema:
type: integer
default: 20
description: Page size
responses:
"200":
description: Paged list of notifications
content:
application/json:
schema:
$ref: "#/components/schemas/PagedNotificationDto"
"401":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
"500":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
post:
summary: Create a new notification
operationId: createNotification
tags:
- notification
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateNotificationDto"
responses:
"201":
description: Successfully created notification
content:
application/json:
schema:
$ref: "#/components/schemas/NotificationDto"
"400":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/BadRequest"
"401":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
"500":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
/notifications/unread:
get:
summary: Get unread notifications for the current user
operationId: getUnreadNotifications
tags:
- notification
responses:
"200":
description: List of unread notifications
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/NotificationDto"
"401":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
"500":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
/notifications/unread/count:
get:
summary: Get count of unread notifications for the current user
operationId: getUnreadNotificationCount
tags:
- notification
responses:
"200":
description: Count of unread notifications
content:
application/json:
schema:
type: integer
format: int64
"401":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
"500":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
/notifications/mark-all-read:
put:
summary: Mark all notifications as read for the current user
operationId: markAllNotificationsAsRead
tags:
- notification
responses:
"204":
description: All notifications marked as read
"401":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
"500":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
/notifications/{id}/mark-read:
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
put:
summary: Mark a specific notification as read
operationId: markNotificationAsRead
tags:
- notification
responses:
"200":
description: Notification marked as read
content:
application/json:
schema:
$ref: "#/components/schemas/NotificationDto"
"404":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/NotFound"
"401":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
"500":
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
####### Files #######
/files:
get:
@@ -751,7 +914,6 @@ components:
type: string
status:
$ref: "#/components/schemas/ApplicationFormStatus"
default: DRAFT
PagedApplicationFormDto:
type: object
@@ -886,11 +1048,51 @@ components:
required:
- id
- name
- status
properties:
id:
type: string
name:
type: string
status:
$ref: "#/components/schemas/UserStatus"
role:
$ref: "#/components/schemas/UserRole"
CreateUserDto:
type: object
required:
- id
- name
- status
- role
properties:
id:
type: string
name:
type: string
status:
$ref: "#/components/schemas/UserStatus"
role:
$ref: "#/components/schemas/UserRole"
UserStatus:
type: string
enum:
- INVITED
- ACTIVE
- BLOCKED
- SUSPENDED_SUBSCRIPTION
UserRole:
type: string
description: "User's role in the organization"
enum:
- owner
- admin
- employer
- works_council_member
- employee
####### CommentDto #######
CommentDto:
@@ -968,6 +1170,85 @@ components:
name:
type: string
####### Notification #######
NotificationDto:
type: object
required:
- id
- title
- message
- clickTarget
- isRead
- targetGroup
- type
- createdAt
properties:
id:
type: string
format: uuid
title:
type: string
message:
type: string
clickTarget:
type: string
isRead:
type: boolean
recipient:
nullable: true
allOf:
- $ref: "#/components/schemas/UserDto"
targetGroup:
type: string
type:
$ref: "#/components/schemas/NotificationType"
createdAt:
type: string
format: date-time
CreateNotificationDto:
type: object
required:
- title
- message
- clickTarget
- targetGroup
- type
properties:
title:
type: string
message:
type: string
clickTarget:
type: string
recipient:
nullable: true
allOf:
- $ref: "#/components/schemas/UserDto"
targetGroup:
type: string
type:
$ref: "#/components/schemas/NotificationType"
PagedNotificationDto:
type: object
allOf:
- $ref: "#/components/schemas/Page"
required:
- content
properties:
content:
type: array
items:
$ref: "#/components/schemas/NotificationDto"
NotificationType:
type: string
enum:
- INFO
- WARNING
- ERROR
####### FileDto #######
FileDto:
type: object
@@ -1004,24 +1285,6 @@ components:
type: string
format: binary
####### Notification #######
NotificationDto:
type: object
required:
- id
- notificationType
properties:
id:
type: string
format: uuid
notificationType:
$ref: "#/components/schemas/NotificationType"
NotificationType:
type: string
enum:
- EMAIL
####### Miscellaneous #######
ProcessingPurpose:
type: string