@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / b03eeec
Fork 0

سامانه صدور فاکتور و حسابداری

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 3, 17:00 UTC

Archive Office C7 search input guard

davoodmehraban89 committed Oct 1, 2026 at 00:24 UTC b03eeecd4865546fa7639431ba615a28d7ff1a29
1 file changed +10
supabase/migrations/20260930205347_office_c7_search_input_guard.sql new
+10
@@ -0,0 +1,10 @@
1 +create or replace function public.office_archive_search_v2(p_organization_id uuid,p_query text default null,p_folder text default null,p_classification_code text default null,p_related_to text default null,p_limit integer default 100)
2 +returns table(correspondence_id text,register_number text,subject text,counterparty text,status text,folder text,classification_code text,tags text[],related_count bigint,match_source text,ocr_evidence_id text,ocr_provider text,ocr_language text,ocr_confidence numeric,ocr_corrected boolean)
3 +language plpgsql stable security invoker set search_path='' as $$
4 +begin
5 + if length(coalesce(p_query,''))>200 then raise exception 'archive query too long' using errcode='22023'; end if;
6 + if coalesce(p_limit,100)<1 or coalesce(p_limit,100)>200 then raise exception 'archive result limit out of range' using errcode='22023'; end if;
7 + return query select * from private.office_archive_search_v2_impl(p_organization_id,p_query,p_folder,p_classification_code,p_related_to,p_limit);
8 +end $$;
9 +revoke all on function public.office_archive_search_v2(uuid,text,text,text,text,integer) from public,anon;
10 +grant execute on function public.office_archive_search_v2(uuid,text,text,text,text,integer) to authenticated;