Skip to content

Commit

Permalink
fix: user's last name is not updated when update user
Browse files Browse the repository at this point in the history
Signed-off-by: Husen <[email protected]>
  • Loading branch information
heyhusen committed Sep 7, 2024
1 parent 652f28f commit 3f33f45
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"shutdownAction": "stopCompose",
"features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "1.22"
"version": "1.23"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
Expand Down
9 changes: 8 additions & 1 deletion backend/node/src/core/use-cases/update-user.use-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function updateUser(
userRepository: UserRepository,
fileService: FileService
): Promise<UserResult> {
const { first_name: firstName, nickname, email } = dto;
const { first_name: firstName, last_name: lastName, nickname, email } = dto;

let input: Partial<UserTableInput> = {};

Expand All @@ -37,6 +37,13 @@ export async function updateUser(
};
}

if (lastName) {
input = {
...input,
last_name: lastName,
};
}

if (nickname) {
input = { ...input, nickname };
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function(ctx) {
data: {
id: ctx.identity.id,
type: "users",
attributes: {
first_name: ctx.identity.traits.name.first,
Expand Down
25 changes: 12 additions & 13 deletions config/kratos/email-password/kratos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@ selfservice:
ui_url: http://127.0.0.1:4455/settings
privileged_session_max_age: 15m
required_aal: highest_available
# after:
# profile:
# hooks:
# - hook: web_hook
# config:
# url: |
# http://backend:3000/users/{ identityId }
# method: PATCH
# body: file:///etc/config/kratos/hooks/after-profile-setting.jsonnet
# response:
# ignore: true
# parse: false
after:
profile:
hooks:
- hook: web_hook
config:
url: http://app:3000/users/
method: PUT
body: file:///etc/config/kratos/hooks/after-profile-setting.jsonnet
response:
ignore: true
parse: false

recovery:
enabled: true
Expand Down Expand Up @@ -80,7 +79,7 @@ selfservice:
hooks:
- hook: web_hook
config:
url: http://backend:3000/users
url: http://app:3000/users
method: POST
body: file:///etc/config/kratos/hooks/after-registration.jsonnet
response:
Expand Down

0 comments on commit 3f33f45

Please sign in to comment.