changed ui package
This commit is contained in:
41
apps/hub-server/modules/event.ts
Normal file
41
apps/hub-server/modules/event.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Event, Participant, prisma, User } from "@repo/db";
|
||||
|
||||
export const handleParticipantFinished = async (
|
||||
event: Event,
|
||||
participant: Participant,
|
||||
user: User,
|
||||
) => {
|
||||
const discordID = prisma.discordAccount.findFirst({
|
||||
where: {
|
||||
userId: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
prisma.user.update({
|
||||
where: {
|
||||
id: user.id,
|
||||
},
|
||||
data: {
|
||||
badges: {
|
||||
push: event.finishedBadges,
|
||||
},
|
||||
permissions: event.finishedPermissions,
|
||||
},
|
||||
});
|
||||
|
||||
prisma.participant.update({
|
||||
where: {
|
||||
id: participant.id,
|
||||
},
|
||||
data: {
|
||||
finished: true,
|
||||
statusLog: {
|
||||
push: {
|
||||
event: "Event finished",
|
||||
timestamp: new Date(),
|
||||
user: "system",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user