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

Merge dev in main #540

Merged
merged 24 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
495b23f
Bump @formkit/themes from 1.0.0-beta.9-f64c966 to 1.1.0 (#480)
dependabot[bot] Sep 21, 2023
fa703e2
Bump docker/login-action from 2 to 3 (#463)
dependabot[bot] Sep 21, 2023
b15c8f4
Bump docker/build-push-action from 4 to 5 (#462)
dependabot[bot] Sep 21, 2023
97088ce
Bump @tailwindcss/typography from 0.5.9 to 0.5.10 (#461)
dependabot[bot] Sep 21, 2023
36a87a1
Revert "Bump docker/login-action from 2 to 3 (#463)" (#482)
TitusKirch Sep 21, 2023
3a02d04
Bump @formkit/vue from 1.0.0-beta.9-f64c966 to 1.1.0 (#479)
dependabot[bot] Sep 21, 2023
cf3cb93
Bump @formkit/addons from 1.0.0-beta.9-f64c966 to 1.1.0 (#478)
dependabot[bot] Sep 21, 2023
fee962e
fix(readme): kubernetes link (#506)
simonostendorf Oct 20, 2023
c415383
feat(readme): add devcontainer section (#507)
simonostendorf Oct 20, 2023
9406f39
feat(deploy): add aws s3 (#508)
simonostendorf Oct 20, 2023
fa63d92
Titus tasks for gerolstein (#512)
TitusKirch Oct 20, 2023
6fb0119
feat(github_actions): add docker e2e test (#513)
simonostendorf Oct 20, 2023
a712eaf
update(docker): roadrunner (#519)
simonostendorf Oct 24, 2023
16a3ff1
fix(database/seeders): invalid and missing seeders (#520)
simonostendorf Oct 24, 2023
fbcd4b0
feat(database/seeders/tutor): switch delimiter and add disabled (#521)
simonostendorf Oct 25, 2023
64c84d7
Fix/darkmode (#533)
TitusKirch Oct 29, 2023
9e03851
Feat/phil frontend (#532)
PhilPinsdorf Oct 29, 2023
c22520c
Feat/add score system (#534)
TitusKirch Oct 29, 2023
2ac9044
feat/add user delete feature (#536)
TitusKirch Oct 29, 2023
e727bae
Feat/update authors in readme md #335 (#432)
TitusKirch Oct 29, 2023
8c4fb0d
Changed Gif (#537)
PhilPinsdorf Oct 29, 2023
ccd1a36
Feat/improve audio (#538)
TitusKirch Oct 29, 2023
431fd8f
Update event data (#539)
TitusKirch Oct 29, 2023
be804fb
Fix/hotfix 1 (#542)
TitusKirch Oct 30, 2023
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
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://aka.ms/devcontainer.json
{
"name": "Laravel Sail",
"dockerComposeFile": ["../docker-compose.yml"],
"dockerComposeFile": ["../docker-compose.sail.yaml"],
"service": "laravel.test",
"workspaceFolder": "/var/www/html",
"customizations": {
Expand All @@ -20,7 +20,8 @@
"neilbrayfield.php-docblocker",
"steoates.autoimport",
"Vue.volar",
"xdebug.php-debug"
"xdebug.php-debug",
"github.copilot"
],
"settings": {}
}
Expand Down
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ APP_URL=http://localhost
APP_FORCE_HTTPS=false
APP_EVENT_TYPE=demo

APP_PUBLIC_API_SECRET=secret

TUTOR_PASSWORD=password
ADMIN_PASSWORD=admin

Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/docker-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Docker e2e Test

on:
pull_request: {}

env:
IMAGE_REGISTRY: ghcr.io
IMAGE_PATH: ${{ github.repository }}
IMAGE_TAG: ${{ github.ref_name }}

jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Image
uses: docker/build-push-action@v5
with:
push: false
load: true
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_PATH }}:latest
- name: Create Environment
run: |
cat > .env << EOF
APP_NAME="Erstiwoche FB5"
APP_ENV=local
APP_KEY=1234567890ABCDEFGHIJ1234567890AB
APP_DEBUG=true
APP_URL=http://localhost
APP_FORCE_HTTPS=false
APP_EVENT_TYPE=demo
TUTOR_PASSWORD=password
ADMIN_PASSWORD=admin
LOG_CHANNEL=stack
LOG_LEVEL=debug
BROADCAST_DRIVER=log
CACHE_DRIVER=file # TODO
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file # TODO
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
OCTANE_HTTPS=false
OCTANE_WORKERS=1
OCTANE_MAX_REQUESTS=512
WWWGROUP=1000
WWWUSER=1000
OCTANE_SERVER=roadrunner
EOF
- name: Run Image
uses: isbang/compose-action@v1.5.1
with:
compose-file: "docker-compose.yaml"
down-flags: "--volumes"
- name: Wait
run: |
# wait 10 seconds for the docker container to start
sleep 10
- name: Run DB Seed
run: |
# run "php artisan migrate:fresh --seed" inside docker container
docker exec portals-web php artisan migrate:fresh --seed
- name: Debug
run: |
curl http://localhost:8000
- name: Test reachable
run: |
# test every 10 seconds if http://localhost:8000 is reachable and has a OK status code. Timeout after 2 minutes
timeout 120 bash -c 'until curl --output /dev/null --silent --head --fail http://localhost:8000; do printf "."; sleep 10; done'
6 changes: 3 additions & 3 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (latest release)
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: ${{ github.event_name == 'release' && steps.latest_release.outputs.release == github.ref_name }} # run only on latest release
with:
push: true
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_PATH }}:${{ env.IMAGE_TAG }}, ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_PATH }}:latest
- name: Build and push (release)
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: ${{ github.event_name == 'release' && steps.latest_release.outputs.release != github.ref_name }} # run only on release (not latest)
with:
push: true
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_PATH }}:${{ env.IMAGE_TAG }}
- name: Build and push (push)
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: ${{ github.event_name == 'push' }} # run only on push (to dev)
with:
push: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# STAGE 1.1: Build JS with node
# --------------------------------------------

FROM ghcr.io/roadrunner-server/roadrunner:2023.2.2 AS roadrunner
FROM ghcr.io/roadrunner-server/roadrunner:2023.3.2 AS roadrunner
FROM node:16-alpine as node
WORKDIR /app

Expand Down
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ and the vite dev server:
npm run dev
```

### devcontainer

If you want to use the provided devcontainer via laravel sail you need vscode and the devcontainer extension.

### type generation

To generate the typescript types for the frontend, run:
Expand Down Expand Up @@ -139,7 +143,7 @@ docker exec -it portals-web php artisan migrate:fresh --seed

You can deploy the application to kubernetes using the helm chart.

See [fsr5-fhaachen/charts/portals](github.com/fsr5-fhaachen/charts/charts/portals/) for more information.
See [fsr5-fhaachen/charts/portals](https://github.com/fsr5-fhaachen/charts/tree/main/charts/portals) for more information.

If you want information about creating the kubernetes cluster, see [deploy information](./deploy).

Expand All @@ -150,22 +154,30 @@ If you want information about creating the kubernetes cluster, see [deploy infor
- Website: https://tkirch.dev/
- LinkedIn: [Titus Kirch](https://www.linkedin.com/in/tituskirch/)
- Twitter: [@TitusKirch](https://twitter.com/TitusKirch)
- Github: [@TitusKirch](https://github.com/TitusKirch)
- GitHub: [@TitusKirch](https://github.com/TitusKirch)

👤 **Benedikt Haas (main author)**

- LinkedIn: [Benedikt Haas](https://www.linkedin.com/in/benedikt-haas-ab698924a/)
- Github: [@BenediktHaas96](https://github.com/BenediktHaas96)
- GitHub: [@BenediktHaas96](https://github.com/BenediktHaas96)

👤 **Simon Ostendorf**

- LinkedIn: [Simon Ostendorf](https://www.linkedin.com/in/simonostendorf/)
- Github: [@simonostendorf](https://github.com/simonostendorf)
- GitHub: [@simonostendorf](https://github.com/simonostendorf)

👤 **Martin Philemon Pinsdorf**

- GitHub: [@PhilPinsdorf](https://github.com/PhilPinsdorf)

👤 **Vitor Macedo**

- GitHub: [@DontEdit](https://github.com/DontEdit)

👤 **Patrik Schmolke**

- LinkedIn: [Patrik Schmolke](https://www.linkedin.com/in/patrik-schmolke-612962175/)
- Github: [@Rec0gnice](https://github.com/Rec0gnice)
- GitHub: [@Rec0gnice](https://github.com/Rec0gnice)

Show here to see the full list of [contributors](https://github.com/fsr5-fhaachen/portals/graphs/contributors) who participated in this project.

Expand Down
76 changes: 74 additions & 2 deletions app/Http/Controllers/Api/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use App\Models\Course;
use App\Models\Event;
use App\Models\Registration;
use App\Models\State;
use App\Models\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

Expand Down Expand Up @@ -211,7 +213,7 @@ public function coursesUserAmount(): JsonResponse
foreach ($courses as $course) {
$result[] = [
'id' => $course->id,
'amount' => $course->users()->where('is_tutor', false)->count(),
'amount' => $course->users()->doesntHave('roles')->count(),
];
}

Expand Down Expand Up @@ -242,10 +244,80 @@ public function coursesUserAmountPerEvent(Request $request): JsonResponse
foreach ($courses as $course) {
$result[] = [
'id' => $course->id,
'amount' => $course->users()->where('is_tutor', false)->whereIn('id', $userIds)->count(),
'amount' => $course->users()->doesntHave('roles')->whereIn('id', $userIds)->count(),
];
}

return response()->json($result);
}

/**
* Return the current state of the random generator.
* The state is structured like this:
* {
* "state": "setup", // setup, idle, running, stopped
* "user": null | User, // default null and if stopped, the user that was selected by the random generator
* }
*
* The definition of the states is as follows:
* setup: The random generator is not set up yet
* idle: The random generator is set up, but not running yet
* running: The random generator is running
* stopped: The random generator is stopped and a user was selected
*/
public function randomGeneratorState(): JsonResponse
{
// get state with key randomGenerator
$state = State::where('key', 'randomGenerator')->first();

// if state does not exist, return setup
if (! $state) {
return response()->json([
'state' => 'setup',
]);
}

return response()->json(json_decode($state->value));
}

/**
* Return the current state of the score system.
* The state is structured like this:
* {
* "teams": {
* "name": string;
* "score": string;
* }[];
* }
*/
public function scoreSystemState(): JsonResponse
{
// get state with key scoreSystem
$state = State::where('key', 'scoreSystem')->first();

// if state does not exist, return setup
if (! $state) {
return response()->json([
'teams' => [],
]);
}

return response()->json(json_decode($state->value));
}

/**
* Fresh users data
*/
public function users(): JsonResponse
{
$users = User::with('course', 'roles')->get()->map(function ($user) {
$user->avatarUrl = $user->avatarUrl();

return $user;
});

return response()->json([
'users' => $users,
]);
}
}
28 changes: 28 additions & 0 deletions app/Http/Controllers/Api/PublicApiController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\JsonResponse;

class PublicApiController extends Controller
{
/**
* Returns all users.
*/
public function users(): JsonResponse
{
// get all users and get execute avatarUrl
$users = User::with('course', 'roles')->get()->map(function ($user) {
$user->avatarUrl = $user->avatarUrl();

return $user;
});

return response()->json([
'success' => true,
'users' => $users,
]);
}
}
Loading
Loading