feat: add response examples to all hackathon and QR swagger endpoints
Each endpoint now shows a realistic JSON example (data wrapper + version) so developers can see the exact response shape without calling the API. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
e1bc336baa
commit
d014a94ea4
@@ -15,7 +15,22 @@ use uuid::Uuid;
|
||||
params(("team_id" = Uuid, Path, description = "Team ID")),
|
||||
request_body = CreateJoinRequestRequest,
|
||||
responses(
|
||||
(status = 200, description = "Create a join request"),
|
||||
(status = 200, description = "Create a join request",
|
||||
body = inline(JoinRequestResponse),
|
||||
example = json!({
|
||||
"data": {
|
||||
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
|
||||
"team_id": "7c3a1d2e-8f4b-4c5a-9d6e-1f2a3b4c5d6e",
|
||||
"user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||
"user_fullname": "Dewi Rahayu",
|
||||
"user_email": "dewi@example.com",
|
||||
"user_avatar": null,
|
||||
"message": "I would love to join your team, I have experience in backend development",
|
||||
"status": "pending",
|
||||
"created_at": "2025-01-10T00:00:00Z"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
})),
|
||||
(status = 401, description = "Unauthorized")
|
||||
),
|
||||
tag = "Hackathon - Join Requests",
|
||||
@@ -37,7 +52,23 @@ pub async fn create_join_request_handler(
|
||||
get,
|
||||
path = "/v1/hackathon/join-requests/my",
|
||||
responses(
|
||||
(status = 200, description = "Get my join requests"),
|
||||
(status = 200, description = "Get my join requests",
|
||||
example = json!({
|
||||
"data": [
|
||||
{
|
||||
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
|
||||
"team_id": "7c3a1d2e-8f4b-4c5a-9d6e-1f2a3b4c5d6e",
|
||||
"user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||
"user_fullname": "Dewi Rahayu",
|
||||
"user_email": "dewi@example.com",
|
||||
"user_avatar": null,
|
||||
"message": "I would love to join your team",
|
||||
"status": "pending",
|
||||
"created_at": "2025-01-10T00:00:00Z"
|
||||
}
|
||||
],
|
||||
"version": "0.3.0"
|
||||
})),
|
||||
(status = 401, description = "Unauthorized")
|
||||
),
|
||||
tag = "Hackathon - Join Requests",
|
||||
@@ -58,9 +89,25 @@ pub async fn get_my_join_requests_handler(
|
||||
path = "/v1/hackathon/join-requests/teams/{team_id}/pending",
|
||||
params(("team_id" = Uuid, Path, description = "Team ID")),
|
||||
responses(
|
||||
(status = 200, description = "Get pending join requests for team"),
|
||||
(status = 200, description = "Get pending join requests for team",
|
||||
example = json!({
|
||||
"data": [
|
||||
{
|
||||
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
|
||||
"team_id": "7c3a1d2e-8f4b-4c5a-9d6e-1f2a3b4c5d6e",
|
||||
"user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
||||
"user_fullname": "Dewi Rahayu",
|
||||
"user_email": "dewi@example.com",
|
||||
"user_avatar": null,
|
||||
"message": "I would love to join your team",
|
||||
"status": "pending",
|
||||
"created_at": "2025-01-10T00:00:00Z"
|
||||
}
|
||||
],
|
||||
"version": "0.3.0"
|
||||
})),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
(status = 403, description = "Forbidden")
|
||||
(status = 403, description = "Forbidden - not team leader")
|
||||
),
|
||||
tag = "Hackathon - Join Requests",
|
||||
security(("bearer_auth" = []))
|
||||
@@ -84,9 +131,10 @@ pub async fn get_team_join_requests_handler(
|
||||
params(("request_id" = Uuid, Path, description = "Join request ID")),
|
||||
request_body = RespondToJoinRequestRequest,
|
||||
responses(
|
||||
(status = 200, description = "Respond to join request"),
|
||||
(status = 200, description = "Respond to join request",
|
||||
example = json!({"message": "Join request accepted", "version": "0.3.0"})),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
(status = 403, description = "Forbidden")
|
||||
(status = 403, description = "Forbidden - not team leader")
|
||||
),
|
||||
tag = "Hackathon - Join Requests",
|
||||
security(("bearer_auth" = []))
|
||||
|
||||
Reference in New Issue
Block a user