From a866bc74e7edc36addd7abdb59e1d0ed4148ec95 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Nov 2025 16:35:29 +0300 Subject: [PATCH] 160 vault_record conditionally marshalled, svc search by synonyms --- v1/Application.cfc | 2 +- v1/lib/field_set.cfm | 26 ++-- v1/resources/instance_ls.cfc | 11 +- v1/resources/svc_ls.cfc | 219 +++++++++++++++++++++++++--------- v1/resources/vault_record.cfc | 2 +- 5 files changed, 188 insertions(+), 72 deletions(-) diff --git a/v1/Application.cfc b/v1/Application.cfc index 64c53f7..eaafd2d 100644 --- a/v1/Application.cfc +++ b/v1/Application.cfc @@ -51,7 +51,7 @@ //variables.framework.docs={}; variables.framework.docs.APIName="svc-api"; - variables.framework.docs.APIVersion="0.159"; /*$ git config --global --unset user.password*/ + variables.framework.docs.APIVersion="0.160"; /*$ git config --global --unset user.password*/ variables.framework.globalHeaders = structNew(); variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location"; diff --git a/v1/lib/field_set.cfm b/v1/lib/field_set.cfm index dc63f96..ca1e89e 100644 --- a/v1/lib/field_set.cfm +++ b/v1/lib/field_set.cfm @@ -1,32 +1,39 @@ - + + + + - + + + + + OR listFindNoCase(ATTRIBUTES.fieldsToInclude,field.name)> - + + @@ -46,6 +53,10 @@ + + + + - + - + - + - \ No newline at end of file diff --git a/v1/resources/instance_ls.cfc b/v1/resources/instance_ls.cfc index 6019115..0696182 100644 --- a/v1/resources/instance_ls.cfc +++ b/v1/resources/instance_ls.cfc @@ -80,7 +80,6 @@ - @@ -136,7 +135,8 @@ to_char(e.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as instance_config_dt_created to_char(e.dt_updated, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as instance_config_dt_updated @@ -195,8 +195,7 @@ ) as explained_status st.version - - + select count(*) as cnt @@ -206,7 +205,7 @@ '' as placeholder - #preserveSingleQuotes(definedInstanceFields)# + #preserveSingleQuotes(definedQueryFields)# from instance e join specification_item i on (e.specification_item_id=i.specification_item_id) @@ -248,7 +247,7 @@ #local.fieldsToOutput#* from ( select - #preserveSingleQuotes(definedInstanceFields)# + #preserveSingleQuotes(definedQueryFields)# from instance e join specification_item i on (e.specification_item_id=i.specification_item_id) join specification s on (i.specification_id=s.specification_id) diff --git a/v1/resources/svc_ls.cfc b/v1/resources/svc_ls.cfc index 29e2bf5..e7c6644 100644 --- a/v1/resources/svc_ls.cfc +++ b/v1/resources/svc_ls.cfc @@ -6,21 +6,24 @@ + + "resource_realm_type_id"={type="integer"}, + "sort"={type="integer"}, + "is_production_ready"={type="boolean"}, + "svc"={type="string"}, + "svc_short"={type="string"}, + "svc_extended_name"={type="string"}, + "orchestrator_name"={type="string"}, + "synonyms"={type="string"}, + "code"={type="string"}, + "version"={type="string"}, + "descr"={type="string"}, + "man"={type="string"} } /> @@ -28,9 +31,11 @@ + + - + @@ -38,64 +43,167 @@ + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - + + s.svc_id + s.svc + s.svc_short + s.orchestrator_name + s.synonyms + s.code + (select url from svc_operation so where so.operation='create' AND so.svc_id=s.svc_id limit 1) as create_url + s.is_production_ready + s.resource_realm_type_id + s.sort + s.version + s.icon_src + s.descr + s.man + (select count(distinct r.resource_realm) + from resource_realm r + join resource_realm_access a on ( + r.resource_realm_id=a.resource_realm_id + AND (a.contract_id IN ( + select contract_id + from contract d + where d.contragent_id=k.contragent_id AND NOT d.is_closed + ) OR a.contract_id=0) /*0 means access to any contract*/ + AND a.is_enabled) + where r.resource_realm_type_id=s.resource_realm_type_id) as resource_realm_cnt + to_char(s.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created + to_char(s.dt_updated, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_updated + (coalesce(s.svc,'') ||' '|| coalesce(s.svc_short,'') ||' '|| coalesce(s.synonyms,'')) as svc_extended_name + + + + + + + - select - - s.svc_id - s.svc - s.svc_short - s.orchestrator_name - s.code - (select url from svc_operation so where so.operation='create' AND so.svc_id=s.svc_id limit 1) as create_url - s.is_production_ready - s.resource_realm_type_id - s.sort - s.version - s.icon_src - s.descr - s.man - (select count(distinct r.resource_realm) - from resource_realm r - join resource_realm_access a on ( - r.resource_realm_id=a.resource_realm_id - AND (a.contract_id IN ( - select contract_id - from contract d - join contragent z on (d.contragent_id=z.contragent_id) - where z.external_uid= - AND NOT d.is_closed - ) OR a.contract_id=0) /*0 means access to any contract*/ - AND a.is_enabled) - where r.resource_realm_type_id=s.resource_realm_type_id) as resource_realm_cnt - to_char(s.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created - to_char(s.dt_updated, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_updated - - from svc s - --left outer join svc_group on () - where 1=1 - order by - --limit #maxrows# + select #local.fieldsToOutput#* from + ( + select + + #preserveSingleQuotes(local.definedQueryFields)# + + '' as placeholder + + from svc s + left outer join contragent k on ( + k.external_uid= + ) /*эти хитрости для того, чтобы втащить cfqueryparam внутрь cfqery*/ + where 1=1 + + AND ( + lower((coalesce(s.svc,'') ||' '|| coalesce(s.svc_short,'') ||' '|| coalesce(s.synonyms,''))) like lower() + ) + + ) sv + where 1=1 + order by + select count(*) as cnt @@ -103,7 +211,6 @@ where 1=1 - diff --git a/v1/resources/vault_record.cfc b/v1/resources/vault_record.cfc index 1d59f90..acaed6c 100644 --- a/v1/resources/vault_record.cfc +++ b/v1/resources/vault_record.cfc @@ -123,7 +123,7 @@ - +