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

1.0.0 #102

Merged
merged 9 commits into from
Feb 18, 2024
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Anmeldung" ADD COLUMN "comment" TEXT;
1 change: 1 addition & 0 deletions api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ model Anmeldung {
mahlzeiten Mahlzeit[]
uebernachtungsTage DateTime[] @db.Date
tshirtBestellt Boolean @default(false)
comment String?
createdAt DateTime @default(now())
}

Expand Down
1 change: 1 addition & 0 deletions api/prisma/seeders/anmeldungen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ async function create(prisma: PrismaClient, unterveranstaltung: Unterveranstaltu
status: faker.helpers.enumValue(AnmeldungStatus),
tshirtBestellt: faker.datatype.boolean(),
personId: person.id,
comment: faker.lorem.sentence(),
},
select: {
id: true,
Expand Down
21 changes: 0 additions & 21 deletions api/src/services/account/accountGliederungAdminCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ export const accountGliederungAdminCreateProcedure = defineProcedure({
protection: { type: 'public' },
inputSchema: ZAccountGliederungAdminCreateInput,
async handler(options) {
const gliederung = await prisma.gliederung.findUniqueOrThrow({
where: {
id: options.input.data.adminInGliederungId,
},
select: {
id: true,
GliederungToAccount: {
select: {
accountId: true,
role: true,
},
},
},
})

let dlrgOauthId: undefined | string = undefined
// check if jwtOAuthToken set and if so, check if it is valid
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
Expand All @@ -56,12 +41,6 @@ export const accountGliederungAdminCreateProcedure = defineProcedure({
dlrgOauthId = jwtOAuthTokenPayload.sub
}

if (gliederung.GliederungToAccount.filter((relation) => relation.role === 'DELEGATIONSLEITER').length > 0) {
throw new TRPCError({
code: 'FORBIDDEN',
message: 'Gliederung hat bereits einen Admin',
})
}
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (!options.input.data.email) {
throw new TRPCError({
Expand Down
39 changes: 38 additions & 1 deletion api/src/services/account/accountVerwaltungPatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import z from 'zod'

import prisma from '../../prisma'
import { defineProcedure } from '../../types/defineProcedure'
import logActivity from '../../util/activity'
import { sendMail } from '../../util/mail'

export const accountVerwaltungPatchProcedure = defineProcedure({
key: 'verwaltungPatch',
Expand All @@ -17,14 +19,49 @@ export const accountVerwaltungPatchProcedure = defineProcedure({
}),
}),
async handler(options) {
return prisma.account.update({
const oldAccount = await prisma.account.findUniqueOrThrow({
where: {
id: options.input.id,
},
select: {
status: true,
},
})

const account = await prisma.account.update({
where: {
id: options.input.id,
},
data: options.input.data,
select: {
id: true,
status: true,
email: true,
person: {
select: {
firstname: true,
lastname: true,
},
},
},
})

if (oldAccount.status !== account.status) {
await logActivity({
type: 'UPDATE',
description: `Account Status geändert auf ${account.status}`,
subjectType: 'account',
subjectId: account.id,
causerId: options.ctx.accountId,
})
await sendMail({
to: account.email,
subject: `Account ${account.status}`,
categories: ['account', 'status'],
html: `Hallo ${account.person.firstname} ${account.person.lastname},\n\n\nDein Accountstatus wurde auf ${account.status} geändert.\n\nViele Grüße,\nDein Orga-Team`,
})
}

return account
},
})
2 changes: 2 additions & 0 deletions api/src/services/anmeldung/anmeldungPublicCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const anmeldungPublicCreateProcedure = defineProcedure({
uebernachtungsTage: z.array(z.date()).optional(),
tshirtBestellt: z.boolean().optional(),
email: z.string().email(),
comment: z.string().optional(),
}),
}),
async handler(options) {
Expand Down Expand Up @@ -52,6 +53,7 @@ export const anmeldungPublicCreateProcedure = defineProcedure({
: undefined,
uebernachtungsTage: options.input.data.uebernachtungsTage,
tshirtBestellt: options.input.data.tshirtBestellt,
comment: options.input.data.comment,
createdAt: new Date(),
},
},
Expand Down
10 changes: 10 additions & 0 deletions chart/brahmsee-digital/templates/deployment-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ spec:
name: postgres
key: uri


# Meilisearch
- name: MEILISEARCH_HOST
value: {{ .Chart.Name }}-meilisearch-svc:7700
- name: MEILISEARCH_KEY
valueFrom:
secretKeyRef:
name: meilisearch
key: key

# readinessProbe:
# httpGet:
# path: /ready
Expand Down
2 changes: 1 addition & 1 deletion chart/brahmsee-digital/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ stringData:
---
apiVersion: v1
data:
key: {{ .Values.api.meilisearch.key | b64enc }}
key: {{ .Values.app.meilisearch.key | b64enc }}
kind: Secret
metadata:
name: meilisearch
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/BasicInputs/BasicTextArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ const props = withDefaults(
defineProps<
BasicInputDefaultProps<string> & {
cols?: number
rows?: number
}
>(),
{
cols: 3,
rows: 3,
}
)
const emit = defineEmits<{
Expand All @@ -33,6 +35,7 @@ const { model, errorMessage } = useValidationModel(props, emit)
v-model="model"
:name="id || name || label"
:cols="cols"
:rows="rows"
:placeholder="placeholder || label || name"
:rules="rules"
/>
Expand Down
52 changes: 13 additions & 39 deletions frontend/src/components/UIComponents/VeranstaltungCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
import Badge from './Badge.vue'
import Button from './Button.vue'

import { formatDate } from '@codeanker/helpers'

interface Props {
veranstaltung: {
id: number
name: string
beginn: Date
ende: Date

maxTeilnehmende: number
}
hasUnterveranstaltungen?: number
}
Expand All @@ -21,10 +27,14 @@ const { veranstaltung } = defineProps<Props>()
<h2 class="text-lg font-semibold leading-8">
{{ veranstaltung.name }}
</h2>
<p class="mt-4 text-sm leading-6">Beschreibung der Veranstaltung</p>

<p class="mt-4 text-sm leading-6">
vom {{ formatDate(veranstaltung.beginn) }} bis
{{ formatDate(veranstaltung.ende) }}
</p>
<p class="mt-6 flex items-baseline gap-x-1">
<span class="text-4xl font-bold tracking-tight">10</span>
<span class="text-sm font-semibold leading-6">/500 Plätzen</span>
<span class="text-4xl font-bold tracking-tight hidden">10</span>
<span class="text-sm font-semibold leading-6">Insgesamt {{ veranstaltung.maxTeilnehmende }} Plätze</span>
</p>
<Badge v-if="hasUnterveranstaltungen"> Ausschreibung erstellt </Badge>
<Button
Expand All @@ -36,41 +46,5 @@ const { veranstaltung } = defineProps<Props>()
class="mt-6 w-full"
>Ausschreibung erstellen</Button
>

<ul
role="list"
class="mt-8 space-y-3 text-sm leading-6"
>
<li class="flex gap-x-3">
<svg
class="h-6 w-5 flex-none text-primary-600"
viewBox="0 0 20 20"
fill="currentColor"
aria-hidden="true"
>
<path
fill-rule="evenodd"
d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"
clip-rule="evenodd"
/>
</svg>
Unterkunft und Verpflegung
</li>
<li class="flex gap-x-3">
<svg
class="h-6 w-5 flex-none text-primary-600"
viewBox="0 0 20 20"
fill="currentColor"
aria-hidden="true"
>
<path
fill-rule="evenodd"
d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"
clip-rule="evenodd"
/>
</svg>
Rahmenprogramm
</li>
</ul>
</div>
</template>
12 changes: 12 additions & 0 deletions frontend/src/components/forms/person/FormPersonGeneral.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import FormTShirtBestellungGeneral from './FormTShirtBestellungGeneral.vue'

import { apiClient } from '@/api'
import BasicCheckbox from '@/components/BasicInputs/BasicCheckbox.vue'
import BasicTextArea from '@/components/BasicInputs/BasicTextArea.vue'
import BasicTypeahead from '@/components/BasicInputs/BasicTypeahead.vue'
import Button from '@/components/UIComponents/Button.vue'
import Loading from '@/components/UIComponents/Loading.vue'
Expand All @@ -32,6 +33,7 @@ export interface FormPersonGeneralSubmit {
essgewohnheiten: IEssgewohnheiten
tshirt: ITShirtBestellung
gliederung: Gliederung
comment: string
}

type Person = Awaited<RouterOutput['person']['verwaltungGet']>
Expand Down Expand Up @@ -90,6 +92,8 @@ const essgewohnheitenForm = ref<IEssgewohnheiten>({
weitereIntoleranzen: props.person?.weitereIntoleranzen ?? [],
})

const comment = ref('')

const tshirtForm = ref<ITShirtBestellung>({
bestellen: false,
groesse: props.person?.konfektionsgroesse ?? 'JUNIOR_122_128',
Expand All @@ -109,6 +113,7 @@ const submit = () => {
essgewohnheiten: essgewohnheitenForm.value,
notfallKontakte: notfallKontakteForm.value,
tshirt: tshirtForm.value,
comment: comment.value,
})
}
</script>
Expand Down Expand Up @@ -144,6 +149,13 @@ const submit = () => {
<FormEssgewohnheitGeneral v-model="essgewohnheitenForm" />
<hr class="my-5" />

<BasicTextArea
v-model="comment"
label="Bemerkung"
:rows="3"
></BasicTextArea>
<hr class="my-5" />

<template v-if="isPublicAnmeldung">
<FormTShirtBestellungGeneral v-model="tshirtForm" />
<hr class="my-5" />
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/Dashboard/Verwaltung.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const { state: veranstaltungen } = useAsyncState(async () => {

<template>
<VeranstaltungCard
v-for="v in veranstaltungen"
:key="v.id"
:veranstaltung="v"
v-for="veranstaltung in veranstaltungen"
:key="veranstaltung.id"
:veranstaltung="veranstaltung"
/>
</template>
5 changes: 3 additions & 2 deletions frontend/src/views/Login/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ async function loginWithRecirect() {
return router.push(route.query.redirect as string)
} else {
let letzteVeranstaltung = localStorage.getItem('letzteVeranstaltung')
if (letzteVeranstaltung) return router.push(`/veranstaltung/${letzteVeranstaltung}/dashboard`)
else return router.push({ name: 'Dashboard', params: { veranstaltungId: letzteVeranstaltung } })
if (letzteVeranstaltung)
return router.push({ name: 'Dashboard', params: { veranstaltungId: letzteVeranstaltung } })
else return router.push({ name: 'Auschreibungen' })
}
}
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/PublicAnmeldung/PublicAnmeldungView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const {

tshirtBestellt: anmeldung.tshirt.bestellen,
konfektionsgroesse: anmeldung.tshirt.groesse,
comment: anmeldung.comment,
},
})
router.push('/ausschreibung/' + route.params.ausschreibungId + '/anmeldung/result')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codeanker-project",
"author": "CODEANKER GmbH",
"version": "0.0.4",
"version": "1.0.0",
"description": "",
"workspaces": [
"api",
Expand Down
Loading