diff --git a/v1/Application.cfc b/v1/Application.cfc
index 947145f..f4e1011 100644
--- a/v1/Application.cfc
+++ b/v1/Application.cfc
@@ -71,7 +71,7 @@
//variables.framework.docs={};
variables.framework.docs.APIName="Deck API";
- variables.framework.docs.APIVersion="0.011";
+ variables.framework.docs.APIVersion="0.013";
variables.framework.globalHeaders = structNew();
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
@@ -174,16 +174,23 @@
return representationOf("Authorization header expected").withStatus(401);
}
- var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="3");
- httpService.addParam(type = "HEADER", name = "Accept", value = "application/json");
- httpService.addParam(type = "HEADER", name = "Authorization", value = "#auth#"); //passthrough
- var resp = httpService.send();
- var result = resp.getPrefix().filecontent;
+ try {
+ var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="3");
+ httpService.addParam(type = "HEADER", name = "Accept", value = "application/json");
+ httpService.addParam(type = "HEADER", name = "Authorization", value = "#auth#"); //passthrough
+ var resp = httpService.send();
+ var result = resp.getPrefix().filecontent;
+ if (resp.responseheader.status_code NEQ 200) throw("IDP response not OK");
+
+ } catch (e) {
+ if (false) { //true for local debug without IDP
+ var result='{"accounts":[{"login":"","type":"telegram"}],"avatar":["d2d2b7ac-50af-432b-b7c4-f7d6561e288a"],"company":"ООО «НУБЕС»","companyId":"8ec70ac0-546d-42a7-8cff-339c8fb51a23","contactId":"983967a3-58c2-4cdd-84a5-8b427ccfac82","email":"smishchuk@nubes.ru","externalUser":false,"fio":{"fullName":"Мищук Сергей ","name":"Сергей","secondName":"","surname":"Мищук"},"groupIds":["94bf5be7-52f4-5c13-87c3-513786934685","ab12b6b8-0265-4683-a5c2-5e1a74a55216","aff008c3-7443-50f6-86e1-ecff3cd3b04d","d6000da0-c9aa-55eb-9882-f118b432730b","d89a33dc-3177-5854-9580-f7f860a5ab7c","ddfe2555-9ef4-42cb-9a2b-7f24e61e7747","df12926f-ecb8-5479-857f-6d291464baad","fda5c295-230a-5025-9797-b8b4e99e08aa","2be9b4b6-94d1-59f9-a649-cab228d82169","64fe6f5c-a91b-5fea-a7ca-d9823701ebd4"],"integration":{"serviceId":""},"login":"smishchuk@nubes.ru","mobilePhone":[],"position":"","userId":"d72530e1-66a4-412f-a046-38153c4e5405"}';}
+ }
+
//writeDump(result); abort;
try {
var idpUserData=deserializeJson(result);
-
- arguments.requestArguments.companyUid=idpUserData.companyId;
+ arguments.requestArguments.companyUid=idpUserData.companyId;//GUID!
arguments.requestArguments.usrUid=idpUserData.contactId;//userId; //GUID!
} catch (e) {
return representationOf( {"exception"=e, "idpResponse"=result} );
diff --git a/v1/resources/instance.cfc b/v1/resources/instance.cfc
index ee6e2d8..bf6db43 100644
--- a/v1/resources/instance.cfc
+++ b/v1/resources/instance.cfc
@@ -29,7 +29,7 @@
i.specification_id
s.specification
i.quantity
- i.price
+ i.price
v.svc
(select operation from instance_state st join instance_operation io on (st.instance_operation_uid=io.instance_operation_uid) where st.instance_uid=e.instance_uid order by version desc limit 1) as operation
(select st.instance_operation_uid::text from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) as instance_operation_uid
@@ -38,10 +38,7 @@
(select io.submit_result from instance_operation io where io.instance_uid=e.instance_uid order by dt_submit desc limit 1) as submit_result
(select to_char(io.dt_start, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') from instance_operation io where io.instance_uid=e.instance_uid order by dt_submit desc limit 1) as operation_dt_start
(select to_char(io.dt_finish, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') from instance_operation io where io.instance_uid=e.instance_uid order by dt_submit desc limit 1) as operation_dt_finish
-
-
-
+
from instance e
left outer join specification_item i on (e.specification_item_id=i.specification_item_id)
@@ -53,9 +50,9 @@
AND s.specification_id=
-
+
select
@@ -67,12 +64,20 @@
st.is_test
st.instance_operation_uid::text as instance_operation_uid
st.instance_data::text as instance_data
+ (st.instance_data->>'isDeleted')::boolean as is_deleted
from instance_state st
- where st.instance_uid=
+ where st.instance_uid=
order by st.version desc
limit 1
-
+
+
+
+
+
+
+
+
@@ -96,8 +101,8 @@
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)
- where o.instance_uid=
- order by status.version
+ where o.instance_uid=
+ order by status.version desc
@@ -106,10 +111,43 @@
(select io.operation from instance_operation io where io.instance_uid=e.instance_uid order by dt_submit desc limit 1) as current_operation --->
+
+
+
+ select
+
+ so.svc_operation_id
+ so.operation
+
+ (select instance_operation_uid::text
+ from instance_operation io
+ where io.instance_uid=
+ AND io.operation=so.operation AND io.dt_submit IS NULL
+ order by io.dt_created desc
+ limit 1
+ )as instance_operation_uid
+
+
+ from svc_operation so
+ where so.svc_id=
+
+ AND NOT so.operation='create'
+
+ AND so.operation='create'
+
+
+ AND 1=0
+
+ order by so.svc_operation_id
+
+
+
-
+
+
@@ -123,6 +161,11 @@
+
+
+
+
+