Skip to content

Commit db5129f

Browse files
committed
refactor(api): rename HealthResponse to HealthResponseDto and update handler to return DTO structure
1 parent ec43b82 commit db5129f

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
type HealthResponse {
1+
type HealthResponseDto {
22
status: String
33
timestamp: String
44
}
55

66
api Health {
77
method: GET
88
path: "/health"
9-
response: HealthResponse
9+
response: HealthResponseDto
1010
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from generated.dto.health_response_dto import HealthResponseDto
12
from generated.api.health import HealthRequest, HealthResponse
23
from generated.state import State
34
from datetime import datetime
@@ -6,4 +7,4 @@ async def handle_health(req: HealthRequest, state: State) -> HealthResponse:
67
# TODO: Implement handler logic
78
# For auto-triggers (defined in schema triggers): use state.set_payload('EventName', {...})
89
# For manual triggers: use state.trigger_event('EventName', {...})
9-
return HealthResponse(status="ok", timestamp=datetime.now().isoformat())
10+
return HealthResponse(data=HealthResponseDto(status="ok", timestamp=datetime.now().isoformat()))

examples/hello-world/src/middlewares/auth.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ async def auth_middleware(context: Dict[str, Any], state: State) -> Optional[Dic
1919
Optional[Dict[str, Any]]: Modified context with 'payload' and/or 'query_params' keys,
2020
or None to pass through unchanged. Return a dict with 'error' key to reject the request.
2121
22-
To reject the request, raise an exception
22+
To reject the request, raise an exception
2323
"""
2424
# TODO: Implement middleware logic
2525
# Example: Validate authentication
2626
# Example: Rate limiting
2727
# Example: Logging
2828
# Example: Modify payload/query_params
29-
#
29+
#
3030
# To modify the request:
3131
# return {
3232
# 'payload': modified_payload,
3333
# 'query_params': modified_query_params
3434
# }
35-
#
35+
#
3636
# To reject the request:
3737
# raise Exception('Access denied')
38-
38+
3939
# Pass through unchanged
4040
return None

0 commit comments

Comments
 (0)