diff --git a/legalconsenthub-backend/api/legalconsenthub.yml b/legalconsenthub-backend/api/legalconsenthub.yml
index 9aea6f2..b9ecc96 100644
--- a/legalconsenthub-backend/api/legalconsenthub.yml
+++ b/legalconsenthub-backend/api/legalconsenthub.yml
@@ -678,6 +678,8 @@ components:
- name
- formElements
- isTemplate
+ - createdBy
+ - lastModifiedBy
- createdAt
- modifiedAt
properties:
@@ -692,6 +694,10 @@ components:
$ref: "#/components/schemas/FormElementDto"
isTemplate:
type: boolean
+ createdBy:
+ type: string
+ lastModifiedBy:
+ type: string
createdAt:
type: string
format: date-time
@@ -704,6 +710,8 @@ components:
- name
- formElements
- isTemplate
+ - createdBy
+ - lastModifiedBy
type: object
properties:
name:
@@ -715,6 +723,10 @@ components:
isTemplate:
type: boolean
default: false
+ createdBy:
+ type: string
+ lastModifiedBy:
+ type: string
PagedApplicationFormDto:
type: object
diff --git a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationForm.kt b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationForm.kt
index 39ae07f..9fb9c37 100644
--- a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationForm.kt
+++ b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationForm.kt
@@ -30,6 +30,12 @@ class ApplicationForm(
@Column(nullable = false)
var isTemplate: Boolean,
+ @Column(nullable = false)
+ var createdBy: String = "",
+
+ @Column(nullable = false)
+ var lastModifiedBy: String = "",
+
@CreatedDate
@Column(nullable = false)
var createdAt: LocalDateTime? = null,
@@ -37,6 +43,4 @@ class ApplicationForm(
@LastModifiedDate
@Column(nullable = false)
var modifiedAt: LocalDateTime? = null
-
- // TODO LastModifiedBy User einfügen
)
diff --git a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationFormMapper.kt b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationFormMapper.kt
index 3e880d6..21857c8 100644
--- a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationFormMapper.kt
+++ b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/application_form/ApplicationFormMapper.kt
@@ -13,6 +13,8 @@ class ApplicationFormMapper(private val formElementMapper: FormElementMapper) {
name = applicationForm.name,
formElements = applicationForm.formElements.map { formElementMapper.toFormElementDto(it) },
isTemplate = applicationForm.isTemplate,
+ createdBy = applicationForm.createdBy,
+ lastModifiedBy = applicationForm.lastModifiedBy,
createdAt = applicationForm.createdAt ?: LocalDateTime.now(),
modifiedAt = applicationForm.modifiedAt ?: LocalDateTime.now()
)
@@ -24,6 +26,8 @@ class ApplicationFormMapper(private val formElementMapper: FormElementMapper) {
name = applicationForm.name,
formElements = applicationForm.formElements.map { formElementMapper.toFormElement(it) }.toMutableList(),
isTemplate = applicationForm.isTemplate,
+ createdBy = applicationForm.createdBy,
+ lastModifiedBy = applicationForm.lastModifiedBy,
createdAt = applicationForm.createdAt,
modifiedAt = applicationForm.modifiedAt
)
@@ -32,7 +36,9 @@ class ApplicationFormMapper(private val formElementMapper: FormElementMapper) {
fun toApplicationForm(createApplicationFormDto: CreateApplicationFormDto): ApplicationForm {
val applicationForm = ApplicationForm(
name = createApplicationFormDto.name,
- isTemplate = createApplicationFormDto.isTemplate
+ isTemplate = createApplicationFormDto.isTemplate,
+ createdBy = createApplicationFormDto.createdBy,
+ lastModifiedBy = createApplicationFormDto.lastModifiedBy
)
applicationForm.formElements = createApplicationFormDto.formElements
.map { formElementMapper.toFormElement(it, applicationForm) }
diff --git a/legalconsenthub-backend/src/main/resources/db/migrations/001-schema.sql b/legalconsenthub-backend/src/main/resources/db/migrations/001-schema.sql
index c8844cf..0b732b2 100644
--- a/legalconsenthub-backend/src/main/resources/db/migrations/001-schema.sql
+++ b/legalconsenthub-backend/src/main/resources/db/migrations/001-schema.sql
@@ -1,10 +1,12 @@
create table application_form
(
- is_template boolean not null,
- created_at timestamp(6) not null,
- modified_at timestamp(6) not null,
- id uuid not null,
- name varchar(255) not null,
+ is_template boolean not null,
+ created_at timestamp(6) not null,
+ modified_at timestamp(6) not null,
+ id uuid not null,
+ created_by varchar(255) not null,
+ last_modified_by varchar(255) not null,
+ name varchar(255) not null,
primary key (id)
);
diff --git a/legalconsenthub/pages/create.vue b/legalconsenthub/pages/create.vue
index 888089c..ba17405 100644
--- a/legalconsenthub/pages/create.vue
+++ b/legalconsenthub/pages/create.vue
@@ -46,6 +46,7 @@ definePageMeta({
const { getAllApplicationFormTemplates } = useApplicationFormTemplate()
const { createApplicationForm } = useApplicationForm()
const { validateFormElements, getHighestComplianceStatus } = useApplicationFormValidator()
+const { data: session } = await useSession(useFetch)
const { data } = await useAsyncData
- Zuletzt bearbeitet: {{ formatDate(applicationFormElem.modifiedAt) }} + Zuletzt bearbeitet von {{ applicationFormElem.lastModifiedBy }} am + {{ formatDate(applicationFormElem.modifiedAt) }} +
++ Erstellt von {{ applicationFormElem.createdBy }} am {{ formatDate(applicationFormElem.createdAt) }}
-Erstellt: {{ formatDate(applicationFormElem.createdAt) }}