-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from MrSebastian/update-person
Update person
- Loading branch information
Showing
22 changed files
with
259 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...d/src/main/java/de/mrsebastian/todoappdemo/backend/person/dataaccess/PersonUpdateDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package de.mrsebastian.todoappdemo.backend.person.dataaccess; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record PersonUpdateDao(String firstname, String lastname, @NotNull String email) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
backend/src/main/java/de/mrsebastian/todoappdemo/backend/person/rest/PersonUpdateDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package de.mrsebastian.todoappdemo.backend.person.rest; | ||
|
||
import jakarta.validation.constraints.Email; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record PersonUpdateDTO(String firstname, String lastname, @NotNull @Email String email) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
frontend/frontend/src/features/person/components/ThePersonUpdateDialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<template> | ||
<v-dialog | ||
v-model="dialogVisible" | ||
:persistent="true" | ||
width="400px" | ||
> | ||
<v-card> | ||
<v-card-title>Person erstellen</v-card-title> | ||
<v-card-text> | ||
<v-form ref="refForm"> | ||
<base-person-fields :person="person" /> | ||
</v-form> | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-btn @click="handleCancelClicked">Abbrechen</v-btn> | ||
<v-btn @click="handleSaveClicked">Erstellen</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { SubmitEventPromise } from "vuetify"; | ||
import { computed, ref } from "vue"; | ||
import { useValidationUtils } from "@/composables/useValidationUtils"; | ||
import BasePersonFields from "@/features/person/components/BasePersonFields.vue"; | ||
import PersonPersisted from "@/features/person/types/PersonPersisted"; | ||
interface IProps { | ||
modelValue: boolean; | ||
person: PersonPersisted; | ||
} | ||
const props = withDefaults(defineProps<IProps>(), { | ||
modelValue: false, | ||
person: () => PersonPersisted.createDefault(), | ||
}); | ||
const emit = defineEmits<{ | ||
(e: "update:modelValue", value: boolean): void; | ||
(e: "edit", editedPerson: PersonPersisted): void; | ||
}>(); | ||
const validationUtils = useValidationUtils(); | ||
const refForm = ref<HTMLFormElement>(); | ||
const dialogVisible = computed({ | ||
get: () => props.modelValue, | ||
set: (value: boolean) => emit("update:modelValue", value), | ||
}); | ||
function closeDialog(): void { | ||
emit("update:modelValue", false); | ||
resetForm(); | ||
} | ||
function handleCancelClicked(): void { | ||
closeDialog(); | ||
} | ||
function handleSaveClicked(): void { | ||
validationUtils | ||
.proceedOnValid(refForm.value?.validate() as SubmitEventPromise) | ||
.then(() => emit("edit", props.person)); | ||
} | ||
function resetForm() { | ||
refForm.value?.resetValidation(); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
frontend/frontend/src/features/person/services/api/PersonClientInterface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import type PersonCreateDTO from "@/features/person/services/api/model/PersonCreateDTO"; | ||
import type PersonDTO from "@/features/person/services/api/model/PersonDTO"; | ||
import type PersonUpdateDTO from "@/features/person/services/api/model/PersonUpdateDTO"; | ||
|
||
export interface PersonClientInterface { | ||
getPersonen(): Promise<PersonDTO[]>; | ||
|
||
createPerson(person: PersonCreateDTO): Promise<PersonDTO>; | ||
|
||
deletePerson(id: string): Promise<void>; | ||
|
||
updatePerson(id: string, person: PersonUpdateDTO): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.