Skip to main content

Activity

Overview

The activity module manages sport and activity types (e.g., Badminton, Volleyball) that serve as lookup references for other modules such as Venue, Skill Levels, and the per-activity skill selections captured during onboarding (see Me).

Each activity has a database-generated referenceId — a stable integer identifier used for cross-referencing. Skill levels are scoped per activity, and users select at most one skill level per activity during onboarding.

Data Model

FieldTypeDescription
idUUIDAuto-generated primary key
referenceIdintegerAuto-generated unique integer identifier (database-managed, read-only)
namestringActivity name, e.g. Badminton (unique, max 100 chars)
createdAttimestampRecord creation time
updatedAttimestampLast update time

API Contract

All endpoints are under /api/v1/activities. The GET endpoints (list and by ID) are public (no JWT required, rate-limited); POST, PUT, and DELETE require a valid JWT. Responses are wrapped in a standard ApiResponse envelope:

{
"success": true,
"data": { ... },
"message": "...",
"timestamp": "2026-04-06T12:00:00Z",
"path": "/api/v1/activities"
}

GET /api/v1/activities

Returns all activities.

cURL

curl -X GET http://localhost:8080/api/v1/activities \
-H "Authorization: Bearer <TOKEN>"

Response 200 OK

{
"success": true,
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"referenceId": 1,
"name": "Badminton"
},
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"referenceId": 2,
"name": "Volleyball"
}
],
"message": "Activities retrieved successfully.",
"timestamp": "2026-04-06T12:00:00Z",
"path": "/api/v1/activities"
}

GET /api/v1/activities/{id}

Returns a single activity by UUID.

cURL

curl -X GET http://localhost:8080/api/v1/activities/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer <TOKEN>"

Response 200 OK

{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"referenceId": 1,
"name": "Badminton"
},
"message": "Activity retrieved successfully.",
"timestamp": "2026-04-06T12:00:00Z",
"path": "/api/v1/activities/550e8400-e29b-41d4-a716-446655440000"
}

POST /api/v1/activities

Creates a new activity.

cURL

curl -X POST http://localhost:8080/api/v1/activities \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "Volleyball"
}'

Request body

{
"name": "Volleyball"
}
FieldTypeValidation
namestringRequired, non-blank, unique

Response 201 Created

{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440002",
"referenceId": 3,
"name": "Volleyball"
},
"message": "Activity created successfully.",
"timestamp": "2026-04-06T12:00:00Z",
"path": "/api/v1/activities"
}

PUT /api/v1/activities/{id}

Updates an existing activity.

cURL

curl -X PUT http://localhost:8080/api/v1/activities/550e8400-e29b-41d4-a716-446655440002 \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "Tennis"
}'

Request body

{
"name": "Tennis"
}
FieldTypeValidation
namestringRequired, non-blank, unique

Response 200 OK

{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440002",
"referenceId": 3,
"name": "Tennis"
},
"message": "Activity updated successfully.",
"timestamp": "2026-04-06T12:00:00Z",
"path": "/api/v1/activities/550e8400-e29b-41d4-a716-446655440002"
}

DELETE /api/v1/activities/{id}

Deletes an activity.

cURL

curl -X DELETE http://localhost:8080/api/v1/activities/550e8400-e29b-41d4-a716-446655440002 \
-H "Authorization: Bearer <TOKEN>"

Response 204 No Content

No response body.

Skill levels for an activity

Skill levels are served by a dedicated module — see GET /api/v1/skill-levels?activityId=....

Error Handling

ScenarioHTTP StatusError CodeClient Behavior
Activity not found404Show error
Activity name already exists409ACTIVITY_ALREADY_EXISTSHighlight duplicate name
Missing or blank name400Validation errorHighlight invalid field
Auth token expired / missing401Redirect to login
Server error500Show retry prompt