082 availableResourceRealms

This commit is contained in:
msyu
2025-04-07 22:29:03 +03:00
parent 498abdc060
commit 9692b6c101
7 changed files with 153 additions and 10 deletions
@@ -73,6 +73,25 @@
<cfreturn representationOf(this.helper.formatMessage("Not Found")).withStatus(404)/>
</cfif>
<cfquery name="local.qAvailableResourceRealm" result="local.result">
select
<m:field_set titleMapOut="local.realmTitleMap" lengthOut="local.realmFieldCount">
<m:field>r.resource_realm_id</m:field>
<m:field>r.resource_realm_type_id</m:field>
<m:field>r.resource_realm</m:field>
</m:field_set>
from resource_realm r
join resource_realm_type t on (r.resource_realm_type_id=t.resource_realm_type_id)
/*left outer join resource_realm p on (r.parent_id=p.resource_realm_id)*/
join resource_realm_access a on
(r.resource_realm_id=a.resource_realm_id
AND a.contract_id=<cfqueryparam cfsqltype="CF_SQL_INTEGER" value=#arguments.contractId#/>
AND a.is_enabled)
join svc s on r.resource_realm_type_id=s.resource_realm_type_id
where s.svc_id=<cfqueryparam cfsqltype="CF_SQL_INTEGER" value=#local.qSvcOperation.svc_id#/>
order by 1
</cfquery>
<cfset var out=structNew("linked")/>
<cfset "out.queryDurationMs"=getTickCount() - request.startTickCount/>
@@ -86,6 +105,11 @@
<cfset var rec = this.helper.appendRecord(structNew("linked"), "", local.cfsParamMap, local.qCfsParam, this.helper.snake2camel)/>
<cfset arrayAppend(out.svcOperation.cfsParams, rec)/>
</cfloop>
<cfset "out.svcOperation.availableResourceRealms"=[]/>
<cfloop query=#local.qAvailableResourceRealm#>
<cfset arrayAppend(out.svcOperation.availableResourceRealms, this.helper.appendRecord(structNew("linked"), "", local.realmTitleMap, local.qAvailableResourceRealm, this.helper.snake2camel))/>
</cfloop>
<cfset "out.runDurationMs"=getTickCount() - request.startTickCount/>
<cfreturn representationOf(out) />