Treasure Hunt Game for orientation day.
Let's talk about the coarse architecture of this mono repo:
- PHP: We use PHP to power our servers, and Vue to power our frontend.
- Mysql : Data storage
- Vue : Frontend
- Laravel : Backend framework
TodoList
├── client # Frontend
└── backend # Backend ( laravel )
Column Name | Data Type | Propeties | Comment |
---|---|---|---|
id | BIGINT | PK AI | |
name | VARCHAR | ||
username | VARCHAR | UNIQUE | Remove space and lowercase of group name Ex: Hello World -> helloworld |
password | VARCHAR | ||
api_token | VARCHAR(100) | ||
remember_token | VARCHAR(100) | ||
created_at | TIMESTAMP | ||
updated_at | TIMESTAMP |
Column Name | Data Type | Propeties | Comment |
---|---|---|---|
id | BIGINT | PK AI | |
user_id | BIGINT | foreign key of id of users | |
group_name | VARCHAR | UNIQUE | |
created_at | TIMESTAMP | ||
updated_at | TIMESTAMP |
Column Name | Data Type | Propeties | Comment |
---|---|---|---|
id | BIGINT | PK AI | |
group_id | BIGINT | foreign key of id of groups | |
name | VARCHAR | Ex: 26377 | |
student_id | VARCHAR(5) | UNIQUE | |
created_at | TIMESTAMP | ||
updated_at | TIMESTAMP |
Column Name | Data Type | Propeties | Comment |
---|---|---|---|
id | BIGINT | PK AI | |
group_id | BIGINT | foreign key of id of groups | |
score | INTEGER | ||
created_at | TIMESTAMP | ||
updated_at | TIMESTAMP |
Column Name | Data Type | Propeties | Comment |
---|---|---|---|
id | BIGINT | PK AI | |
group_id | BIGINT | foreign key of id of groups | |
question_id | BIGINT | foreign key of id of questions | |
answer | VARCHAR | ||
score | INTEGER | ||
created_at | TIMESTAMP | ||
updated_at | TIMESTAMP |
Column Name | Data Type | Propeties | Comment |
---|---|---|---|
id | BIGINT | PK AI | |
content | VARCHAR | ||
type | TINYINTEGER | ||
answer | INTEGER | ||
score | INTEGER | ||
created_at | TIMESTAMP | ||
updated_at | TIMESTAMP |
Column Name | Data Type | Propeties | Comment |
---|---|---|---|
id | BIGINT | PK AI | |
question_id | BIGINT | PK AI | foreign key of id of questions |
place_id | BIGINT | foreign key of id of groups | |
created_at | TIMESTAMP | ||
updated_at | TIMESTAMP |
Column Name | Data Type | Propeties | Comment |
---|---|---|---|
id | BIGINT | PK AI | |
name | VARCHAR | ||
created_at | TIMESTAMP | ||
updated_at | TIMESTAMP |
POST /api/login
Request data
{
username: "[string]",
password: "[string]"
}
Response data
Code : 200
{
result: "OK"
data: {
api_token: "[string]"
}
}
Code : 403
{
result: "FAIL"
data: {
error_message: "[string]"
}
}
POST /api/register
Request data
{
group_name: "[string]",
group_members: [
{ name: "[string]", student_id: "[integer]" },
{ name: "[string]", student_id: "[integer]" },
{ name: "[string]", student_id: "[integer]" },
{ name: "[string]", student_id: "[integer]" }
]
}
Response data
Code : 200
{
result: "OK"
data: {
username: "[string]",
password: "[string]",
token: "[string]"
}
}
Code : 403
{
result: "FAIL"
data: {
error_message: "[string]"
}
}
GET /api/user
Response data
Code : 200
{
result: "OK",
data: {
group_name: "[string]",
username: "[string]",
ranking: "[string]",
score: "[integer]",
}
}
Code : 403
{
result: "FAIL"
data: {
error_message: "user haven't login"
}
}
GET /api/logout
Response data
Code : 200
{
result: "OK"
}
Code : 403
{
result: "FAIL"
data: {
error_message: "user haven't login"
}
}
GET /api/game/questions
Response data
Code : 200
{
result: "OK"
data: [
{ id: "[integer]", content: "[string]", score: "[integer]"},
{ id: "[integer]", content: "[string]", score: "[integer]"},
{ id: "[integer]", content: "[string]", score: "[integer]"},
{ id: "[integer]", content: "[string]", score: "[integer]"}
]
}
POST /api/game/question/answer
Request data
{
id: "[integer]",
answer: "[string]"
}
Response data
Code : 200
{
result: "OK"
data: {
correct: "[boolean]"
}
}
GET /api/game/scoreboard
Response data
Code : 200
{
result: "OK"
data: [
{ group_name: "[string]", score: "[string]" },
{ group_name: "[string]", score: "[string]" },
...
]
}
frontend/src
├── assets
├── layouts
├── pages
├── components
├── router # Vue Router
├── main.js
└── App.vue # Frontend vue entry
We have not developed the server. Server is not avaliable.