-
Login:
/api/auth/login
( organization / user )- Method: POST
- Request Body:
{ "email": "[email protected]", "password": "password123" }
Response:
{ "message": "User authenticated successfully", "statusCode": 200, "data": { "access_token": "your-auth-token-here", "email": "[email protected]", "id": "random_id", "isAdmin": false } }
-
User Signup:
/api/auth/user/signup
( organization only )-
Method: POST
-
Request Body:
{ "email": "[email protected]", "password": "password123", "first_name": "John", "last_name": "Doe", "phonenumber": "1234567890" }
-
Response :
{ "message": "User created successfully", "statusCode": 201 }
-
-
Create Organization:
/api/organization/create
- Method: POST
- Headers:
Authorization: Bearer <access_token>
- Request Body:
- lunch_price (decimal nullable) - Defaults to 1000.
- organization_name (string required) - Name of the organisation
{ "organization_name": "HNG", "lunch_price": 1000 }
- Response :
{ "message": "Organisation created successfully", "statusCode": 201 }
-
Create Organization Invite (Admin Only)
-
Endpoint:
/api/organization/invite
-
Method: POST
-
Headers:
Authorization: Bearer <access_token>
-
Description: Allows an admin user to send an invitation to join the organization.
-
Request Body:
{ "email": "[email protected]" }
-
Response Body:
{ "message": "success", "statusCode": 200, "data": null }
-
-
Staff Signup:
/api/organization/staff/signup
( Staff only )-
Method: POST
-
Description: A 6 digit
OTP
code would be sent to user email during invitation, the token sent would be used within theotp_token
field -
Request Body:
{ "email": "[email protected]", "password": "password123", "otp_token": 134256, "first_name": "John", "last_name": "Doe", "phonenumber": "1234567890" }
Response:
{ "message": "Staff created successfully", "statusCode": 201, "data": { "email": "[email protected]", "password": "password123", "otp_token": 134256, "first_name": "John", "last_name": "Doe", "phonenumber": "1234567890" } }
-
-
Endpoint:
/api/user/profile
-
Method: GET
-
Headers:
Authorization: Bearer <access_token>
-
Response:
{ "message": "User data fetched successfully", "statusCode": 200, "data": { "first_name": "John", "last_name": "Doe", "phonenumber": "1234567890", "email": "[email protected]", "profile_picture": "user-profile-picture-url", "bank_number": "1234-5678-9012-3456", "bank_code": "123456", "bank_name": "Bank Name", "isAdmin": true } }
-
-
Add Bank Account:
/api/user/bank
-
Method: POST
-
Headers:
Authorization: Bearer <access_token>
-
Request Body:
{ "bank_number": "1234-5678-9012-3456", "bank_code": "123456", "bank_name": "Bank Name" }
-
Response :
{ "message": "successfully created bank account", "statusCode": 200 }
-
-
Get all Users:
/api/users
-
Method: GET
-
Headers:
Authorization: Bearer <access_token>
-
Request Body: None
-
Response :
{ "message": "successfully created bank account", "statusCode": 200, "data": [ { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "profile_picture": "user-profile-picture-url", "user_id": "" }, { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "profile_picture": "user-profile-picture-url", "user_id": "" } ] }
-
-
Search Users:
/api/search/:param
- Method: GET
- Headers:
Authorization: Bearer <access_token>
- Parameters:
name|email
(path parameter, string) - The Name or Email of the person to search.
- Request Body: None
- Response :
{ "message": "User found", "statusCode": 200, "data": { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "profile_picture": "user-profile-picture-url", "user_id": "" } }
-
Send a Lunch
Endpoint:
/api/lunch/send
-
Method: POST
-
Description: Create a new lunch request.
-
Headers:
Authorization: Bearer <access_token>
-
Request Body:
{ "receivers": ["user_id"], "quantity": 5, "note": "Special instructions for the lunch" }
Response:
{ "message": "Lunch request created successfully", "statusCode": 201, "data": {} }
-
-
Get a Lunch
Endpoint:
/api/lunch/:id
-
Method: GET
-
Description: Get a specific lunch
-
Headers:
Authorization: Bearer <access_token>
-
Parameters:
id
(path parameter, integer) - The ID of the lunch.
-
Request Body: None
Response:
{ "message": "Lunch request fetched successfully", "statusCode": 200, "data": { "receiverId": "", "senderId": "", "quantity": 5, "redeemed": false, "note": "Special instructions for the lunch", "created_at": "", "id": "" } }
{ "message": "Lunch not found", "statusCode": 404 }
-
-
Get all Lunches
Endpoint:
/api/lunch/all
-
Method: GET
-
Description: Get all lunch requests available for that user
-
Headers:
Authorization: Bearer <access_token>
-
Request Body: None
Response:
{ "message": "Lunch requests fetched successfully", "statusCode": 200, "data": [ { "receiverId": 2, "senderId": 1, "quantity": 5, "redeemed": false, "note": "Special instructions for the lunch", "created_at": "", "id": 1 }, { "receiverId": 1, "senderId": 2, "quantity": 5, "redeemed": false, "note": "Special instructions for the lunch", "created_at": "", "id": 2 } ] }
-
-
Endpoint:
/api/withdrawal/request
- Method: POST
- Description: Create a withdrawal request.
- Headers:
Authorization: Bearer <access_token>
- Request Body:
{ "bank_name": "bank", "bank_number": "232113445", "bank_code": "1234", "amount": 100 }
Response:
{ "message": "Withdrawal request created successfully", "statusCode": 201, "data": { "id": "unique-withdrawal-id", "user_id": "user-id", "status": "success", "amount": 100, "created_at": "2023-09-19T12:00:00Z" } }