feat(checkout): implement wizard and admin actions
All checks were successful
Staging Build / build (push) Successful in 3m11s

This commit is contained in:
DanielS
2026-07-20 23:18:40 +02:00
parent 2b372be228
commit 86b63ce77e
5 changed files with 190 additions and 11 deletions

View File

@@ -0,0 +1,36 @@
'use server'
import { createClient } from '@/lib/supabase/server'
import type { Order, EndCustomer } from '@/lib/types'
/**
* Holt alle Bestellanfragen.
* RLS filtert automatisch auf die eigene Firma (bzw. lässt Admins alle sehen).
*/
export async function getCompanyOrders(): Promise<Order[]> {
const supabase = await createClient()
const { data, error } = await supabase
.from('orders')
.select('*')
.order('created_at', { ascending: false })
if (error) throw error
return data as Order[]
}
/**
* Holt alle Endkunden.
* RLS filtert automatisch auf die eigene Firma (bzw. lässt Admins alle sehen).
*/
export async function getCompanyEndCustomers(): Promise<EndCustomer[]> {
const supabase = await createClient()
const { data, error } = await supabase
.from('end_customers')
.select('*')
.order('company_name', { ascending: true })
if (error) throw error
return data as EndCustomer[]
}