Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completely refactor the application #10

Open
wants to merge 55 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4d71081
[REF] Starting from scratch
miguelovila Sep 16, 2024
6f856b3
[NEW] Initialized game launcher project
miguelovila Sep 28, 2024
2cb8579
[NEW] Initialized admin dashboard project
miguelovila Sep 28, 2024
7f967af
[NEW] Initialized admin dashboard project
miguelovila Sep 28, 2024
862af43
[NEW] Database & seeding integration
miguelovila Sep 30, 2024
4bda9fc
[NEW] Integrated ShadcnUI
miguelovila Sep 30, 2024
58a06bd
add api routes for levels and users
miguelovila Oct 1, 2024
e81cbcd
add create player dialog and form (wip)
miguelovila Oct 2, 2024
1536eb6
add player creation route
miguelovila Oct 2, 2024
3db917f
add better behaviour
miguelovila Oct 2, 2024
a8093cf
improvements
miguelovila Oct 3, 2024
bff54b4
add user to database
miguelovila Oct 3, 2024
4cad44c
Fix some level names
FranciscoRibeiro03 Oct 4, 2024
66cb301
add user creation with access code feedback
miguelovila Oct 4, 2024
c5bd700
add player table to admin dashboard
miguelovila Oct 5, 2024
2189675
fix visual adjustments
miguelovila Oct 5, 2024
597d64c
Remove database from repository
FranciscoRibeiro03 Oct 5, 2024
ff5f02c
add delete user support
miguelovila Oct 5, 2024
b7426d7
Merge branches 'dev' and 'dev' of https://github.com/GLUA-UA/cstux in…
miguelovila Oct 5, 2024
b950d00
fix deleting users on cascade
miguelovila Oct 5, 2024
42961df
add livel list with pagination
miguelovila Oct 5, 2024
dedc38d
fix players table cell size
miguelovila Oct 5, 2024
e60dd89
add tournament status metrics
miguelovila Oct 5, 2024
debf00c
Add route to submit a level
FranciscoRibeiro03 Oct 5, 2024
9dc2e59
Add route to sign-in player
FranciscoRibeiro03 Oct 5, 2024
4a8dc08
update gitignore
miguelovila Oct 8, 2024
2ae85c5
add tournament state route
miguelovila Oct 8, 2024
abd5820
add api documentation
miguelovila Oct 8, 2024
9dbba70
improve api documentation
miguelovila Oct 8, 2024
af5de37
improve api documentation
miguelovila Oct 8, 2024
ddffd60
fix associate level id & prevent duplicate
miguelovila Oct 10, 2024
9abde96
add leaderboard endpoint
miguelovila Oct 10, 2024
93f8963
Merge branch 'dev' of https://github.com/GLUA-UA/cstux into dev
miguelovila Oct 10, 2024
2c9ccbf
add leaderboard route with time bonus
miguelovila Oct 11, 2024
ceba16a
fix leaderboard filtering and ordering
miguelovila Oct 11, 2024
3e6c9bb
add leaderboard table
miguelovila Oct 11, 2024
19670b1
copy client code from old branch, add server selector, change login flow
FranciscoRibeiro03 Oct 14, 2024
bda6f8f
send information to server
FranciscoRibeiro03 Oct 17, 2024
96b3585
round to 3 decimal places on leaderboard
FranciscoRibeiro03 Oct 17, 2024
fccb8d4
change submit route
FranciscoRibeiro03 Oct 19, 2024
362c01a
add bad guys and secrets count and change bonus amount
FranciscoRibeiro03 Oct 19, 2024
22d0e57
add aettua's logo
FranciscoRibeiro03 Oct 19, 2024
2cf6e8d
fix server selector warnings
FranciscoRibeiro03 Oct 19, 2024
b160abe
add start and stop tournament buttons on administration area
FranciscoRibeiro03 Oct 20, 2024
d861eda
don't overwrite user file when tournament has already been started once
FranciscoRibeiro03 Oct 20, 2024
958e1d4
don't allow submitting levels when tournament is not started
FranciscoRibeiro03 Oct 20, 2024
3cf1ab6
add boss levels to database
FranciscoRibeiro03 Oct 20, 2024
78f8116
add api endpoints to submit boss levels and get boss leaderboard
FranciscoRibeiro03 Oct 20, 2024
8c53328
add boss leaderboard table on leaderboard page
FranciscoRibeiro03 Oct 20, 2024
41c2d5a
add play button even during tournament
FranciscoRibeiro03 Oct 21, 2024
e8bad6d
submit boss level to the boss route
FranciscoRibeiro03 Oct 21, 2024
d29823b
add level number to last completed level on leaderboard
FranciscoRibeiro03 Oct 21, 2024
f849805
change boss competition to simplify client
FranciscoRibeiro03 Oct 21, 2024
3f199c9
add download from github and homepage
FranciscoRibeiro03 Oct 21, 2024
8d13789
show pretty durations instead of raw seconds
FranciscoRibeiro03 Oct 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

