🐛 Accept username in request of API delete user

This commit is contained in:
lethemanh
2025-03-22 23:38:47 +07:00
committed by Anton Shepilov
parent 1f975f1ed5
commit bebf337d28
4 changed files with 59 additions and 25 deletions
@@ -149,9 +149,12 @@ export type UserNotificationPreferences = {
};
};
export type UserPrimaryKey = Pick<User, "id">;
export type UserPrimaryKey = {
id?: uuid;
username_canonical?: string;
};
export function getInstance(user: Partial<User>): User {
user.creation_date = !isNumber(user.creation_date) ? Date.now() : user.creation_date;
user.creation_date = !isNumber(user?.creation_date) ? Date.now() : user?.creation_date;
return merge(new User(), user);
}
@@ -185,7 +185,10 @@ export class UserServiceImpl {
user: user,
});
return deleteData && (await gr.platformServices.admin.deleteUser(userCopy));
return {
isDeleted: deleteData && (await gr.platformServices.admin.deleteUser(userCopy)),
userId: user.id,
};
}
}