Fixed Acc deleted Warnung im Profil

This commit is contained in:
PxlLoewe
2026-02-07 13:43:37 +01:00
parent 2e9bb95d12
commit 8340c2408c
3 changed files with 20 additions and 23 deletions

View File

@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -704,23 +704,15 @@ export const AdminForm = ({
<div role="alert" className="alert alert-warning alert-outline flex flex-col">
<div className="flex items-center gap-2">
<TriangleAlert />
{openBans.map((ban) => (
<div key={ban.id}>
<h3 className="text-lg font-semibold">Account gelöscht</h3>
</div>
))}
{openTimebans.map((timeban) => (
<div key={timeban.id}>
<h3 className="text-lg font-semibold">
Dieser Account ist als gelöscht markiert, der Nutzer kann sich nicht mehr
anmelden.
</h3>
</div>
))}
<div>
<h3 className="text-lg font-semibold">Account gelöscht</h3>
</div>
<div>
<h3 className="text-lg font-semibold">
Dieser Account ist als gelöscht markiert, der Nutzer kann sich nicht mehr anmelden.
</h3>
</div>
</div>
<p className="text-sm text-gray-400">
Achtung! Die Strafe(n) sind aktiv, die Rechte des Nutzers müssen nicht angepasst werden!
</p>
</div>
)}
{(user.CanonicalUser || (user.Duplicates && user.Duplicates.length > 0)) && (

View File

@@ -1,6 +1,6 @@
import axios from "axios";
import { NextRequest, NextResponse } from "next/server";
import { DiscordAccount, prisma } from "@repo/db";
import { prisma } from "@repo/db";
import { getServerSession } from "../auth/[...nextauth]/auth";
import { setStandardName } from "../../../helper/discord";
import { getUserPenaltys } from "@repo/shared-components";
@@ -52,8 +52,7 @@ export const GET = async (req: NextRequest) => {
},
});
const discordObject = {
userId: session.user.id,
const discordData = {
accessToken: authData.access_token,
refreshToken: authData.refresh_token,
discordId: discordUser.id,
@@ -63,12 +62,19 @@ export const GET = async (req: NextRequest) => {
globalName: discordUser.global_name || discordUser.username,
verified: discordUser.verified,
tokenType: authData.token_type,
} as DiscordAccount;
};
await prisma.discordAccount.upsert({
where: { discordId: discordUser.id },
update: discordObject, // Updates if found
create: discordObject, // Creates if not found
update: discordData, // Updates if found
create: {
...discordData,
User: {
connect: {
id: session.user.id,
},
},
}, // Creates if not found
});
const user = await prisma.user.findUnique({
where: { id: session.user.id },