Skip to content

Commit 5cc3ef8

Browse files
committed
fix: serialize entity ids as integers in response schemas
1 parent 486be9d commit 5cc3ef8

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/modules/api_key/presentation/schemas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CreateApiKeyRequest(BaseModel):
1111

1212

1313
class ApiKeyResponse(BaseModel):
14-
id: str
14+
id: int
1515
key_prefix: str
1616
name: str
1717
permissions: list[str]
@@ -22,7 +22,7 @@ class ApiKeyResponse(BaseModel):
2222

2323

2424
class ApiKeyCreatedResponse(BaseModel):
25-
id: str
25+
id: int
2626
name: str
2727
key_prefix: str
2828
key: str

src/modules/authorization/presentation/routers/permission_router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def _permission_response(permission: Permission | None) -> PermissionResponse:
199199
if permission is None:
200200
raise HTTPException(status_code=404, detail="Permission not found")
201201
return PermissionResponse(
202-
id=str(permission.id),
202+
id=permission.id,
203203
key=permission.key,
204204
resource=permission.resource,
205205
action=permission.action,

src/modules/authorization/presentation/routers/role_router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def _role_response(role: Role | None) -> RoleResponse:
214214
raise HTTPException(status_code=404, detail="Role not found")
215215

216216
return RoleResponse(
217-
id=str(role.id),
217+
id=role.id,
218218
name=role.name,
219219
description=role.description,
220220
created_at=role.created_at,

src/modules/authorization/presentation/schema/response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33

44
class RoleResponse(BaseModel):
5-
id: str
5+
id: int
66
name: str
77
description: str | None
88
created_at: str
99
updated_at: str
1010

1111

1212
class PermissionResponse(BaseModel):
13-
id: str
13+
id: int
1414
key: str
1515
resource: str
1616
action: str

src/modules/todo/application/detail_todo/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def execute(self, todo_id: int, user_id: int) -> TodoWithOwnerResponse:
3131
raise UserNotFoundError("Todo owner not found")
3232

3333
return TodoWithOwnerResponse(
34-
id=str(todo.id),
34+
id=todo.id,
3535
title=todo.title,
3636
description=todo.description,
3737
is_completed=todo.is_completed,

src/modules/todo/presentation/schemas/response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55

66
class TodoResponse(BaseModel):
7-
id: str
7+
id: int
88
title: str
99
is_completed: bool
1010

1111

1212
class TodoWithOwnerResponse(BaseModel):
13-
id: str
13+
id: int
1414
title: str
1515
description: str | None = None
1616
is_completed: bool

0 commit comments

Comments
 (0)