Add logs to banning/unbanning

This commit is contained in:
Kalle
2024-05-14 20:40:16 +03:00
parent e99165f43f
commit 09c0ed322b

View File

@@ -9,6 +9,7 @@ import { assertUnreachable } from "~/utils/types";
import { _action, actualNumber } from "~/utils/zod";
import { plusTiersFromVotingAndLeaderboard } from "../core/plus-tier.server";
import { refreshBannedCache } from "~/features/ban/core/banned.server";
import { logger } from "~/utils/logger";
export const action = async ({ request }: ActionFunctionArgs) => {
const data = await parseRequestFormData({
@@ -86,6 +87,15 @@ export const action = async ({ request }: ActionFunctionArgs) => {
refreshBannedCache();
logger.info("Banned user", {
userId: data["user"],
byUserId: user.id,
reason: data.reason,
duration: data.duration
? new Date(data.duration).toLocaleString()
: undefined,
});
break;
}
case "UNBAN_USER": {
@@ -95,6 +105,11 @@ export const action = async ({ request }: ActionFunctionArgs) => {
refreshBannedCache();
logger.info("Unbanned user", {
userId: data["user"],
byUserId: user.id,
});
break;
}
default: {