Feat: Implement comprehensive audit logging for Halls, Packages, and Reservations
This commit is contained in:
@@ -3,19 +3,26 @@
|
||||
import { createClient } from "@/lib/supabase/server"
|
||||
import { revalidatePath } from "next/cache"
|
||||
|
||||
import { logAction } from "@/lib/logger"
|
||||
|
||||
export async function createPackage(data: { name: string; price: number; description?: string; is_active: boolean }) {
|
||||
const supabase = await createClient()
|
||||
|
||||
const { error } = await supabase.from('packages').insert({
|
||||
const { data: newPackage, error } = await supabase.from('packages').insert({
|
||||
name: data.name,
|
||||
price: data.price,
|
||||
description: data.description,
|
||||
is_active: data.is_active,
|
||||
})
|
||||
}).select().single()
|
||||
|
||||
if (error) {
|
||||
throw new Error(error.message)
|
||||
}
|
||||
|
||||
await logAction('create_package', 'package', newPackage.id, {
|
||||
name: data.name,
|
||||
price: data.price
|
||||
})
|
||||
|
||||
revalidatePath('/dashboard/settings/packages')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user