From eb0dc3352d8ceeb088928c0acd8e89417c80a09c Mon Sep 17 00:00:00 2001 From: msyu Date: Fri, 28 Feb 2025 15:05:12 +0300 Subject: [PATCH] json type, user.cfc --- v1/Application.cfc | 7 ++++- v1/resources/instance.cfc | 3 +++ v1/resources/instance_default.cfc | 44 +++++++++++++++++++++++++++++++ v1/resources/user.cfc | 27 ++++++++++--------- 4 files changed, 67 insertions(+), 14 deletions(-) create mode 100644 v1/resources/instance_default.cfc diff --git a/v1/Application.cfc b/v1/Application.cfc index d95d154..5f59f40 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.058"; + variables.framework.docs.APIVersion="0.059"; variables.framework.globalHeaders = structNew(); variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location"; @@ -207,6 +207,11 @@ } var usrCustomerInfo=getUsrCustomerInfo(idpUserData.contactId); + + if (lCase(arguments.cfc) EQ 'user') { + if (structIsEmpty(usrCustomerInfo)) return representationOf("User information not found").withStatus(404); + } + if (structIsEmpty(usrCustomerInfo)) return representationOf("Cannot find default specification for current user #result#").withStatus(422); //это создает довольно много лишних движений при отладке arguments.requestArguments.usrId=usrCustomerInfo.usrId; //Integer! arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //Integer diff --git a/v1/resources/instance.cfc b/v1/resources/instance.cfc index 8bf73b4..7d58dd5 100644 --- a/v1/resources/instance.cfc +++ b/v1/resources/instance.cfc @@ -97,8 +97,11 @@ o.is_successful to_char(o.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created o.error_log + u.login as updater_login + u.shortname as updater_shortname from instance_operation o + left outer join usr u on (o.updater_id=u.usr_id) left outer join (select instance_operation_uid, max(version) as version from instance_state group by instance_operation_uid) sts on (o.instance_operation_uid=sts.instance_operation_uid) left outer join instance_state status on (sts.instance_operation_uid=status.instance_operation_uid AND sts.version=status.version) diff --git a/v1/resources/instance_default.cfc b/v1/resources/instance_default.cfc new file mode 100644 index 0000000..5103b8e --- /dev/null +++ b/v1/resources/instance_default.cfc @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/v1/resources/user.cfc b/v1/resources/user.cfc index 8ed2998..fdac10f 100644 --- a/v1/resources/user.cfc +++ b/v1/resources/user.cfc @@ -5,7 +5,7 @@ - + @@ -15,27 +15,27 @@ - + - + select s.specification_id - s.specification - (select count(*) from specification_item i where i.specification_id=s.specification_id) as specification_item_count + c.contract_id - c.contract - to_char(c.dt_contract, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_contract + from specification s join contract c on (s.contract_id=c.contract_id) @@ -44,15 +44,16 @@ order by specification_id desc limit 1; + select u.usr_id - u.login + k.contragent_id - as arguments_company_uid - k.external_uid::text as external_uid - k.contragent + + + from usr u left outer join contragent k on u.contragent_id=k.contragent_id @@ -62,7 +63,7 @@ - +