feat(fontend,backend): Add createdBy and lastModifiedBy fields
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -4,6 +4,8 @@ create table application_form
|
||||
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)
|
||||
);
|
||||
|
||||
@@ -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<PagedApplicationFormDto>(async () => {
|
||||
return await getAllApplicationFormTemplates()
|
||||
@@ -95,6 +96,9 @@ const ampelStatusEmoji = computed(() => {
|
||||
|
||||
async function onSubmit() {
|
||||
if (applicationFormTemplate.value) {
|
||||
applicationFormTemplate.value.createdBy = session.value?.user?.name ?? 'Unknown'
|
||||
applicationFormTemplate.value.lastModifiedBy = session.value?.user?.name ?? 'Unknown'
|
||||
|
||||
await createApplicationForm(applicationFormTemplate.value)
|
||||
await navigateTo('/')
|
||||
} else {
|
||||
|
||||
@@ -31,9 +31,12 @@
|
||||
#{{ index }} {{ applicationFormElem.name }}
|
||||
</p>
|
||||
<p class="text-(--ui-text-muted) text-sm">
|
||||
Zuletzt bearbeitet: {{ formatDate(applicationFormElem.modifiedAt) }}
|
||||
Zuletzt bearbeitet von {{ applicationFormElem.lastModifiedBy }} am
|
||||
{{ formatDate(applicationFormElem.modifiedAt) }}
|
||||
</p>
|
||||
<p class="text-(--ui-text-muted) text-sm">
|
||||
Erstellt von {{ applicationFormElem.createdBy }} am {{ formatDate(applicationFormElem.createdAt) }}
|
||||
</p>
|
||||
<p class="text-(--ui-text-muted) text-sm">Erstellt: {{ formatDate(applicationFormElem.createdAt) }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<UPageLinks :links="getLinksForApplicationForm(applicationFormElem)" />
|
||||
|
||||
Reference in New Issue
Block a user