diff --git a/app/admin/actions.ts b/app/admin/actions.ts index 84d624d..3e975f8 100644 --- a/app/admin/actions.ts +++ b/app/admin/actions.ts @@ -7,6 +7,7 @@ import { createAdminClient } from "@/lib/supabase/admin"; import { requireAdmin } from "@/lib/auth/requireAdmin"; import { revalidatePath } from "next/cache"; import { z } from "zod"; +import { buildAdminUpdateUserProfileAuditEntry } from "@/lib/admin/users"; const VALID_ROLES = ["student", "parent", "tutor", "admin"] as const; type Role = (typeof VALID_ROLES)[number]; @@ -98,7 +99,7 @@ const updateProfileSchema = z.object({ /** Update a user's display name and WhatsApp number. */ export async function updateUserProfile(userId: string, formData: FormData) { - await requireAdmin(); + const adminUserId = await requireAdmin(); const raw = { display_name: formData.get("display_name") as string, @@ -122,13 +123,11 @@ export async function updateUserProfile(userId: string, formData: FormData) { if (error) throw new Error(`Failed to update profile: ${error.message}`); await admin.from("audit_logs").insert([ - { - actor_user_id: userId, - action: "admin_update_user_profile", - entity_type: "user_profiles", - entity_id: userId, - details: { display_name: parsed.data.display_name }, - }, + buildAdminUpdateUserProfileAuditEntry({ + actorUserId: adminUserId, + targetUserId: userId, + displayName: parsed.data.display_name, + }), ]); revalidatePath("/admin/users"); diff --git a/app/admin/matches/[id]/MatchActions.tsx b/app/admin/matches/[id]/MatchActions.tsx index 20b4a51..fd97ab9 100644 --- a/app/admin/matches/[id]/MatchActions.tsx +++ b/app/admin/matches/[id]/MatchActions.tsx @@ -260,10 +260,11 @@ export function EditMatchForm({
Tutor assigned successfully.
+ The request is now matched and ready for session generation or follow-up updates. +
Wrong email?{' '}
Student
{dashboardRoleLabel}