Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
155d7cf
Teams List
marc101101 Feb 20, 2024
94652e2
add basic select for teams
marc101101 Feb 20, 2024
6721e82
add a lot of stuff
marc101101 Feb 20, 2024
410f850
add better dashboard view
marc101101 Feb 21, 2024
e373fd0
main dashboard changes done
marc101101 Feb 21, 2024
36ff43a
add teams feature
marc101101 Feb 24, 2024
dc34aa5
add user accpet
marc101101 Feb 26, 2024
e11e957
fix linting errors
marc101101 Feb 26, 2024
cd91025
remove tsc errors
marc101101 Feb 26, 2024
337bf11
add different test db
marc101101 Feb 26, 2024
29f48a8
skip backend tests
marc101101 Feb 26, 2024
441c76d
remove unused seed
marc101101 Feb 26, 2024
37363b6
remove local images
marc101101 Feb 26, 2024
4bc0ed0
add social share
marc101101 Feb 26, 2024
f17a96c
add dialog
marc101101 Feb 26, 2024
968cff6
add comment
marc101101 Feb 26, 2024
28f1ec2
team description
marc101101 Feb 26, 2024
40a9176
add different sender
marc101101 Feb 26, 2024
f5fbe7c
fix updateTeam
marc101101 Feb 26, 2024
0fdd8fe
add fixes of review
marc101101 Feb 27, 2024
2baf73c
fix team display bug
marc101101 Mar 3, 2024
030c230
add button for register
marc101101 Mar 5, 2024
4e3c736
add header to main
marc101101 Mar 5, 2024
199496b
add email for submission
marc101101 Mar 8, 2024
1c6f02a
missing email service setting
marc101101 Mar 8, 2024
76489de
add status fix
marc101101 Mar 17, 2024
6e089e6
fix linting
marc101101 Mar 17, 2024
65b5a4a
add table rows
marc101101 Mar 19, 2024
ee54d43
add help button
marc101101 Mar 19, 2024
28bad16
add utc timestamp
marc101101 Mar 19, 2024
c3d146c
add help button 2
marc101101 Mar 19, 2024
9a6e380
small table fixes
marc101101 Mar 19, 2024
0468aca
table getting better and better
marc101101 Mar 19, 2024
4b5ccc5
remove warnings
marc101101 Mar 19, 2024
fbcfade
remove console.log
marc101101 Mar 19, 2024
173cd82
fix linitng
marc101101 Mar 19, 2024
86de137
add user limitation
marc101101 Mar 21, 2024
88ef80d
added grid to user details
marc101101 Apr 3, 2024
832d961
Remove unused import
marc101101 Apr 3, 2024
7877cc1
add teams count
marc101101 Apr 15, 2024
98fcdda
fix: team names
marc101101 Apr 30, 2024
76e6b59
add lineheight
marc101101 Apr 30, 2024
049bc5c
prettier
marc101101 Apr 30, 2024
155a18c
fix date
marc101101 May 1, 2024
235376f
update stats
marc101101 May 1, 2024
cc53590
update stats lint
marc101101 May 1, 2024
79e5743
lint
marc101101 May 1, 2024
d404507
lint
marc101101 May 1, 2024
093e298
discord link
marc101101 May 1, 2024
50b407b
fix: export user table
marc101101 May 15, 2024
34ecbaf
fix styling
marc101101 May 15, 2024
71ff3e7
wip frontend tests not working
sezanzeb Feb 27, 2025
b2dab2b
wip
sezanzeb Feb 28, 2025
d110118
wip
sezanzeb Feb 28, 2025
edf7e24
Logging before stuff happens for improved debugging, newer compilatio…
sezanzeb Mar 1, 2025
90904fd
prettier
sezanzeb Mar 1, 2025
d9a2eb4
prettier frontend
sezanzeb Mar 1, 2025
2555bf5
attempt to use newer codecov binary
sezanzeb Mar 1, 2025
53c9500
attempt to use newer codecov binary
sezanzeb Mar 1, 2025
0ba8f3b
attempt to use newer codecov binary
sezanzeb Mar 1, 2025
73f309c
attempt to use newer codecov binary
sezanzeb Mar 1, 2025
3e7d573
attempt to use newer codecov binary
sezanzeb Mar 1, 2025
9b192b7
attempt to use newer codecov binary
sezanzeb Mar 1, 2025
9ea8ce7
typescript 5, react 19
sezanzeb Mar 1, 2025
e31a40f
prettier frontend
sezanzeb Mar 1, 2025
7191ad8
disable frontend tests
sezanzeb Mar 1, 2025
931ad68
codecov binary for frontend tests
sezanzeb Mar 1, 2025
981de95
disable frontend codecov
sezanzeb Mar 1, 2025
23a66cc
disable frontend codecov
sezanzeb Mar 1, 2025
bf32d9c
remove debug ls from backend::codecov
sezanzeb Mar 2, 2025
f87c1fc
improve readme
sezanzeb Mar 17, 2025
459237c
Merge branch 'feat/teams' into chore
sezanzeb Mar 29, 2025
67fa72e
fix tests
sezanzeb Mar 29, 2025
5ad51e7
fix: standardize quotes in team entity for test environment
Mar 31, 2025
771aa9d
fix: standardize quotes in team entity for test environment
Mar 31, 2025
5612e55
fix: add 2025
Mar 31, 2025
99aab1f
fix: remove console log for test environment in team entity
Mar 31, 2025
cc5f114
fix: update team entity for consistency in test environment
Mar 31, 2025
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
Binary file modified .DS_Store
Binary file not shown.
45 changes: 25 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- name: Checkout repository
uses: actions/checkout@master

