diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 380d59ef..8bb03167 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,13 @@ name: CI on: push: - branches: [development, master] + branches: + - development + - master pull_request: - branches: [development, master] + branches: + - development + - master jobs: prepare: @@ -17,13 +21,13 @@ jobs: version: ${{ steps.version.outputs.prop }} commit: ${{ steps.set-commit.outputs.commit }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: get version id: version uses: notiz-dev/github-action-json-property@v0.2.0 with: - path: 'package.json' - prop_path: 'version' + path: "package.json" + prop_path: "version" - name: set commit id: set-commit run: echo "commit=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT @@ -51,7 +55,7 @@ jobs: images: ghcr.io/codeanker/brahmsee.digital tags: type=sha,prefix= - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} @@ -59,4 +63,3 @@ jobs: build-args: | commitHash=${{needs.prepare.outputs.commit}} version=${{needs.prepare.outputs.version}} - mode=${{ env.MODE }} diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index f12e1b05..cbd99616 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -2,7 +2,12 @@ name: code-checks on: push: - branches: [main, master, development, feature/**, hotfix/**] + branches: + - main + - master + - development + - feature/** + - hotfix/** jobs: turbo-checks: @@ -10,9 +15,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Cache turbo build setup - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: .turbo key: ${{ runner.os }}-turbo-${{ github.sha }} @@ -22,13 +27,13 @@ jobs: uses: pnpm/action-setup@v4 with: run_install: false - - name: Use Node.js 18 - uses: actions/setup-node@v4 + - name: Use Node.js 22 + uses: actions/setup-node@v6 with: - node-version: 18 - cache: 'pnpm' + node-version: 22 + cache: "pnpm" - name: corepack - run: corepack enable + run: corepack enable - name: Install dependencies run: | export COREPACK_INTEGRITY_KEYS="$(curl https://registry.npmjs.org/-/npm/v1/keys | jq -c '{npm: .keys}')" diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml index fe77fc2d..7719a2c8 100644 --- a/.github/workflows/gh-release.yml +++ b/.github/workflows/gh-release.yml @@ -3,13 +3,13 @@ name: GitHub Release on: push: tags: - - 'v*.*.*' + - "v*.*.*" jobs: build: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml index 64d1ac93..5da18353 100644 --- a/.github/workflows/helm.yml +++ b/.github/workflows/helm.yml @@ -15,16 +15,17 @@ jobs: version: ${{ steps.version.outputs.prop }} commit: ${{ steps.set-commit.outputs.commit }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: get version id: version uses: notiz-dev/github-action-json-property@v0.2.0 with: - path: 'package.json' - prop_path: 'version' + path: "package.json" + prop_path: "version" - name: set commit id: set-commit run: echo "commit=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT + release: needs: prepare permissions: @@ -33,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -45,7 +46,7 @@ jobs: sed -i "s/commit: .*/commit: ${{ needs.prepare.outputs.commit }}/g" chart/brahmsee-digital/values.yaml - name: Chart | Push brahmsee-digital - uses: appany/helm-oci-chart-releaser@v0.3.0 + uses: appany/helm-oci-chart-releaser@v0.5.0 with: name: brahmsee-digital repository: codeanker/brahmsee.digital diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100755 new mode 100644 index 3dd1ddf9..3867a0fe --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -pnpm run lint +npm run lint diff --git a/apps/api/src/routes/oidc/index.ts b/apps/api/src/routes/oidc/index.ts index ceeb1765..fe904366 100644 --- a/apps/api/src/routes/oidc/index.ts +++ b/apps/api/src/routes/oidc/index.ts @@ -68,7 +68,7 @@ oidcRouter.get('/dlrg/callback', async (c) => { Authorization: `Bearer ${result.access_token}`, }, }) - const profileRaw = await userInfoResponse.json() + const profileRaw = await userInfoResponse.json() as Record const profile = ZProfile.parse(profileRaw) const existingUser = await prisma.account.findUnique({ where: { @@ -76,12 +76,6 @@ oidcRouter.get('/dlrg/callback', async (c) => { }, }) - let registerAsGliederung = false - const registerAs = c.req.query('as')?.trim() - if (registerAs !== undefined && registerAs?.length > 0) { - registerAsGliederung = true - } - let account: Account // if user exists, return jwt @@ -105,8 +99,8 @@ oidcRouter.get('/dlrg/callback', async (c) => { dlrgOauthId: profile.sub, email: profile.email, password: '', - role: registerAsGliederung ? 'GLIEDERUNG_ADMIN' : 'USER', - status: registerAsGliederung ? 'OFFEN' : 'AKTIV', + role: 'USER', + status: 'AKTIV', activatedAt: new Date(), person: { create: { @@ -120,9 +114,7 @@ oidcRouter.get('/dlrg/callback', async (c) => { }) } - // TODO: Implement onboarding - const redirectUri = new URL(registerAsGliederung ? '/onboarding' : '/login', config.clientUrl) - + const redirectUri = new URL('/login', config.clientUrl) const jwt = sign({ sub: account.id.toString(), }) diff --git a/apps/api/src/services/account/accountVerwaltungGet.ts b/apps/api/src/services/account/accountVerwaltungGet.ts index 4cd9654a..ee913896 100644 --- a/apps/api/src/services/account/accountVerwaltungGet.ts +++ b/apps/api/src/services/account/accountVerwaltungGet.ts @@ -22,6 +22,7 @@ export const accountVerwaltungGetProcedure = defineProtectedQueryProcedure({ status: true, role: true, dlrgOauthId: true, + personId: true, person: { select: { firstname: true, diff --git a/apps/api/src/services/anmeldungLink/anmeldeLink.list.ts b/apps/api/src/services/anmeldungLink/anmeldeLink.list.ts index 651739f1..21068def 100644 --- a/apps/api/src/services/anmeldungLink/anmeldeLink.list.ts +++ b/apps/api/src/services/anmeldungLink/anmeldeLink.list.ts @@ -85,6 +85,15 @@ export const anmeldungLinkListProcedure = defineProtectedQueryProcedure({ name: true, }, }, + veranstaltung: { + select: { + hostname: { + select: { + hostname: true, + } + } + } + } }, }, anmeldung: { diff --git a/apps/api/src/services/person/personList.ts b/apps/api/src/services/person/personList.ts index ae78473b..968cb94a 100644 --- a/apps/api/src/services/person/personList.ts +++ b/apps/api/src/services/person/personList.ts @@ -39,9 +39,9 @@ export const personListProcedure = defineProtectedQueryProcedure({ }, ] : undefined, - gliederung: { + gliederung: filter?.gliederung_name === undefined ? undefined : { name: { - contains: filter?.gliederung_name, + contains: filter.gliederung_name, mode: 'insensitive', }, }, @@ -58,8 +58,6 @@ export const personListProcedure = defineProtectedQueryProcedure({ const total = await prisma.person.count({ where }) const { pageIndex, pageSize, pages } = calculatePagination(total, pagination) - console.log(orderBy) - const persons = await prisma.person.findMany({ take: pageSize, skip: pageSize * pageIndex, diff --git a/apps/frontend/package.json b/apps/frontend/package.json index d403063b..773d5512 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -44,6 +44,7 @@ "radix-vue": "^1.9.5", "reka-ui": "^2.1.1", "remixicon": "^3.5.0", + "sanitize-html": "^2.17.1", "simple-syntax-highlighter": "^3.1.1", "superjson": "catalog:", "tailwind-merge": "^2.6.0", @@ -56,6 +57,7 @@ "@codeanker/eslint-config": "workspace:*", "@codeanker/typescript-config": "workspace:*", "@types/node": "catalog:", + "@types/sanitize-html": "^2.16.0", "@vitejs/plugin-basic-ssl": "^2.1.0", "@vitejs/plugin-vue": "^6.0.2", "autoprefixer": "^10.4.16", diff --git a/apps/frontend/src/components/data/AnmeldeLinkTable.vue b/apps/frontend/src/components/data/AnmeldeLinkTable.vue index fa5f80aa..1d4c5abc 100644 --- a/apps/frontend/src/components/data/AnmeldeLinkTable.vue +++ b/apps/frontend/src/components/data/AnmeldeLinkTable.vue @@ -11,7 +11,8 @@ import DataGridDoubleLineCell from '../DataGridDoubleLineCell.vue' import DataTable, { type Query } from '../Table/DataTable.vue' import initialData from '../Table/initialData' import Badge from '../UIComponents/Badge.vue' -// import Button from '../UIComponents/Button.vue' +import Button from '../UIComponents/Button.vue' +import { toast } from 'vue-sonner' type AnmeldeLink = RouterOutput['anmeldungLink']['list']['data'][number] @@ -73,13 +74,25 @@ const columns = [ }) }, }), - // column.display({ - // header: ' ', - // cell({ row }) { - // const link = `?token=${row.original.token}` - // return h(Button, {}, ['Link kopieren']) - // }, - // }), + column.display({ + header: ' ', + cell({ row }) { + if (row.original.usedAt !== null) { + return h('span', { class: 'italic'}, 'Link bereits benutzt') + } + + const hostname = row.original.unterveranstaltung.veranstaltung.hostname?.hostname ?? '' + const ausschreibung = row.original.unterveranstaltung.id + const url = `https://${hostname}/ausschreibung/${ausschreibung}/anmeldung?token=${row.original.accessToken}` + + return h(Button, { + onClick: () => { + navigator.clipboard.writeText(url) + toast.success('Link in Zwischenablage kopiert') + } + }, 'Link kopieren') + }, + }), ] const query: Query = (pagination, filter) => diff --git a/apps/frontend/src/components/data/GliederungAccessTable.vue b/apps/frontend/src/components/data/GliederungAccessTable.vue index fad32da9..d490df6d 100644 --- a/apps/frontend/src/components/data/GliederungAccessTable.vue +++ b/apps/frontend/src/components/data/GliederungAccessTable.vue @@ -40,6 +40,7 @@ const decide = useMutation({ const column = createColumnHelper() const columns = [ column.accessor('gliederung.name', { + id: 'gliederung', header: 'Gliederung', enableColumnFilter: true, enableSorting: true, diff --git a/apps/frontend/src/components/forms/account/FormAccountGeneral.vue b/apps/frontend/src/components/forms/account/FormAccountGeneral.vue index 473f5924..c64f3958 100644 --- a/apps/frontend/src/components/forms/account/FormAccountGeneral.vue +++ b/apps/frontend/src/components/forms/account/FormAccountGeneral.vue @@ -1,6 +1,7 @@