Report logic #2

This commit is contained in:
nocnico
2025-04-28 21:23:03 +02:00
parent e7c8f8ad1c
commit 7670843613
4 changed files with 41 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
import { create } from "zustand";
import { PrismaClient } from "@prisma/client";
interface ReportStore {
ownId: null | string;
@@ -13,4 +14,19 @@ export const useReportStore = create<ReportStore>((set) => ({
setReportOpen: (open: boolean) => set({ reportOpen: open }),
setOwnId: (id: string) => set({ ownId: id }),
}));
// TODO: implement logic for reports
const prisma = new PrismaClient();
export const sendReport = async (receiverId: string, message: string) => {
try {
await prisma.reportMessage.create({
data: {
receiverId,
message,
},
});
} catch (error) {
console.error("Failed to send report:", error);
throw error;
}
};