Fix Prisma JSON typing in V1 actions
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
import { randomBytes } from "node:crypto";
|
import { randomBytes } from "node:crypto";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
import { prisma } from "./prisma";
|
import { prisma } from "./prisma";
|
||||||
import { requireCurrentUser, userIsAdmin } from "./session";
|
import { requireCurrentUser, userIsAdmin } from "./session";
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ export async function revokeInvite(formData: FormData) {
|
|||||||
revalidateAdmin();
|
revalidateAdmin();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function audit(actorId: string, action: string, metadata: Record<string, unknown>) {
|
async function audit(actorId: string, action: string, metadata: Prisma.InputJsonObject) {
|
||||||
await prisma.auditEvent.create({ data: { actorId, action, metadata } });
|
await prisma.auditEvent.create({ data: { actorId, action, metadata } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import { RoomVisibility } from "@prisma/client";
|
import { Prisma, RoomVisibility } from "@prisma/client";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { prisma } from "./prisma";
|
import { prisma } from "./prisma";
|
||||||
@@ -98,7 +98,7 @@ export async function resetPersonalRoom(formData: FormData) {
|
|||||||
await prisma.$transaction([
|
await prisma.$transaction([
|
||||||
prisma.mediaSource.deleteMany({ where: { roomId: room.id } }),
|
prisma.mediaSource.deleteMany({ where: { roomId: room.id } }),
|
||||||
prisma.roomMessage.deleteMany({ where: { roomId: room.id } }),
|
prisma.roomMessage.deleteMany({ where: { roomId: room.id } }),
|
||||||
prisma.room.update({ where: { id: room.id }, data: { currentState: null } }),
|
prisma.room.update({ where: { id: room.id }, data: { currentState: Prisma.JsonNull } }),
|
||||||
prisma.auditEvent.create({
|
prisma.auditEvent.create({
|
||||||
data: {
|
data: {
|
||||||
actorId: user.id,
|
actorId: user.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user