feat(multiselect): support multi-select categories and free items limits in category config and order wizard
All checks were successful
Staging Build / build (push) Successful in 2m38s
All checks were successful
Staging Build / build (push) Successful in 2m38s
This commit is contained in:
@@ -24,28 +24,7 @@ CREATE POLICY "Partner sehen nur eigene Endkunden" ON public.end_customers
|
||||
partner_id = (SELECT company_id FROM public.users WHERE id = auth.uid())
|
||||
);
|
||||
|
||||
-- 4. Recreate RLS policies for licenses (since partner_id now matches company_id)
|
||||
DROP POLICY IF EXISTS "Partner sehen Lizenzen eigener Kunden" ON public.licenses;
|
||||
CREATE POLICY "Partner sehen Lizenzen eigener Kunden" ON public.licenses
|
||||
FOR SELECT
|
||||
USING (
|
||||
EXISTS (
|
||||
SELECT 1 FROM public.end_customers c
|
||||
WHERE c.id = licenses.end_customer_id
|
||||
AND c.partner_id = (SELECT company_id FROM public.users WHERE id = auth.uid())
|
||||
)
|
||||
);
|
||||
|
||||
DROP POLICY IF EXISTS "Partner erstellen Lizenzen eigener Kunden" ON public.licenses;
|
||||
CREATE POLICY "Partner erstellen Lizenzen eigener Kunden" ON public.licenses
|
||||
FOR INSERT
|
||||
WITH CHECK (
|
||||
EXISTS (
|
||||
SELECT 1 FROM public.end_customers c
|
||||
WHERE c.id = licenses.end_customer_id
|
||||
AND c.partner_id = (SELECT company_id FROM public.users WHERE id = auth.uid())
|
||||
)
|
||||
);
|
||||
-- 4. Licenses policy recreation is omitted since licenses table is dropped.
|
||||
|
||||
-- Reload Schema Cache
|
||||
NOTIFY pgrst, 'reload schema';
|
||||
|
||||
@@ -33,31 +33,7 @@ CREATE POLICY "Partner sehen nur eigene Endkunden" ON public.end_customers
|
||||
OR partner_id = (SELECT company_id FROM public.users WHERE id = auth.uid())
|
||||
);
|
||||
|
||||
-- 4. Recreate licenses SELECT RLS policy to allow admin bypass
|
||||
DROP POLICY IF EXISTS "Partner sehen Lizenzen eigener Kunden" ON public.licenses;
|
||||
CREATE POLICY "Partner sehen Lizenzen eigener Kunden" ON public.licenses
|
||||
FOR SELECT
|
||||
USING (
|
||||
(SELECT role FROM public.users WHERE id = auth.uid()) = 'admin'
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM public.end_customers c
|
||||
WHERE c.id = licenses.end_customer_id
|
||||
AND c.partner_id = (SELECT company_id FROM public.users WHERE id = auth.uid())
|
||||
)
|
||||
);
|
||||
|
||||
-- 5. Recreate licenses INSERT RLS policy to allow admin bypass
|
||||
DROP POLICY IF EXISTS "Partner erstellen Lizenzen eigener Kunden" ON public.licenses;
|
||||
CREATE POLICY "Partner erstellen Lizenzen eigener Kunden" ON public.licenses
|
||||
FOR INSERT
|
||||
WITH CHECK (
|
||||
(SELECT role FROM public.users WHERE id = auth.uid()) = 'admin'
|
||||
OR EXISTS (
|
||||
SELECT 1 FROM public.end_customers c
|
||||
WHERE c.id = licenses.end_customer_id
|
||||
AND c.partner_id = (SELECT company_id FROM public.users WHERE id = auth.uid())
|
||||
)
|
||||
);
|
||||
-- 4 & 5. Licenses policy updates are omitted since licenses table is dropped.
|
||||
|
||||
-- Reload Schema Cache
|
||||
NOTIFY pgrst, 'reload schema';
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Add multi-select and free items limit to categories table
|
||||
ALTER TABLE public.categories ADD COLUMN IF NOT EXISTS allow_multiselect BOOLEAN DEFAULT false NOT NULL;
|
||||
ALTER TABLE public.categories ADD COLUMN IF NOT EXISTS free_items_limit INTEGER DEFAULT 0 NOT NULL;
|
||||
Reference in New Issue
Block a user