Initial commit: WaMarket MVP
Marketplace inversée (Next.js 16 App Router + Supabase Cloud) : auth, schéma + RLS, publication de besoins avec upload d'images, feed avec filtres, offres, acceptation via RPC, messagerie temps réel, dashboards, et Dockerfile pour déploiement Coolify.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
"use server";
|
||||
|
||||
import { createClient } from "@/lib/supabase/server";
|
||||
import { verifySession } from "@/lib/dal";
|
||||
|
||||
export async function sendMessage(conversationId: string, formData: FormData) {
|
||||
const user = await verifySession();
|
||||
const body = formData.get("body");
|
||||
|
||||
if (typeof body !== "string" || !body.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const supabase = await createClient();
|
||||
await supabase.from("messages").insert({
|
||||
conversation_id: conversationId,
|
||||
sender_id: user.id,
|
||||
body: body.trim(),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user