remove appointment from events

This commit is contained in:
PxlLoewe
2026-01-18 01:09:39 +01:00
parent 606379d151
commit 9129652912
22 changed files with 105 additions and 1133 deletions

View File

@@ -5,33 +5,17 @@ enum EVENT_TYPE {
EVENT
}
model EventAppointment {
id Int @id @default(autoincrement())
eventId Int
appointmentDate DateTime
presenterId String
// relations:
Users User[] @relation("EventAppointmentUser")
Participants Participant[]
Event Event @relation(fields: [eventId], references: [id], onDelete: Cascade)
Presenter User @relation(fields: [presenterId], references: [id])
}
model Participant {
id Int @id @default(autoincrement())
userId String @map(name: "user_id")
finisherMoodleCurseCompleted Boolean @default(false)
attended Boolean @default(false)
appointmentCancelled Boolean @default(false)
eventAppointmentId Int?
enscriptionDate DateTime @default(now())
statusLog Json[] @default([])
eventId Int
statusLog Json[] @default([])
eventId Int
// relations:
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
Event Event @relation(fields: [eventId], references: [id], onDelete: Cascade)
EventAppointment EventAppointment? @relation(fields: [eventAppointmentId], references: [id])
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
Event Event @relation(fields: [eventId], references: [id], onDelete: Cascade)
}
model Event {
@@ -41,8 +25,6 @@ model Event {
description String
type EVENT_TYPE @default(EVENT)
discordRoleId String? @default("")
hasPresenceEvents Boolean @default(false)
maxParticipants Int? @default(0)
finisherMoodleCourseId String? @default("")
finishedBadges BADGES[] @default([])
requiredBadges BADGES[] @default([])
@@ -51,7 +33,6 @@ model Event {
// relations:
Participants Participant[]
Appointments EventAppointment[]
}
model File {

View File

@@ -0,0 +1,35 @@
/*
Warnings:
- You are about to drop the column `appointmentCancelled` on the `Participant` table. All the data in the column will be lost.
- You are about to drop the column `attended` on the `Participant` table. All the data in the column will be lost.
- You are about to drop the column `eventAppointmentId` on the `Participant` table. All the data in the column will be lost.
- You are about to drop the `EventAppointment` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `_EventAppointmentUser` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "EventAppointment" DROP CONSTRAINT "EventAppointment_eventId_fkey";
-- DropForeignKey
ALTER TABLE "EventAppointment" DROP CONSTRAINT "EventAppointment_presenterId_fkey";
-- DropForeignKey
ALTER TABLE "Participant" DROP CONSTRAINT "Participant_eventAppointmentId_fkey";
-- DropForeignKey
ALTER TABLE "_EventAppointmentUser" DROP CONSTRAINT "_EventAppointmentUser_A_fkey";
-- DropForeignKey
ALTER TABLE "_EventAppointmentUser" DROP CONSTRAINT "_EventAppointmentUser_B_fkey";
-- AlterTable
ALTER TABLE "Participant" DROP COLUMN "appointmentCancelled",
DROP COLUMN "attended",
DROP COLUMN "eventAppointmentId";
-- DropTable
DROP TABLE "EventAppointment";
-- DropTable
DROP TABLE "_EventAppointmentUser";

View File

@@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `hasPresenceEvents` on the `Event` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Event" DROP COLUMN "hasPresenceEvents";

View File

@@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `maxParticipants` on the `Event` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Event" DROP COLUMN "maxParticipants";

View File

@@ -69,8 +69,6 @@ model User {
// relations:
oauthTokens OAuthToken[]
participants Participant[]
EventAppointmentUser EventAppointment[] @relation("EventAppointmentUser")
EventAppointment EventAppointment[]
SentMessages ChatMessage[] @relation("SentMessages")
ReceivedMessages ChatMessage[] @relation("ReceivedMessages")
SentReports Report[] @relation("SentReports")

View File

@@ -3,6 +3,5 @@ import { Event, Participant } from "@repo/db";
export const eventCompleted = (event: Event, participant?: Participant) => {
if (!participant) return false;
if (event.finisherMoodleCourseId && !participant.finisherMoodleCurseCompleted) return false;
if (event.hasPresenceEvents && !participant.attended) return false;
return true;
};