GET /api/transactions
Description: Fetches all transactions.
Response: JSON array of transactions.
GET /api/transaction/{id}
Description: Fetches a transaction by its ID.
Parameters:
id
: Transaction ID (integer)
Response: Transaction details.
POST /api/signup
Description: Registers a new user.
Request Body:
{
"student_id": "string",
"name": "string",
"password": "string"
}
Response: User creation confirmation or error message. Note: default Balance=0, Role=member
POST /api/signin
Description: Logs in a user and returns a JWT token.
Request Body:
{
"student_id": "string",
"password": "string"
}
Response: JWT token for authenticated access.
GET /api/user
Description: Fetches information about the authenticated user.
Authentication: Requires Bearer token.
Response: User details.
POST /api/transfer
Description: Transfers Cubs Coins to another user.
Request Body:
{
"receiver": "string",
"amount": number
}
Response: Transfer confirmation or error message.
POST /api/transaction/create
Description: Creates a new transaction between two users.
Request Body:
{
"sender": "string",
"receiver": "string",
"amount": number
}
Response: Transaction creation confirmation or error message.
GET /api/users
Description: Fetches a list of all users.
Response: JSON array of user details.
GET /api/user/{id}
Description: Fetches a user's details by their ID.
Parameters:
id
: User ID (integer)
Response: User details.
POST /api/user/create
Description: Creates a new user.
Request Body:
{
"student_id": "string",
"name": "string",
"password": "string"
}
Response: User creation confirmation or error message.
PATCH /api/changetoadmin/{id}
Description: Changes a user's role to "admin".
Authentication: Requires Bearer token (admin privileges).
Parameters:
id
: User ID (integer)
Response: Role change confirmation or error message.
PATCH /api/changetomember/{id}
Description: Changes a user's role to "member".
Authentication: Requires Bearer token (admin privileges).
Parameters:
id
: User ID (integer)
Response: Role change confirmation or error message.
- Chayoot Kositwanich