- name: Setup node.js
uses: actions/setup-node@v2
with:
Expand All @@ -41,7 +41,7 @@ jobs:

- name: Checkout repository
uses: actions/checkout@master

- name: Setup node.js
uses: actions/setup-node@v2
with:
Expand All @@ -56,19 +56,21 @@ jobs:
uses: borales/[email protected]
with:
cmd: backend::test

- name: codecov
uses: borales/[email protected]
with:
cmd: backend::codecov

# using borales/[email protected] breaks running ./codecov
run: |
curl -Os https://cli.codecov.io/latest/linux/codecov
sudo chmod +x codecov
yarn backend::codecov

frontend:
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@master

- name: Setup node.js
uses: actions/setup-node@v2
with:
Expand All @@ -84,15 +86,18 @@ jobs:
with:
cmd: frontend::typecheck

- name: test
uses: borales/[email protected]
with:
cmd: frontend::test

- name: codecov
uses: borales/[email protected]
with:
cmd: frontend::codecov
# Frontend tests are broken, incompatible with react 19 and should be rewritten
# - name: test
# uses: borales/[email protected]
# with:
# cmd: frontend::test

# - name: codecov
# # using borales/[email protected] breaks running ./codecov
# run: |
# curl -Os https://cli.codecov.io/latest/linux/codecov
# sudo chmod +x codecov
# yarn frontend::codecov

build:
runs-on: ubuntu-latest
Expand All @@ -102,15 +107,15 @@ jobs:

- name: Checkout repository
uses: actions/checkout@master

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
Expand All @@ -121,4 +126,4 @@ jobs:
push: true
tags: |
hackaburg/tilt:latest

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ db/
*.swp
frontend/bundle/
.vscode/
.idea/
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ services:
# tilt doesn't need root privileges on the database,
# therefore a regular user account and a random root
# password is the better choice
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MARIADB_RANDOM_ROOT_PASSWORD=yes
# these two don't need to be called "tilt", but this is
# a tilt example
- MYSQL_DATABASE=tilt
- MYSQL_USER=tilt
- MARIADB_DATABASE=tilt
- MARIADB_USER=tilt
# genereate a password, as this one is shown publicly
# in this repository
- MYSQL_PASSWORD=this_is_not_secure_generate_something
- MARIADB_PASSWORD=this_is_not_secure_generate_something

