feat: Init backend
This commit is contained in:
3
legalconsenthub-backend/.gitattributes
vendored
Normal file
3
legalconsenthub-backend/.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/gradlew text eol=lf
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.jar binary
|
||||||
849
legalconsenthub-backend/api/legalconsenthub.yml
Normal file
849
legalconsenthub-backend/api/legalconsenthub.yml
Normal file
@@ -0,0 +1,849 @@
|
|||||||
|
openapi: "3.0.3"
|
||||||
|
info:
|
||||||
|
title: legalconsenthub
|
||||||
|
version: 0.1.0
|
||||||
|
description: A platform for digital applications, approvals and discussions.
|
||||||
|
contact:
|
||||||
|
name: Denis Lugowski
|
||||||
|
email: denis.lugowski@gmail.com
|
||||||
|
|
||||||
|
servers:
|
||||||
|
- url: /api/v3
|
||||||
|
|
||||||
|
paths:
|
||||||
|
/application-forms:
|
||||||
|
get:
|
||||||
|
summary: Get all ApplicationForms
|
||||||
|
operationId: getAllApplicationForms
|
||||||
|
tags:
|
||||||
|
- application-form
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Paged list of application forms
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/PagedApplicationFormDto"
|
||||||
|
"500":
|
||||||
|
description: Internal server error
|
||||||
|
post:
|
||||||
|
summary: Create a new ApplicationForm
|
||||||
|
operationId: createApplicationForm
|
||||||
|
tags:
|
||||||
|
- application-form
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateApplicationFormDto"
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: Successfully created application form
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/ApplicationFormDto"
|
||||||
|
"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"
|
||||||
|
|
||||||
|
/application-forms/{id}:
|
||||||
|
get:
|
||||||
|
summary: Get a specific ApplicationForm
|
||||||
|
operationId: getApplicationFormById
|
||||||
|
tags:
|
||||||
|
- application-form
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Get application form by ID
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/ApplicationFormDto"
|
||||||
|
"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"
|
||||||
|
delete:
|
||||||
|
summary: Delete a ApplicationForm
|
||||||
|
operationId: deleteApplicationForm
|
||||||
|
tags:
|
||||||
|
- application-form
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: Application Form successfully deleted
|
||||||
|
"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:
|
||||||
|
get:
|
||||||
|
summary: Get all users
|
||||||
|
operationId: getAllUsers
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Paged list of users
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/PagedUserDto"
|
||||||
|
"500":
|
||||||
|
description: Internal server error
|
||||||
|
post:
|
||||||
|
summary: Create a new user
|
||||||
|
operationId: createUser
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateUserDTO"
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: Successfully created user
|
||||||
|
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}:
|
||||||
|
get:
|
||||||
|
summary: Get a specific user
|
||||||
|
operationId: getUserById
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Get user by ID
|
||||||
|
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"
|
||||||
|
delete:
|
||||||
|
summary: Delete a user
|
||||||
|
operationId: deleteUser
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: User successfully deleted
|
||||||
|
"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"
|
||||||
|
|
||||||
|
/comments:
|
||||||
|
get:
|
||||||
|
summary: Get all comments
|
||||||
|
operationId: getAllComments
|
||||||
|
tags:
|
||||||
|
- comment
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Paged list of comments
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/PagedCommentDto"
|
||||||
|
"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"
|
||||||
|
post:
|
||||||
|
summary: Create a new comment
|
||||||
|
operationId: createComment
|
||||||
|
tags:
|
||||||
|
- comment
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateCommentDto"
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: Successfully created comment
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CommentDto"
|
||||||
|
"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"
|
||||||
|
|
||||||
|
/comments/{id}:
|
||||||
|
get:
|
||||||
|
summary: Get a specific comment
|
||||||
|
operationId: getCommentById
|
||||||
|
tags:
|
||||||
|
- comment
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Get comment by ID
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CommentDto"
|
||||||
|
"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"
|
||||||
|
delete:
|
||||||
|
summary: Delete a comment
|
||||||
|
operationId: deleteComment
|
||||||
|
tags:
|
||||||
|
- comment
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: Comment successfully deleted
|
||||||
|
"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"
|
||||||
|
|
||||||
|
/roles:
|
||||||
|
get:
|
||||||
|
summary: Get all roles
|
||||||
|
operationId: getAllRoles
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: List of roles
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/RoleDto"
|
||||||
|
"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"
|
||||||
|
post:
|
||||||
|
summary: Create a new role
|
||||||
|
operationId: createRole
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateRoleDto"
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: Successfully created role
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/RoleDto"
|
||||||
|
"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"
|
||||||
|
|
||||||
|
/roles/{id}:
|
||||||
|
get:
|
||||||
|
summary: Get a specific role
|
||||||
|
operationId: getRoleById
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Get role by ID
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/RoleDto"
|
||||||
|
"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"
|
||||||
|
delete:
|
||||||
|
summary: Delete a role
|
||||||
|
operationId: deleteRole
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: Role successfully deleted
|
||||||
|
"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"
|
||||||
|
|
||||||
|
/files:
|
||||||
|
get:
|
||||||
|
summary: Get all files
|
||||||
|
operationId: getAllFiles
|
||||||
|
tags:
|
||||||
|
- file
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Successful response
|
||||||
|
"500":
|
||||||
|
description: Internal server error
|
||||||
|
post:
|
||||||
|
summary: Upload a new file
|
||||||
|
operationId: uploadFile
|
||||||
|
tags:
|
||||||
|
- file
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/UploadFileDto"
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: File uploaded
|
||||||
|
"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"
|
||||||
|
|
||||||
|
/files/{id}:
|
||||||
|
get:
|
||||||
|
summary: Get a specific file
|
||||||
|
operationId: getFileById
|
||||||
|
tags:
|
||||||
|
- file
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Get file by ID
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/FileDto"
|
||||||
|
"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"
|
||||||
|
delete:
|
||||||
|
summary: Delete a file
|
||||||
|
operationId: deleteFile
|
||||||
|
tags:
|
||||||
|
- file
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: File successfully deleted
|
||||||
|
"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"
|
||||||
|
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
####### UserDto #######
|
||||||
|
UserDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- username
|
||||||
|
- firstname
|
||||||
|
- lastname
|
||||||
|
- email
|
||||||
|
- password
|
||||||
|
- roleId
|
||||||
|
- createdAt
|
||||||
|
- modifiedAt
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
firstName:
|
||||||
|
type: string
|
||||||
|
lastName:
|
||||||
|
type: string
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
roleId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
modifiedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
|
||||||
|
CreateUserDTO:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- username
|
||||||
|
- firstname
|
||||||
|
- lastname
|
||||||
|
- email
|
||||||
|
- password
|
||||||
|
- roleId
|
||||||
|
- createdAt
|
||||||
|
- modifiedAt
|
||||||
|
properties:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
firstName:
|
||||||
|
type: string
|
||||||
|
lastName:
|
||||||
|
type: string
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
roleId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
|
||||||
|
PagedUserDto:
|
||||||
|
type: object
|
||||||
|
allOf:
|
||||||
|
- $ref: "#/components/schemas/Page"
|
||||||
|
required:
|
||||||
|
- content
|
||||||
|
properties:
|
||||||
|
content:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/UserDto"
|
||||||
|
|
||||||
|
####### ApplicationFormDto #######
|
||||||
|
ApplicationFormDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- formElements
|
||||||
|
- createdAt
|
||||||
|
- modifiedAt
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
formElements:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/FormElementDto"
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
modifiedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
|
||||||
|
CreateApplicationFormDto:
|
||||||
|
required:
|
||||||
|
- formElements
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
formElements:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/CreateFormElementDto"
|
||||||
|
|
||||||
|
PagedApplicationFormDto:
|
||||||
|
type: object
|
||||||
|
allOf:
|
||||||
|
- $ref: "#/components/schemas/Page"
|
||||||
|
required:
|
||||||
|
- content
|
||||||
|
properties:
|
||||||
|
content:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/ApplicationFormDto"
|
||||||
|
|
||||||
|
####### CommentDto #######
|
||||||
|
CommentDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- message
|
||||||
|
- createdAt
|
||||||
|
- modifiedAt
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
modifiedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
|
||||||
|
CreateCommentDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- message
|
||||||
|
properties:
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
PagedCommentDto:
|
||||||
|
type: object
|
||||||
|
allOf:
|
||||||
|
- $ref: "#/components/schemas/Page"
|
||||||
|
required:
|
||||||
|
- content
|
||||||
|
properties:
|
||||||
|
content:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/CommentDto"
|
||||||
|
|
||||||
|
####### RoleDto #######
|
||||||
|
RoleDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
CreateRoleDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
####### FileDto #######
|
||||||
|
FileDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- name
|
||||||
|
- file
|
||||||
|
- createdAt
|
||||||
|
- modifiedAt
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
file:
|
||||||
|
type: string
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
modifiedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
|
||||||
|
UploadFileDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
- file
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
file:
|
||||||
|
type: string
|
||||||
|
format: binary
|
||||||
|
|
||||||
|
####### Form #######
|
||||||
|
FormElementDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- applicationFormId
|
||||||
|
- options
|
||||||
|
- type
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
applicationFormId:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
options:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/FormOptionDto"
|
||||||
|
type:
|
||||||
|
$ref: "#/components/schemas/FormElementType"
|
||||||
|
|
||||||
|
CreateFormElementDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- options
|
||||||
|
- type
|
||||||
|
properties:
|
||||||
|
options:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/FormOptionDto"
|
||||||
|
type:
|
||||||
|
$ref: "#/components/schemas/FormElementType"
|
||||||
|
|
||||||
|
FormOptionDto:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- value
|
||||||
|
- label
|
||||||
|
- processingPurpose
|
||||||
|
- employeeDataCategory
|
||||||
|
properties:
|
||||||
|
value:
|
||||||
|
type: string
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
processingPurpose:
|
||||||
|
$ref: "#/components/schemas/ProcessingPurpose"
|
||||||
|
employeeDataCategory:
|
||||||
|
$ref: "#/components/schemas/EmployeeDataCategory"
|
||||||
|
|
||||||
|
FormElementType:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- DROPDOWN
|
||||||
|
- CHECKBOX
|
||||||
|
- RADIOBUTTON
|
||||||
|
- TEXTFIELD
|
||||||
|
- SWITCH
|
||||||
|
|
||||||
|
####### 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
|
||||||
|
enum:
|
||||||
|
- SYSTEM_OPERATION
|
||||||
|
- BUSINESS_PROCESS
|
||||||
|
- DATA_ANALYSIS
|
||||||
|
- NONE
|
||||||
|
|
||||||
|
EmployeeDataCategory:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- NON_CRITICAL
|
||||||
|
- REVIEW_REQUIRED
|
||||||
|
- SENSITIVE
|
||||||
|
- NONE
|
||||||
|
|
||||||
|
####### Supporting components #######
|
||||||
|
Page:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- number
|
||||||
|
- size
|
||||||
|
- numberOfElements
|
||||||
|
- last
|
||||||
|
- totalPages
|
||||||
|
- first
|
||||||
|
- totalElements
|
||||||
|
- empty
|
||||||
|
properties:
|
||||||
|
number:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
example: 0
|
||||||
|
size:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
example: 100
|
||||||
|
numberOfElements:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
example: 0
|
||||||
|
last:
|
||||||
|
type: boolean
|
||||||
|
example: true
|
||||||
|
totalPages:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
example: 0
|
||||||
|
first:
|
||||||
|
type: boolean
|
||||||
|
example: true
|
||||||
|
totalElements:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
example: 0
|
||||||
|
empty:
|
||||||
|
type: boolean
|
||||||
|
example: true
|
||||||
77
legalconsenthub-backend/build.gradle
Normal file
77
legalconsenthub-backend/build.gradle
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.jetbrains.kotlin.jvm' version '1.9.25'
|
||||||
|
id 'org.jetbrains.kotlin.plugin.spring' version '1.9.25'
|
||||||
|
id 'org.springframework.boot' version '3.4.2'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
|
id 'org.jetbrains.kotlin.plugin.jpa' version '1.9.25'
|
||||||
|
id 'org.openapi.generator' version '7.11.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.betriebsratkanzlei'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-reflect'
|
||||||
|
implementation 'org.liquibase:liquibase-core'
|
||||||
|
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.4'
|
||||||
|
implementation 'org.springdoc:springdoc-openapi-ui:1.8.0'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
|
runtimeOnly 'com.h2database:h2'
|
||||||
|
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
freeCompilerArgs.addAll '-Xjsr305=strict'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allOpen {
|
||||||
|
annotation 'jakarta.persistence.Entity'
|
||||||
|
annotation 'jakarta.persistence.MappedSuperclass'
|
||||||
|
annotation 'jakarta.persistence.Embeddable'
|
||||||
|
}
|
||||||
|
|
||||||
|
def generatedSourcesServerLegalconsenthubDir = "$buildDir/generated/server".toString()
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
kotlin.srcDirs += generatedSourcesServerLegalconsenthubDir + '/src/main/kotlin'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
task generate_legalconsenthub_server(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
|
||||||
|
generatorName = 'kotlin-spring'
|
||||||
|
inputSpec = "$rootDir/api/legalconsenthub.yml".toString()
|
||||||
|
outputDir = generatedSourcesServerLegalconsenthubDir
|
||||||
|
apiPackage = 'com.betriebsratkanzlei.legalconsenthub_api.api'
|
||||||
|
modelPackage = 'com.betriebsratkanzlei.legalconsenthub_api.model'
|
||||||
|
groupId = 'com.betriebsratkanzlei'
|
||||||
|
id = 'legalconsenthub_api'
|
||||||
|
configOptions = [useTags : 'true',
|
||||||
|
enumPropertyNaming: 'original',
|
||||||
|
interfaceOnly : 'true',
|
||||||
|
useSpringBoot3 : 'true']
|
||||||
|
typeMappings = [DateTime: "LocalDateTime"]
|
||||||
|
importMappings = [LocalDateTime: "java.time.LocalDateTime"]
|
||||||
|
}
|
||||||
|
|
||||||
|
compileKotlin.dependsOn(tasks.generate_legalconsenthub_server)
|
||||||
BIN
legalconsenthub-backend/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
legalconsenthub-backend/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
legalconsenthub-backend/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
legalconsenthub-backend/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
252
legalconsenthub-backend/gradlew
vendored
Executable file
252
legalconsenthub-backend/gradlew
vendored
Executable file
@@ -0,0 +1,252 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
94
legalconsenthub-backend/gradlew.bat
vendored
Normal file
94
legalconsenthub-backend/gradlew.bat
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
1
legalconsenthub-backend/settings.gradle
Normal file
1
legalconsenthub-backend/settings.gradle
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'legalconsenthub'
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||||
|
import org.springframework.boot.runApplication
|
||||||
|
import org.springframework.data.jpa.repository.config.EnableJpaAuditing
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableJpaAuditing
|
||||||
|
class LegalconsenthubApplication
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
runApplication<LegalconsenthubApplication>(*args)
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.application_form
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.formelement.FormElement
|
||||||
|
import jakarta.persistence.CascadeType
|
||||||
|
import jakarta.persistence.Column
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.EntityListeners
|
||||||
|
import jakarta.persistence.GeneratedValue
|
||||||
|
import jakarta.persistence.Id
|
||||||
|
import jakarta.persistence.OneToMany
|
||||||
|
import org.springframework.data.annotation.CreatedDate
|
||||||
|
import org.springframework.data.annotation.LastModifiedDate
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@EntityListeners(AuditingEntityListener::class)
|
||||||
|
class ApplicationForm(
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
var id: UUID? = null,
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "applicationForm", cascade = [CascadeType.ALL], orphanRemoval = true)
|
||||||
|
var formElements: MutableList<FormElement> = mutableListOf(),
|
||||||
|
|
||||||
|
@CreatedDate
|
||||||
|
@Column(nullable = false)
|
||||||
|
var createdAt: LocalDateTime? = null,
|
||||||
|
|
||||||
|
@LastModifiedDate
|
||||||
|
@Column(nullable = false)
|
||||||
|
var modifiedAt: LocalDateTime? = null
|
||||||
|
|
||||||
|
// TODO LastModifiedBy User einfügen
|
||||||
|
)
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.application_form
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.api.ApplicationFormApi
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.ApplicationFormDto
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.CreateApplicationFormDto
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.PagedApplicationFormDto
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.web.bind.annotation.RestController
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
class ApplicationFormController(
|
||||||
|
val applicationFormService: ApplicationFormService,
|
||||||
|
val pagedApplicationFormMapper: PagedApplicationFormMapper,
|
||||||
|
val applicationFormMapper: ApplicationFormMapper,
|
||||||
|
) : ApplicationFormApi {
|
||||||
|
|
||||||
|
override fun createApplicationForm(createApplicationFormDto: CreateApplicationFormDto): ResponseEntity<ApplicationFormDto> {
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
applicationFormMapper.toApplicationFormDto(
|
||||||
|
applicationFormService.createApplicationForm(createApplicationFormDto)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun deleteApplicationForm(id: UUID): ResponseEntity<Unit> {
|
||||||
|
applicationFormService.deleteApplicationFormByID(id)
|
||||||
|
return ResponseEntity.noContent().build()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getAllApplicationForms(): ResponseEntity<PagedApplicationFormDto> {
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
pagedApplicationFormMapper.toPagedApplicationFormDto(
|
||||||
|
applicationFormService.getApplicationForms()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getApplicationFormById(id: UUID): ResponseEntity<ApplicationFormDto> {
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
applicationFormMapper.toApplicationFormDto(
|
||||||
|
applicationFormService.getApplicationFormById(id)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.application_form
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.ApplicationFormDto
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.CreateApplicationFormDto
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
@Component
|
||||||
|
class ApplicationFormMapper(private val formElementMapper: FormElementMapper) {
|
||||||
|
fun toApplicationFormDto(applicationForm: ApplicationForm): ApplicationFormDto {
|
||||||
|
return ApplicationFormDto(
|
||||||
|
id = applicationForm.id ?: throw IllegalStateException("ApplicationForm ID must not be null!"),
|
||||||
|
formElements = applicationForm.formElements.map { formElementMapper.toFormElementDto(it) },
|
||||||
|
createdAt = applicationForm.createdAt ?: LocalDateTime.now(),
|
||||||
|
modifiedAt = applicationForm.modifiedAt ?: LocalDateTime.now()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toApplicationForm(applicationForm: ApplicationFormDto): ApplicationForm {
|
||||||
|
return ApplicationForm(
|
||||||
|
id = applicationForm.id,
|
||||||
|
formElements = applicationForm.formElements.map { formElementMapper.toFormElement(it) }.toMutableList(),
|
||||||
|
createdAt = applicationForm.createdAt,
|
||||||
|
modifiedAt = applicationForm.modifiedAt
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toApplicationForm(createApplicationFormDto: CreateApplicationFormDto): ApplicationForm {
|
||||||
|
val applicationForm = ApplicationForm()
|
||||||
|
applicationForm.formElements = createApplicationFormDto.formElements
|
||||||
|
.map { formElementMapper.toFormElement(it, applicationForm) }
|
||||||
|
.toMutableList()
|
||||||
|
return applicationForm
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.application_form
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
interface ApplicationFormRepository : JpaRepository<ApplicationForm, UUID>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.application_form
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.error.ApplicationFormNotCreatedException
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.error.ApplicationFormNotDeletedException
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.error.ApplicationFormNotFoundException
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.error.ApplicationFormNotUpdatedException
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.ApplicationFormDto
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.CreateApplicationFormDto
|
||||||
|
import org.springframework.data.domain.Page
|
||||||
|
import org.springframework.data.domain.PageRequest
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
@Service
|
||||||
|
class ApplicationFormService(
|
||||||
|
private val applicationFormRepository: ApplicationFormRepository,
|
||||||
|
private val applicationFormMapper: ApplicationFormMapper
|
||||||
|
) {
|
||||||
|
|
||||||
|
fun createApplicationForm(createApplicationFormDto: CreateApplicationFormDto): ApplicationForm {
|
||||||
|
val applicationForm = applicationFormMapper.toApplicationForm(createApplicationFormDto)
|
||||||
|
val savedApplicationForm: ApplicationForm
|
||||||
|
try {
|
||||||
|
savedApplicationForm = applicationFormRepository.save(applicationForm)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw ApplicationFormNotCreatedException(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
return savedApplicationForm
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getApplicationFormById(id: UUID): ApplicationForm {
|
||||||
|
return applicationFormRepository.findById(id).orElseThrow { ApplicationFormNotFoundException(id) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getApplicationForms(): Page<ApplicationForm> {
|
||||||
|
val pageable = PageRequest.of(0, 10)
|
||||||
|
return applicationFormRepository.findAll(pageable)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateApplicationForm(applicationFormDto: ApplicationFormDto): ApplicationForm {
|
||||||
|
val applicationForm = applicationFormMapper.toApplicationForm(applicationFormDto)
|
||||||
|
val updatedApplicationForm: ApplicationForm
|
||||||
|
|
||||||
|
try {
|
||||||
|
updatedApplicationForm = applicationFormRepository.save(applicationForm)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw ApplicationFormNotUpdatedException(e, applicationFormDto.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
return updatedApplicationForm
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteApplicationFormByID(id: UUID) {
|
||||||
|
try {
|
||||||
|
applicationFormRepository.deleteById(id)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw ApplicationFormNotDeletedException(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.application_form
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.error.ApplicationFormNotFoundException
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.formelement.FormElement
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.CreateFormElementDto
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.FormElementDto
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
|
@Component
|
||||||
|
class FormElementMapper(
|
||||||
|
private val formOptionMapper: FormOptionMapper,
|
||||||
|
private val applicationFormRepository: ApplicationFormRepository
|
||||||
|
) {
|
||||||
|
fun toFormElementDto(formElement: FormElement): FormElementDto {
|
||||||
|
return FormElementDto(
|
||||||
|
id = formElement.id ?: throw IllegalStateException("ApplicationForm ID must not be null!"),
|
||||||
|
options = formElement.options.map { formOptionMapper.toFormOptionDto(it) },
|
||||||
|
type = formElement.type,
|
||||||
|
applicationFormId = formElement.applicationForm?.id
|
||||||
|
?: throw IllegalStateException("ApplicationForm ID must not be null!")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toFormElement(formElement: FormElementDto): FormElement {
|
||||||
|
val applicationForm = applicationFormRepository.findById(formElement.applicationFormId)
|
||||||
|
.orElseThrow { ApplicationFormNotFoundException(formElement.applicationFormId) }
|
||||||
|
|
||||||
|
return FormElement(
|
||||||
|
id = formElement.id,
|
||||||
|
options = formElement.options.map { formOptionMapper.toFormOption(it) }.toMutableList(),
|
||||||
|
type = formElement.type,
|
||||||
|
applicationForm = applicationForm
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toFormElement(formElement: CreateFormElementDto, applicationForm: ApplicationForm): FormElement {
|
||||||
|
return FormElement(
|
||||||
|
id = null,
|
||||||
|
options = formElement.options.map { formOptionMapper.toFormOption(it) }.toMutableList(),
|
||||||
|
type = formElement.type,
|
||||||
|
applicationForm = applicationForm
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.application_form
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.formelement.FormOption
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.FormOptionDto
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
|
@Component
|
||||||
|
class FormOptionMapper {
|
||||||
|
fun toFormOptionDto(formOption: FormOption): FormOptionDto {
|
||||||
|
return FormOptionDto(
|
||||||
|
value = formOption.value,
|
||||||
|
label = formOption.label,
|
||||||
|
processingPurpose = formOption.processingPurpose,
|
||||||
|
employeeDataCategory = formOption.employeeDataCategory
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toFormOption(formOptionDto: FormOptionDto): FormOption {
|
||||||
|
return FormOption(
|
||||||
|
value = formOptionDto.value,
|
||||||
|
label = formOptionDto.label,
|
||||||
|
processingPurpose = formOptionDto.processingPurpose,
|
||||||
|
employeeDataCategory = formOptionDto.employeeDataCategory
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.application_form
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.ApplicationFormDto
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.CreateApplicationFormDto
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.PagedApplicationFormDto
|
||||||
|
import org.springframework.data.domain.Page
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
|
@Component
|
||||||
|
class PagedApplicationFormMapper(private val applicationFormMapper: ApplicationFormMapper) {
|
||||||
|
fun toPagedApplicationFormDto(pagedApplicationForm: Page<ApplicationForm>): PagedApplicationFormDto {
|
||||||
|
return PagedApplicationFormDto(
|
||||||
|
content = pagedApplicationForm.content.map { applicationFormMapper.toApplicationFormDto(it) },
|
||||||
|
number = pagedApplicationForm.number,
|
||||||
|
propertySize = pagedApplicationForm.size,
|
||||||
|
numberOfElements = pagedApplicationForm.numberOfElements,
|
||||||
|
last = pagedApplicationForm.isLast,
|
||||||
|
totalPages = pagedApplicationForm.totalPages,
|
||||||
|
totalElements = pagedApplicationForm.totalElements,
|
||||||
|
empty = pagedApplicationForm.isEmpty,
|
||||||
|
first = pagedApplicationForm.isFirst,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// fun toApplicationForm(applicationForm: ApplicationFormDto): ApplicationForm {}
|
||||||
|
// fun toApplicationForm(createApplicationFormDto: CreateApplicationFormDto): ApplicationForm
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.error
|
||||||
|
|
||||||
|
class ApplicationFormNotCreatedException(e: Exception): RuntimeException("Couldn't create application form", e)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.error
|
||||||
|
|
||||||
|
class ApplicationFormNotDeletedException(e: Exception): RuntimeException("Couldn't delete application form", e)
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.error
|
||||||
|
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
class ApplicationFormNotFoundException(id: UUID): RuntimeException("Couldn't find application form with ID: $id")
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.error
|
||||||
|
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
class ApplicationFormNotUpdatedException(e: Exception, id: UUID): RuntimeException("Couldn't update application form with ID: $id", e)
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.error
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.ProblemDetails
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.http.HttpStatus
|
||||||
|
import org.springframework.http.MediaType
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
|
@ControllerAdvice
|
||||||
|
class ExceptionHandler {
|
||||||
|
var logger = LoggerFactory.getLogger(ExceptionHandler::class.java)
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@ExceptionHandler(ApplicationFormNotFoundException::class)
|
||||||
|
@ResponseStatus(HttpStatus.NOT_FOUND)
|
||||||
|
fun handleNotFoundError(e: Exception): ResponseEntity<ProblemDetails> {
|
||||||
|
logger.warn(e.message, e)
|
||||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).contentType(MediaType.APPLICATION_PROBLEM_JSON)
|
||||||
|
.body(
|
||||||
|
ProblemDetails(
|
||||||
|
title = "Not Found",
|
||||||
|
status = HttpStatus.NOT_FOUND.value(),
|
||||||
|
type = URI.create("about:blank"),
|
||||||
|
detail = e.message ?: "Something went wrong"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@ExceptionHandler(
|
||||||
|
ApplicationFormNotCreatedException::class,
|
||||||
|
ApplicationFormNotUpdatedException::class,
|
||||||
|
ApplicationFormNotDeletedException::class,
|
||||||
|
)
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
fun handleInternalServerError(e: Exception): ResponseEntity<ProblemDetails> {
|
||||||
|
logger.warn(e.message, e)
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).contentType(MediaType.APPLICATION_PROBLEM_JSON)
|
||||||
|
.body(
|
||||||
|
ProblemDetails(
|
||||||
|
title = "Internal Server Error",
|
||||||
|
status = HttpStatus.INTERNAL_SERVER_ERROR.value(),
|
||||||
|
type = URI.create("about:blank"),
|
||||||
|
detail = e.message ?: "Something went wrong"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.formelement;
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub.application_form.ApplicationForm
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.FormElementType
|
||||||
|
import jakarta.persistence.CollectionTable
|
||||||
|
import jakarta.persistence.Column
|
||||||
|
import jakarta.persistence.ElementCollection
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn
|
||||||
|
import jakarta.persistence.ManyToOne
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
class FormElement (
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
var id: UUID? = null,
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "application_form_id", nullable = false)
|
||||||
|
var applicationForm: ApplicationForm? = null,
|
||||||
|
|
||||||
|
@ElementCollection
|
||||||
|
@CollectionTable(name = "form_element_options", joinColumns = [JoinColumn(name = "form_element_id")])
|
||||||
|
var options: MutableList<FormOption> = mutableListOf(),
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
var type: FormElementType
|
||||||
|
)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub.formelement;
|
||||||
|
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.EmployeeDataCategory
|
||||||
|
import com.betriebsratkanzlei.legalconsenthub_api.model.ProcessingPurpose;
|
||||||
|
import jakarta.persistence.Column
|
||||||
|
import jakarta.persistence.Embeddable
|
||||||
|
|
||||||
|
@Embeddable
|
||||||
|
class FormOption(
|
||||||
|
@Column(nullable = false, name = "option_value")
|
||||||
|
var value: String,
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
var label: String,
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
var processingPurpose: ProcessingPurpose,
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
var employeeDataCategory: EmployeeDataCategory
|
||||||
|
)
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: legalconsenthub
|
||||||
|
|
||||||
|
datasource:
|
||||||
|
driverClassName: org.h2.Driver
|
||||||
|
url: jdbc:h2:mem:testdb
|
||||||
|
username: sa
|
||||||
|
password: password
|
||||||
|
|
||||||
|
jpa:
|
||||||
|
database-platform: org.hibernate.dialect.H2Dialect
|
||||||
|
|
||||||
|
# http://localhost:8080/h2-console
|
||||||
|
h2:
|
||||||
|
console:
|
||||||
|
enabled: true
|
||||||
33
legalconsenthub-backend/src/main/resources/application.yaml
Normal file
33
legalconsenthub-backend/src/main/resources/application.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: legalconsenthub
|
||||||
|
|
||||||
|
datasource:
|
||||||
|
hikari:
|
||||||
|
auto-commit: false
|
||||||
|
url: jdbc:h2:mem:legalconsenthub-database
|
||||||
|
username: user
|
||||||
|
password: pw
|
||||||
|
|
||||||
|
jpa:
|
||||||
|
show-sql: true
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: create
|
||||||
|
database-platform: org.hibernate.dialect.PostgreSQLDialect
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
format_sql: true
|
||||||
|
jdbc:
|
||||||
|
batch_size: 100
|
||||||
|
order_inserts: true
|
||||||
|
enable_lazy_load_no_trans: true
|
||||||
|
|
||||||
|
liquibase:
|
||||||
|
enabled: true
|
||||||
|
drop-first: false
|
||||||
|
change-log: classpath:/db/changelog/db.changelog-master.yaml
|
||||||
|
default-schema: public
|
||||||
|
|
||||||
|
sql:
|
||||||
|
init:
|
||||||
|
platform: h2
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
databaseChangeLog:
|
||||||
|
- include:
|
||||||
|
file: db/migrations/001-schema.sql
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
create table application_form
|
||||||
|
(
|
||||||
|
created_at timestamp(6) not null,
|
||||||
|
modified_at timestamp(6) not null,
|
||||||
|
id uuid not null,
|
||||||
|
primary key (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table form_element_options
|
||||||
|
(
|
||||||
|
employee_data_category tinyint not null check (employee_data_category between 0 and 3),
|
||||||
|
processing_purpose tinyint not null check (processing_purpose between 0 and 3),
|
||||||
|
form_element_id uuid not null,
|
||||||
|
label varchar(255) not null,
|
||||||
|
option_value varchar(255) not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table form_element
|
||||||
|
(
|
||||||
|
type tinyint not null check (type between 0 and 4),
|
||||||
|
application_form_id uuid not null,
|
||||||
|
id uuid not null,
|
||||||
|
primary key (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table if exists form_element_options
|
||||||
|
add constraint FKnq0lpby5nspv1xi27n9el6us6
|
||||||
|
foreign key (form_element_id)
|
||||||
|
references form_element;
|
||||||
|
|
||||||
|
alter table if exists form_element
|
||||||
|
add constraint FKdniyq3l10lncw48tft15js5gb
|
||||||
|
foreign key (application_form_id)
|
||||||
|
references application_form;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.betriebsratkanzlei.legalconsenthub
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class LegalconsenthubApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user