067 usrId argument removed from annotations

This commit is contained in:
msyu
2025-03-12 18:00:34 +03:00
parent 459ec9da14
commit 6a9dbf19b4
7 changed files with 40 additions and 21 deletions
+24 -10
View File
@@ -51,7 +51,7 @@
//variables.framework.docs={};
variables.framework.docs.APIName="Deck API";
variables.framework.docs.APIVersion="0.066";
variables.framework.docs.APIVersion="0.067";
variables.framework.globalHeaders = structNew();
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
@@ -117,7 +117,8 @@
<cfreturn serviceUrl/>
<cfcatch type="any">
<!--- <cfdump var=#cfcatch#/> --->
<!--- <cfdump var=#serviceUrl#/>
<cfdump var=#cfcatch#/><cfabort/> --->
</cfcatch>
</cftry>
</cfloop>
@@ -175,9 +176,9 @@
} else {
return representationOf("Authorization header expected").withStatus(401);
}
var result="";
try {
var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="3");
var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="5");
httpService.addParam(type = "HEADER", name = "Accept", value = "application/json");
httpService.addParam(type = "HEADER", name = "Authorization", value = "#auth#"); //passthrough
//writedump(this.iamServiceUrl);abort;
@@ -185,8 +186,15 @@
//if (resp.status_code NEQ 200) throw("IDP response not OK");
//writedump(resp);abort;
var prefix = resp.getPrefix();
if (prefix.status_code NEQ 200) throw("IDP response not OK");
var result = prefix.filecontent;
if (prefix.status_code NEQ 200) {
writedump(this.iamServiceUrl);
writedump(resp);
abort;
throw("IDP response not OK");
}
result = prefix.filecontent;
//writedump(result);abort;
} catch (e) {
/*if (fileExists("#GetDirectoryFromPath(GetCurrentTemplatePath())#/etc/local-debug")) { //true for local debug without IDP, etc/* does not go to repository
@@ -194,7 +202,7 @@
*/
//writedump(resp);
//return representationOf( {"exception"=e} );
return representationOf( {"exception"=e, "idpResponse"=result} );//.withStatus(500);
return representationOf( {"exception"=e, "idpResponse"=result} ).withStatus(500);
}
//writeDump(result); abort;
@@ -214,6 +222,8 @@
if (structIsEmpty(usrCustomerInfo)) return representationOf("Cannot find default specification for current user #result#").withStatus(422); //это создает довольно много лишних движений при отладке
arguments.requestArguments.usrId=usrCustomerInfo.usrId; //Integer!
arguments.requestArguments.contragentId=usrCustomerInfo.contragentId; //Integer
arguments.requestArguments.contractId=usrCustomerInfo.contractId; //Integer
arguments.requestArguments.specificationId=usrCustomerInfo.specificationId; //Integer
return true;
@@ -339,9 +349,9 @@
<cfset local={}/>
<!--- Во избежании потери времени при отладке временно сделаем создание дефолтового контракта и спецификации, если их нет --->
<!--- *** хватается первый попавшийся контракт и спецификация --->
<cfquery name="local.qGetCustomerInfo">
select u.usr_id, s.specification_id
select u.usr_id, c.contragent_id, c.contract_id, s.specification_id
from usr u
join contract c on (u.contragent_id=c.contragent_id)
join specification s on (c.contract_id=s.contract_id)
@@ -350,7 +360,11 @@
</cfquery>
<!--- <cfdump var=#local.qGetCustomerInfo#/><cfabort/> --->
<cfif local.qGetCustomerInfo.recordCount GT 0>
<cfreturn {"usrId"=#local.qGetCustomerInfo.usr_id#, "specificationId"=#local.qGetCustomerInfo.specification_id#}/>
<cfreturn {"usrId"=#local.qGetCustomerInfo.usr_id#,
"contragentId"=#local.qGetCustomerInfo.specification_id#,
"contractId"=#local.qGetCustomerInfo.specification_id#,
"specificationId"=#local.qGetCustomerInfo.specification_id#
}/>
<cfelse>
<cfreturn {}/> <!--- неуклюжий способ обозначить ошибку --->
</cfif>