163 changes: 163 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Competitive SuperTux - CSTUX

## Development

### Admin Dashboard

If you haven't already installed bun, go to [bun](https://bun.sh) and follow the instructions to install it.

To setup the admin dashboard, run the following commands:

```bash
git clone https://github.com/GLUA-UA/cstux
cd cstux/admin_dashboard
git checkout dev
bun install
```

Then create a .env file in the admin_dashboard directory with the following content:

```bash
URL=http://localhost:3000
```

To start the admin dashboard (available at `http://localhost:3000`) run the following command:

```bash
bun run dev
```

These are useful commands for the database:

```bash
bun prisma migrate dev # sync the database with the models / initialize the database
bun prisma seed # reset the database and seed it with the data in the seed file
bun prisma studio # open the prisma studio to see the database
```

## Dashboard API Documentation

The base URL for all endpoints in development mode is: `http://localhost:3000`

---

### **/api/users**
#### **GET**
- **Description**: Fetches a list of all users from the database.
- **Response**: Returns a JSON array containing user data.
- **Status Codes**:
- 200: Success
- 500: Internal Server Error

#### **POST**
- **Description**: Creates a new user with a unique access code.
- **Request Body**:
```json
{
"firstName": "John",
"lastName": "Doe"
}
```
- **Response**: Returns the created user object.
- **Status Codes**:
- 201: User created successfully
- 500: Internal Server Error

#### **DELETE**
- **Description**: Deletes a user based on their ID.
- **Request Body**:
```json
{
"id": "user_id"
}
```
- **Response**: A success message if the user is deleted.
- **Status Codes**:
- 200: User deleted
- 500: Internal Server Error

---

### **/api/users/sign-in**
#### **POST**
- **Description**: Signs in a user using their unique access code and increments their login count.
- **Request Body**:
```json
{
"accessCode": "ABCDEF"
}
```
- **Response**: Returns the user data if the access code is valid.
- **Status Codes**:
- 200: Success
- 404: User not found
- 500: Internal Server Error

---

### **/api/submit**
#### **POST**
- **Description**: Submits a user's level data (time and coins collected).
- **Request Body**:
```json
{
"accessCode": "ABCDEF",
"levelInfo": {
"levelId": "level_id.stl",
"time": "3.14159",
"coins": "420.0"
}
}
```
- **Response**: Returns the created level entry for the user.
- **Status Codes**:
- 200: Success
- 404: User not found
- 500: Internal Server Error

---

### **/api/state/[state]**

List of avaliablle states:

- `tournamentStarted`, type `boolean`, default `false`

#### **GET**
- **Description**: Fetches the value of a specific state by its name.
- **URL Parameters**:
- `state`: The name of the state to fetch.
- **Response**: Returns the state data.
- **Status Codes**:
- 200: Success
- 404: State not found
- 500: Internal Server Error

#### **PATCH**
- **Description**: Updates the value of a specific state.
- **URL Parameters**:
- `state`: The name of the state to update.
- **Request Body**:
```json
{
"state": "new_value"
}
```
- **Response**: Returns the updated state data.
- **Status Codes**:
- 200: Success
- 400: Type mismatch
- 404: State not found
- 500: Internal Server Error

---

### **/api/levels**
#### **GET**
- **Description**: Retrieves a list of all levels.
- **Response**: Returns a JSON array containing level data.
- **Status Codes**:
- 200: Success
- 500: Internal Server Error

---
1 change: 1 addition & 0 deletions admin_dashboard/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
URL=http://localhost:3000
3 changes: 3 additions & 0 deletions admin_dashboard/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "next/typescript"]
}
43 changes: 43 additions & 0 deletions admin_dashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# database
*.db

# IDE
.idea
.vscode
36 changes: 36 additions & 0 deletions admin_dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
Loading