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.
21 lines
512 B
TypeScript
21 lines
512 B
TypeScript
"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(),
|
|
});
|
|
}
|