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,
	};
};
