Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"ms-ossdata.vscode-pgsql",
"GitHub.copilot",
"GitHub.vscode-pull-request-github",
"Gruntfuggly.todo-tree"
"Gruntfuggly.todo-tree",
"vitest.explorer"
],
"settings": {
"todo-tree.ripgrep.ripgrep": "/usr/bin/rg",
Expand Down Expand Up @@ -67,7 +68,8 @@
}
},
"remoteEnv": {
"DATABASE_URL": "postgresql://postgres:postgres@db:5432/teaching_api?schema=public"
"DATABASE_URL": "postgresql://postgres:postgres@db:5432/teaching_api?schema=public",
"TEST_DATABASE_URL": "postgresql://postgres:postgres@db:5432/teaching_api_test?schema=public"
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
environment:
- NODE_ENV=development
- DATABASE_URL=postgresql://postgres:postgres@db:5432/teaching_api?schema=public
- TEST_DATABASE_URL=postgresql://postgres:postgres@db:5432/teaching_api_test?schema=public
- PORT=3002

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
Expand Down
20 changes: 9 additions & 11 deletions .example.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
DATABASE_URL="postgresql://user:pw@localhost:5432/teaching_website"
USER_ID="b6651212-0765-4d1c-ba5c-71632bf53d2a"
USER_EMAIL="Max.Muster@gbsl.ch"
ALLOWED_ORIGINS="http://localhost:3000"
ALLOW_SUBDOMAINS="false"
MSAL_CLIENT_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
MSAL_TENANT_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
ADMIN_USER_GROUP_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
GITHUB_CLIENT_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
GITHUB_CLIENT_ID="xxxxxxxxxxxxxxxxxxxx"
GITHUB_REDIRECT_URI="http://localhost:3000/gh-callback"
USER_ID="<your uuid - only for local db seeding>"
USER_EMAIL="<your email - only for local db seeding>"
APP_NAME="infTeachingApi"
ALLOWED_ORIGINS="gbsl.website"
BETTER_AUTH_SECRET="$(openssl rand -base64 32)"
BETTER_AUTH_URL="http://localhost:3002"
MSAL_CLIENT_ID="<MSAL_CLIENT_ID>"
MSAL_CLIENT_SECRET="<MSAL_CLIENT_SECRET>"
MSAL_TENANT_ID="<MSAL_TENANT_ID>"
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Tests

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:17.2
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: teaching_api_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres -d teaching_api_test"
--health-interval=10s
--health-timeout=5s
--health-retries=5

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24.18'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Generate Prisma client
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/teaching_api_test?schema=public
run: yarn prisma generate

- name: Run tests
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/teaching_api_test?schema=public
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/teaching_api_test?schema=public
run: yarn test
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/dataSources.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations/dev.xml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/runConfigurations/dev_services.xml

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/runConfigurations/purge_dev_services.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/sqldialects.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/teaching-website-backend.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

Loading