From 080252cf2c4567fc3bd642290b0b0826aef184fa Mon Sep 17 00:00:00 2001 From: msyu Date: Sun, 6 Apr 2025 11:16:02 +0300 Subject: [PATCH] 076 instance_operation.resource_realm_id --- v1/Application.cfc | 2 +- v1/resources/instance.cfc | 34 +-------- v1/resources/instance_operation.cfc | 3 + .../instance_operation_cfs_param_ls.cfc | 74 ++++++++++++------- v1/resources/instance_operation_ls.cfc | 4 +- v1/resources/instance_operation_run.cfc | 52 +++++++------ 6 files changed, 86 insertions(+), 83 deletions(-) diff --git a/v1/Application.cfc b/v1/Application.cfc index 9e67aea..49ea2a3 100644 --- a/v1/Application.cfc +++ b/v1/Application.cfc @@ -51,7 +51,7 @@ //variables.framework.docs={}; variables.framework.docs.APIName="Deck API"; - variables.framework.docs.APIVersion="0.075"; + variables.framework.docs.APIVersion="0.076"; variables.framework.globalHeaders = structNew(); variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location"; diff --git a/v1/resources/instance.cfc b/v1/resources/instance.cfc index af9d1d2..adfe2ac 100644 --- a/v1/resources/instance.cfc +++ b/v1/resources/instance.cfc @@ -291,32 +291,7 @@ - - - - ---> + @@ -329,11 +304,4 @@ - - - \ No newline at end of file diff --git a/v1/resources/instance_operation.cfc b/v1/resources/instance_operation.cfc index 1e85bc2..54b4639 100644 --- a/v1/resources/instance_operation.cfc +++ b/v1/resources/instance_operation.cfc @@ -22,6 +22,8 @@ o.instance_operation_uid::text as instance_operation_uid o.operation + o.resource_realm_id + r.resource_realm o.instance_uid::text as instance_uid to_char(o.dt_submit, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_submit o.submit_result @@ -49,6 +51,7 @@ join contragent k on (d.contragent_id=k.contragent_id) join svc v on (e.service_id=v.svc_id) join svc_operation so on (v.svc_id=so.svc_id AND o.operation=so.operation) + join resource_realm r on (o.resource_realm_id=r.resource_realm_id) left outer join usr u on (o.updater_id=u.usr_id) where o.instance_operation_uid= diff --git a/v1/resources/instance_operation_cfs_param_ls.cfc b/v1/resources/instance_operation_cfs_param_ls.cfc index 8c177ac..38923b7 100644 --- a/v1/resources/instance_operation_cfs_param_ls.cfc +++ b/v1/resources/instance_operation_cfs_param_ls.cfc @@ -186,12 +186,15 @@ /> - + + - + - + + + select sop.svc_operation_cfs_param_id ,sop.svc_operation_cfs_param @@ -211,7 +214,7 @@ - + @@ -244,7 +247,25 @@ - + + arguments.svcOperationCfsParamId, + arguments.paramValue, + qSvcOperationCfsParam.unique_scope, + arguments.instanceOperationCfsParamUid + )/> + + + + + + + + + + + + @@ -253,18 +274,19 @@ join instance_operation o on (p.instance_operation_uid=o.instance_operation_uid) join instance e on (o.instance_uid=e.instance_uid) where p.param_value= - AND p.svc_operation_cfs_param_id= - - AND p.instance_operation_cfs_param_uid <> + AND p.svc_operation_cfs_param_id=/*limit to the current svc param*/ + + + AND p.instance_operation_cfs_param_uid <> /*exclude itself*/ - AND (select cast(st.instance_data->>'isDeleted' as boolean) from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) IS NOT TRUE - + AND (select cast(st.instance_data->>'isDeleted' as boolean) from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) IS NOT TRUE /*ignore deleted instances*/ + - - + + select count(*) as cnt @@ -277,29 +299,31 @@ join contragent k on (d.contragent_id=k.contragent_id) join usr u on (k.contragent_id=u.contragent_id) where p.param_value= - AND svc_operation_cfs_param_id= - AND u.usr_id= - - AND p.instance_operation_cfs_param_uid <> + AND svc_operation_cfs_param_id=/*limit to the current svc param*/ + AND u.usr_id=/*limit to the contragent of current user*/ + + + AND p.instance_operation_cfs_param_uid <> /*exclude itself*/ - AND (select cast(st.instance_data->>'isDeleted' as boolean) from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) IS NOT TRUE - /*to ignore deleted instances*/ - + AND (select cast(st.instance_data->>'isDeleted' as boolean) from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) IS NOT TRUE /*ignore deleted instances*/ + - - + + + - + - + - @@ -322,7 +346,7 @@ - + diff --git a/v1/resources/instance_operation_ls.cfc b/v1/resources/instance_operation_ls.cfc index 6ee14d3..2299fd3 100644 --- a/v1/resources/instance_operation_ls.cfc +++ b/v1/resources/instance_operation_ls.cfc @@ -10,6 +10,7 @@ + @@ -40,7 +41,7 @@ insert into instance_operation - (instance_uid, instance_operation_uid, operation, dt_created, creator_id, dt_updated, updater_id) + (instance_uid, instance_operation_uid, operation, dt_created, creator_id, dt_updated, updater_id,resource_realm_id) values ( @@ -50,6 +51,7 @@ , , , + , ); diff --git a/v1/resources/instance_operation_run.cfc b/v1/resources/instance_operation_run.cfc index b7d725b..e654e14 100644 --- a/v1/resources/instance_operation_run.cfc +++ b/v1/resources/instance_operation_run.cfc @@ -63,13 +63,15 @@ left outer join instance_operation_cfs_param iop on (sop.svc_operation_cfs_param_id=iop.svc_operation_cfs_param_id AND iop.instance_operation_uid=) where sop.svc_operation_id= + + - + - + @@ -77,7 +79,10 @@ + + + @@ -102,16 +107,18 @@ - select so.svc_operation_id, io.instance_uid, so.operation + select so.svc_operation_id, io.instance_uid, so.operation, r.resource_realm from instance_operation io join instance e on (io.instance_uid=e.instance_uid) join svc_operation so on (e.service_id=so.svc_id AND io.operation=so.operation) + left outer join resource_realm r on so.resource_realm_id=r.resource_realm_id where io.instance_operation_uid= + @@ -148,24 +155,24 @@ - @@ -192,8 +199,7 @@ set dt_submit= ,dt_start=null, dt_finish=null, submit_result='0' where instance_operation_uid= - - +