tilt:
image: hackaburg/tilt
Expand Down Expand Up @@ -167,13 +167,13 @@ server {
Since database takes a brief moment for its setup, start with:

```bash
$ docker-compose up tilt_mariadb
$ docker compose up tilt_mariadb
```

Then wait for MariaDB to accept incoming connections. Once this is done, you can stop `docker-compose` and start up everything with:

```bash
$ docker-compose up
$ docker compose up
```

Depending on your setup, you might want to append the `-d` flag to run the containers in the background.
Expand All @@ -187,7 +187,7 @@ With everything up and running, you usually want to configure tilt. For this, yo
Since you have access to the server running tilt, you can spawn a shell in the tilt container and invoke the [usermod script](backend/src/usermod.ts). Please note that we're using `node:alpine` as a base image and therefore don't ship Bash. This script takes two arguments, the email of the user you want to change, as well as the group you want to assign to this user. To assign the `root` group to `[email protected]`, run:

```bash
$ docker-compose exec tilt sh
$ docker compose exec tilt sh
node@container:/app$ node backend/usermod.js [email protected] root
```

Expand Down Expand Up @@ -271,21 +271,29 @@ If you found a bug or have an idea for a feature, simply [submit an issue](https
The tilt repository ships with a [docker-compose.yml](docker-compose.yml), which includes a sample setup with MariaDB, the test SMTP server [MailDev](https://github.com/maildev/maildev) and phpMyAdmin. To mimic the proxy'd setup, it also includes build instructions for a tilt container, as well as an NGINX container. You usually only need `db`, `phpmyadmin` and `maildev`, therefore it's sufficient to start them using:

```bash
$ docker-compose up db phpmyadmin maildev
docker compose up db phpmyadmin maildev
```

For local development, the backend supports reading `.env` files. Refer to [`.env.example`](backend/.env.example) for such a configuration and match the ports from the Docker Compose configuration. You can then start the backend using:
For local development, the backend supports reading `.env` files. Refer to [`.env.example`](backend/.env.example) for such a configuration and match the ports from the Docker Compose configuration.

```bash
$ yarn backend::start
cp backend/.env.example backend/.env
```

As the frontend is built in modern React, we use [Webpack](https://webpack.js.org) and its devserver to develop. The backend runs on a different port, so we need to tell the frontend how to reach the backend. This can be done through the `API_BASE_URL` environment variable. To start the frontend devserver with the backend listening on port 3000, simply provide it using:
You can then start the backend using:

```bash
$ API_BASE_URL=http://localhost:3000/api yarn frontend::start
yarn backend::start
```

As the frontend is built in modern React, we use [Webpack](https://webpack.js.org) and its devserver to develop. The frontend is available at localhost:8080. The backend runs on a different port, so we need to tell the frontend how to reach the backend. This can be done through the `API_BASE_URL` environment variable. To start the frontend devserver with the backend listening on port 3000, simply provide it using:

```bash
API_BASE_URL=http://localhost:3000/api yarn frontend::start
```

After registering, open localhost:8082 to view the verification mail.

We also provide a set of utility scripts in our [package.json](package.json)'s `script` section, such as linting, formatting and type-checking.

### Building images
Expand Down
6 changes: 3 additions & 3 deletions backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ LOG_FILENAME=tilt.log

# mail config
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_PORT=2525 # use 465 for encryption
MAIL_USERNAME=root@localhost
MAIL_PASSWORD=password

# mariadb database connection config
DATABASE_NAME=tilt
DATABASE_USERNAME=root
DATABASE_PASSWORD=password
DATABASE_USERNAME=tilt
DATABASE_PASSWORD=this_is_not_secure_generate_something
DATABASE_PORT=3306
DATABASE_HOST=localhost

Expand Down
115 changes: 115 additions & 0 deletions backend/src/controllers/application-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
JsonController,
NotAcceptableError,
NotFoundError,
Param,
Post,
Put,
} from "routing-controllers";
Expand Down Expand Up @@ -39,7 +40,14 @@ import {
IDsRequestDTO,
QuestionDTO,
StoreAnswersRequestDTO,
SuccessResponseDTO,
TeamDTO,
TeamRequestDTO,
TeamResponseDTO,
TeamUpdateDTO,
} from "./dto";
import { ITeamService, TeamServiceToken } from "../services/team-service";
import { Team } from "../entities/team";

@JsonController("/application")
export class ApplicationController {
Expand All @@ -48,6 +56,8 @@ export class ApplicationController {
private readonly _application: IApplicationService,
@Inject(UserServiceToken)
private readonly _users: IUserService,
@Inject(TeamServiceToken)
private readonly _teams: ITeamService,
) {}

/**
Expand Down Expand Up @@ -232,4 +242,109 @@ export class ApplicationController {

await this._application.checkIn(user);
}

/**
* Gets all existing teams.
*/
@Get("/team")
@Authorized(UserRole.User)
public async getAllTeams(): Promise<readonly TeamDTO[]> {
const teams = await this._teams.getAllTeams();
return teams.map((team) => convertBetweenEntityAndDTO(team, TeamDTO));
}

/**
* Creates a team.
*/
@Post("/team")
@Authorized(UserRole.User)
public async createTeam(
@Body() { data: teamDTO }: { data: TeamRequestDTO },
): Promise<TeamDTO> {
const team = convertBetweenEntityAndDTO(teamDTO, Team);
const createdTeam = await this._teams.createTeam(team);
return convertBetweenEntityAndDTO(createdTeam, TeamDTO);
}

/**
* Update a team.
*/
@Put("/team")
@Authorized(UserRole.User)
public async updateTeam(
@Body() { data: teamDTO }: { data: TeamUpdateDTO },
@CurrentUser() user: User,
): Promise<TeamDTO> {
const team = convertBetweenEntityAndDTO(teamDTO, Team);
const updateTeam = await this._teams.updateTeam(team, user);
return convertBetweenEntityAndDTO(updateTeam, TeamDTO);
}

/**
* Request to join a team.
* @param teamId The id of the team
*/
@Post("/team/:id/request")
@Authorized(UserRole.User)
public async requestToJoinTeam(
@Param("id") teamId: number,
@CurrentUser() user: User,
): Promise<SuccessResponseDTO> {
await this._teams.requestToJoinTeam(teamId, user);
const response = new SuccessResponseDTO();
response.success = true;
return response;
}

/**
* Accept a user to a team.
* @param teamId The id of the team
* @param userId The id of the user
*/
@Put("/team/:teamId/accept/:userId")
@Authorized(UserRole.User)
public async acceptUserToTeam(
@Param("teamId") teamId: number,
@Param("userId") userId: number,
@CurrentUser() user: User,
): Promise<SuccessResponseDTO> {
await this._teams.acceptUserToTeam(teamId, userId, user);
const response = new SuccessResponseDTO();
response.success = true;
return response;
}

/**
* Get team by id.
* @param id The id of the team
*/
@Get("/team/:id")
@Authorized(UserRole.User)
public async getTeamByID(
@Param("id") teamId: number,
): Promise<TeamResponseDTO> {
const team = await this._teams.getTeamByID(teamId);

if (team == null) {
throw new NotFoundError(`no team with id ${teamId}`);
}

return team;
}

/**
* Delete a team by id
* @param id The id of the team
*/
@Delete("/team/:id")
@Authorized(UserRole.User)
public async deleteTeamByID(
@Param("id") teamId: number,
@CurrentUser() user: User,
): Promise<SuccessResponseDTO> {
await this._teams.deleteTeamByID(teamId, user);
const response = new SuccessResponseDTO();
response.success = true;
return response;
}
}
Loading
Loading