Penalty Nachricht im Admin form, abgelaufen für Timebans in tabelle werden Farblich dargestellt
This commit is contained in:
@@ -4,3 +4,4 @@ export * from "./dates";
|
||||
export * from "./simulatorConnected";
|
||||
export * from "./useDebounce";
|
||||
export * from "./useTimeout";
|
||||
export * from "./penaltys";
|
||||
|
||||
32
packages/shared-components/helper/penaltys.ts
Normal file
32
packages/shared-components/helper/penaltys.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
export const getUserPenaltys = async (userId: string) => {
|
||||
const openTimeban = await prisma.penalty.findMany({
|
||||
where: {
|
||||
userId: userId,
|
||||
until: {
|
||||
gte: new Date(),
|
||||
},
|
||||
suspended: false,
|
||||
type: "TIME_BAN",
|
||||
},
|
||||
include: {
|
||||
CreatedUser: true,
|
||||
},
|
||||
});
|
||||
|
||||
const openBans = await prisma.penalty.findMany({
|
||||
where: {
|
||||
userId: userId,
|
||||
suspended: false,
|
||||
type: "BAN",
|
||||
},
|
||||
include: {
|
||||
CreatedUser: true,
|
||||
},
|
||||
});
|
||||
return {
|
||||
openTimeban,
|
||||
openBans,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user