From cce499e27e13e7fb8f38ae2570fdd6e8606b941d Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Tue, 8 Jul 2025 17:42:11 -0700 Subject: [PATCH] =?UTF-8?q?aktuallisiere=20Disord-Name=20bei=20dispatcher-?= =?UTF-8?q?=C3=A4nderung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/dispatch-server/routes/dispatcher.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/dispatch-server/routes/dispatcher.ts b/apps/dispatch-server/routes/dispatcher.ts index 31dd6460..f021dce2 100644 --- a/apps/dispatch-server/routes/dispatcher.ts +++ b/apps/dispatch-server/routes/dispatcher.ts @@ -1,6 +1,7 @@ import { AdminMessage, getPublicUser, Prisma, prisma } from "@repo/db"; import { Router } from "express"; import { io } from "index"; +import { renameMember } from "modules/discord"; import { pubClient } from "modules/redis"; const router: Router = Router(); @@ -24,8 +25,21 @@ router.patch("/:id", async (req, res) => { data: { ...disaptcherUpdate, }, + include: { user: true }, }); + const discordAccount = await prisma.discordAccount.findFirst({ + where: { + userId: newDispatcher.userId, + }, + }); + if (discordAccount?.id) { + await renameMember( + discordAccount.discordId.toString(), + `${getPublicUser(newDispatcher.user).fullName} • ${newDispatcher.zone}`, + ); + } + res.json(newDispatcher); });