feat: implement client portal project view with revision request functionality and layout structure

This commit is contained in:
poyrazavsever
2026-06-06 22:31:55 +03:00
parent a631b65c0b
commit c361fff5a7
10 changed files with 724 additions and 5 deletions
+36
View File
@@ -0,0 +1,36 @@
"use server";
import { createClient } from "@/lib/supabase/server";
import { revalidatePath } from "next/cache";
export async function createRevisionRequest(projectId: string, clientId: string, formData: FormData) {
const supabase = await createClient();
const { data: { user } } = await supabase.auth.getUser();
if (!user) {
return { error: "Oturum süresi dolmuş." };
}
const description = formData.get("description") as string;
if (!description?.trim()) {
return { error: "Revizyon açıklaması boş olamaz." };
}
const { error } = await supabase
.from("project_revisions")
.insert({
project_id: projectId,
client_id: clientId,
requested_by: user.id,
description,
status: "pending"
});
if (error) {
return { error: error.message };
}
revalidatePath(`/portal/projects/${projectId}`);
return { success: true };
}