fix(users.py): update error message to be more generic and not reveal specific reason for username unavailability

fix(AdminPage/index.tsx): fix nullish assertion for create_at and updated_at properties to avoid potential errors
fix(signUpPage/index.tsx): fix error handling to correctly display error message
fix(types/components/index.ts): make id, create_at, and updated_at properties optional in UserInputType
This commit is contained in:
anovazzi1 2023-08-29 16:44:15 -03:00
commit cf8df6c62b
4 changed files with 7 additions and 7 deletions

View file

@ -43,7 +43,7 @@ def add_user(
db.refresh(new_user)
except IntegrityError as e:
db.rollback()
raise HTTPException(status_code=400, detail="This username is unavailable as it has already been claimed. Please choose a different username.") from e
raise HTTPException(status_code=400, detail="This username is unavailable.") from e
return new_user

View file

@ -348,14 +348,14 @@ export default function AdminPage() {
</TableCell>
<TableCell className="truncate py-2 ">
{
new Date(user.create_at)
new Date(user.create_at!)
.toISOString()
.split("T")[0]
}
</TableCell>
<TableCell className="truncate py-2">
{
new Date(user.updated_at)
new Date(user.updated_at!)
.toISOString()
.split("T")[0]
}

View file

@ -51,7 +51,7 @@ export default function SignUp(): JSX.Element {
} = error;
setErrorData({
title: "Error signing up",
list: [detail[0].msg],
list: [detail],
});
return;
});

View file

@ -266,9 +266,9 @@ export type UserInputType = {
password: string;
is_active?: boolean;
is_superuser?: boolean;
id: string;
create_at: string;
updated_at:string;
id?: string;
create_at?: string;
updated_at?:string;
};
export type ApiKeyType = {