Endpoint: POST /api/staff/register
Request Format (multipart/form-data):
id
: string (required)name
: string (required)phone
: string (required, format: 0812345678)nickname
: string (required)studentId
: string (required)email
: string (required)faculty
: string (optional)year
: int (optional)isCentralStaff
: boolean (optional)
Success Response (201):
{
"accessToken": "string",
"userId": "string"
}
Error Responses:
400 Bad Request
: Missing required fields or invalid phone format500 Internal Server Error
: Failed to create user
Endpoint: POST /api/student/register
Request Format (multipart/form-data):
id
: string (required)name
: string (required)phone
: string (required, format: 0812345678)email
: string (required)status
: string (optional)otherStatus
: string (optional)birthDate
: string (optional, format 2004-05-02)province
: string (optional)school
: string (optional)selectedSources
: string (comma-separated list, optional)otherSource
: string (optional)firstInterest
: string (optional)secondInterest
: string (optional)thirdInterest
: string (optional)objective
: string (optional)
example
name:John Doe
phone:0949823192
email:[email protected]
status:Study
province:Bangkok
school:CU
selectedSources:[Facebook,Website]
firstInterest:Business
secondInterest:Technology
thirdInterest:Marketing
objective:Learn for skill
id:11345677
Success Response (201):
{
"accessToken": "string",
"userId": "string"
}
Error Responses:
Same as Staff Registration
Endpoint: GET /api/users
Permissions: Bearer Token (Staff/Admin)
Query Parameters:
name
: Filter by name (optional)role
: Filter by role (member
/staff
/admin
/student
)
Success Response (200):
[
{
"id": "user1",
"name": "John Doe",
"phone": "+66812345678",
"role": "staff",
"email": "[email protected]",
"faculty": "Engineering"
}
]
Endpoint: GET /api/users/{id}
Permissions: Bearer Token
Success Response (200):
{
"id": "user1",
"name": "John Doe",
"phone": "+66812345678",
"role": "student",
"school": "Chulalongkorn University",
"firstInterest": "Technology"
}
Endpoint: PATCH /api/users/{id}
Permissions: Bearer Token
Request Body (JSON):
{
"email": "[email protected]",
"school": "New University"
}
Success Response: 204 No Content
Endpoint: POST /api/users/qr/{studentId}
Permissions: Bearer Token (Staff/Admin)
Success Response (200):
{
"id": "user1",
"name": "John Doe",
"lastEntered": "2024-01-01T12:00:00Z"
}
Error Response (400):
{
"error": "User has already entered",
"message": "2024-01-01 12:00:00 +0000 UTC"
}
Endpoint: PATCH /api/admin/addstaff/{phone}
Permissions: Bearer Token (Admin)
Success Response: 204 No Content
Endpoint: PATCH /api/admin/role/{userId}
Permissions: Bearer Token (Admin)
Success Response: 204 No Content
{
"role": "admin"
}
Endpoint: DELETE /api/admin/delete/{userId}
Permissions: Bearer Token (Admin)
Success Response: 204 No Content
Here is the updated Student Evaluation API Documentation reflecting your latest route and handler implementation:
Base URL: /api/student-evaluation
- JWT Required for all routes
- Staff/Admin Role Required for listing all evaluations
POST /api/student-evaluation/
Authorization: Bearer Token (JWT)
Role: Any authenticated user
{
"newSources": ["Instagram", "Friend"],
"overallActivity": 4,
"interestActivity": 5,
"receivedFacultyInfoClearly": 4,
"wouldRecommendCUOpenHouseNextTime": 5,
"favoriteBooth": "Engineering",
"activityDiversity": 4,
"perceivedCrowdDensity": 3,
"hasFullBoothAccess": 1,
"facilityConvenienceRating": 4,
"campusNavigationRating": 4,
"hesitationLevelAfterDisaster": 2,
"lineOASignupRating": 5,
"designBeautyRating": 4,
"websiteImprovementSuggestions": "Improve mobile responsiveness"
}
201 Created
– Evaluation successfully created.401 Unauthorized
– Missing or invalid JWT.409 Conflict
– Evaluation already exists for this user.400 Bad Request
– Invalid input.500 Internal Server Error
GET /api/student-evaluation/:id
Authorization: Bearer Token
Role: Any authenticated user
id
– Student ID
200 OK
– Returns the student evaluation.400 Bad Request
– Missing student ID.404 Not Found
– Evaluation not found.
PATCH /api/student-evaluation/:id
Authorization: Bearer Token
Role: Any authenticated user
id
– Student ID
Same structure as Create endpoint.
200 OK
– Evaluation updated.400 Bad Request
– Missing or invalid input.500 Internal Server Error
DELETE /api/student-evaluation/:id
Authorization: Bearer Token
Role: Any authenticated user
id
– Student ID
204 No Content
– Evaluation deleted.400 Bad Request
– Missing student ID.500 Internal Server Error
GET /api/student-evaluation/
Authorization: Bearer Token
Role: Staff or Admin
200 OK
– Returns a list of all student evaluations.403 Forbidden
– Insufficient role.500 Internal Server Error
Field | Type | Description |
---|---|---|
id |
string | Unique user identifier |
role |
Role | staff /admin /student |
selectedSources |
array[string] | Sources user heard about event |
faculty |
string | Staff member's faculty |
isCentralStaff |
boolean | Central committee status |
enum Role {
staff
admin
student
}
403 Forbidden (Insufficient Permissions):
{
"error": "Only admins can modify user roles"
}
404 Not Found (User Not Found):
{
"error": "User not found with ID: user123"
}