Phase 4.2 — User API handlers (Medium)
Fill in the handler bodies in backend/src/api/mod.rs. Claude provides the function signatures.
Handlers to implement
// GET /api/v1/users
async fn list_users(State(pool): State<PgPool>) -> impl IntoResponse
// POST /api/v1/users
async fn create_user(
State(pool): State<PgPool>,
Json(req): Json<CreateUserRequest>,
) -> impl IntoResponse
// GET /api/v1/users/:id
async fn get_user(
State(pool): State<PgPool>,
Path(id): Path<i64>,
) -> impl IntoResponse
Each handler should:
- Call the corresponding
UserService method
- Return
Json(ApiResponse { data: result }) on success
- Return an appropriate error via
AppError on failure
Prerequisite: Phase 3 models + Phase 4.1 UserService must be complete.
Done when: curl -X POST localhost:3000/api/v1/users ... returns a User JSON object.
Phase 4.2 — User API handlers (Medium)
Fill in the handler bodies in
backend/src/api/mod.rs. Claude provides the function signatures.Handlers to implement
Each handler should:
UserServicemethodJson(ApiResponse { data: result })on successAppErroron failurePrerequisite: Phase 3 models + Phase 4.1 UserService must be complete.
Done when:
curl -X POST localhost:3000/api/v1/users ...returns a User JSON object.