FADAMIS dashboard is a web dashboard used for administrating SSPŠ camps like TechDays or HackDays. API reference below.
- Docker (instalation guide here)
git clone https://github.com/FADAMIS/dashboard
cd dashboard
make config # creates .env files containing configuration infoNow you have to edit some informations that are true to you:
- in
caddy/Caddyfileeditfadamis.liveto match your domain
# in project directory
make dockerThis builds all images and starts all containers. Every container restarts on host reboot.
When the dashboard is first started, the database will have sample data in camps, admins and foods tables.
Default admin login - admin:admin
POST /api/register
Registers a new participant
Headers:
Content-Type: application/json
| request data | data type | description |
|---|---|---|
| name | string | participant's name |
| surname | string | participant's surname |
| string | participant's email | |
| phone | string | participant's phone number |
| camp_id | int | camp's id |
JSON example
{
"name": "John",
"surname": "Smith",
"email": "[email protected]",
"phone": "777888999",
"camp_id": 1
}cURL example
curl -X POST "http://localhost/api/register" -d '{"name": "John", "surname": "Smith", "email": "[email protected]", "phone": "777888999"}' -H "Content-Type: application/json"| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"message": "register successful"
}GET /api/camp
Returns all available camps
Headers:
- None
| request data | data type |
|---|---|
| none | none |
cURL example
curl "http://localhost/api/camp"| Status code | Content Type |
|---|---|
| 200 | application/json |
date is int64 (it is stored as Unix timestamp)
Successful response
{
"camps": [
{
"id": 1,
"name": "TechDays!",
"participants": null,
"date": 1701302400,
"processed": false
}
]
}GET /api/food
Returns all available food
- Also returns ID of the specific food which is later used for participants to order said food
Headers:
- None
| request data | data type |
|---|---|
| none | none |
cURL example
curl "http://localhost/api/food"| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"foods": [
{
"id": 1,
"name": "pizza",
"participants": null,
"image_path": "/images/322989cf390c0e81fbd89727f2ee7d5f402bf652789d88229751eab26ef2e162.jpeg"
}
]
}POST /api/order/:name
Orders food for the participant specified by :name parameter
:namemust be a sha256 sum ofname+surname+camp_id- Example:
sha256(JohnSmith1)
---->
4850eecac63c272e9009385e399f958599a79d96345d2a0e3500d63e7cf2839c
---->
http://localhost/api/order/4850eecac63c272e9009385e399f958599a79d96345d2a0e3500d63e7cf2839c
Headers:
Content-Type: application/json
| request data | data type | description |
|---|---|---|
| id | int | food's ID |
| name | string | food's name |
JSON example
{
"id": 1,
"name": "Pizza Prosciutto",
}cURL example
curl -X POST "http://localhost/api/order/9d3e2c3ef4399d27897e1d918151cac74ed7b2bee028fea50d29d7d8ea3f925e" -d '{"id": 1, "name": "Pizza Prosciutto"}' -H "Content-Type: application/json"| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"food": "Pizza Prosciutto",
"name": "JohnSmith"
}POST /api/admin/login
Login endpoint for administrators
Headers:
Content-Type: application/json
| request data | data type | description |
|---|---|---|
| username | string | admin's username |
| password | string | admin's password |
JSON example
{
"username": "admin",
"password": "supersecretpassword",
}cURL example
curl -X POST "http://localhost/api/admin/login" -d '{"username": "admin", "password": "supersecretpassword"}' -H "Content-Type: application/json"| Status code | Content Type |
|---|---|
| 200 | application/json |
Sets a session cookie that expires after 6 hours
Successful response
{
"message": "login successful",
}GET /api/admin/participants
Returns all registered participants
Headers:
- None
| request data | data type |
|---|---|
| none | none |
cURL example
curl "http://localhost/api/participants"| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"participants": [
{
"id": 1,
"name": "John",
"surname": "Smith",
"email": "[email protected]",
"phone": "777888999",
"food_id": 1 // ID of ordered food
}
]
}GET /api/admin/food
Returns all available food along with all the participants with specifed food already ordered
- Also returns ID of the specific food which is later used for participants to order said food
Headers:
- None
| request data | data type |
|---|---|
| none | none |
cURL example
curl "http://localhost/api/admin/food"| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"foods": [
{
"id": 1,
"name": "none",
"participants":
[
{
"id": 1,
"name": "John",
"surname": "Smith",
"email": "[email protected]",
"phone": "777888999",
"food_id": 1
}
],
"image_path": "/images/322989cf390c0e81fbd89727f2ee7d5f402bf652789d88229751eab26ef2e162.jpeg"
}
]
}POST /api/admin/food
Adds new available food to the database
Headers:
Content-Type: multipart/form-data
| request data | data type | description |
|---|---|---|
| name | string | food's name |
| file | File | food's image |
cURL example
curl -X POST "http://localhost/api/admin/food" -F 'name=Pizza' -F 'file=@/home/admin/pizza.jpg' -H "Content-Type: multipart/form-data"Image's filename is sha256 checksum of itself + file extension
Allowed file types
- jpg
- png
| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"message": "food added",
"food": "Pizza"
}GET /api/admin/camp
Returns all (even expired) camps
Requires session cookie
Headers:
- None
| request data | data type |
|---|---|
| none | none |
cURL example
curl "http://localhost/api/admin/camp"| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"foods": [
{
"id": 1,
"name": "TechDays",
"participants":
[
{
"id": 1,
"name": "John",
"surname": "Smith",
"email": "[email protected]",
"phone": "777888999",
"food_id": 1
}
],
"date": 1701302400,
"processed": false
}
]
}POST /api/admin/camp
Adds new camp to the database
Headers:
Content-Type: application/json
| request data | data type | description |
|---|---|---|
| name | string | camp's name |
| date | int64 | camp's date as Unix timestamp |
cURL example
curl -X POST "http://localhost/api/admin/camp" -d "{'name': 'TechDays', 'date': 1701302400}" -H "Content-Type: application/json"| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"message": "camp added",
"camp": "TechDays"
}POST /api/admin/close
Closes camp registration and sends email with information.
Headers:
Content-Type: application/json
| request data | data type | description |
|---|---|---|
| id | uint | camp's ID |
| name | string | camp's name |
| date | int64 | camp's date as Unix timestamp |
cURL example
curl -X POST "http://localhost/api/admin/close" -d "{'id': 1, 'name': 'TechDays', 'date': 1701302400}" -H "Content-Type: application/json"| Status code | Content Type |
|---|---|
| 200 | application/json |
Successful response
{
"message": "camp closed",
"camp": "TechDays"
}Backend API written in Go and Gin web framework by Fabucik
Frontend by DuckyScr