037 man, cfs_param note
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
//variables.framework.docs={};
|
//variables.framework.docs={};
|
||||||
variables.framework.docs.APIName="Deck API";
|
variables.framework.docs.APIName="Deck API";
|
||||||
variables.framework.docs.APIVersion="0.036";
|
variables.framework.docs.APIVersion="0.037";
|
||||||
|
|
||||||
variables.framework.globalHeaders = structNew();
|
variables.framework.globalHeaders = structNew();
|
||||||
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
||||||
|
|||||||
@@ -112,6 +112,7 @@
|
|||||||
<m:field>sop.regex</m:field>
|
<m:field>sop.regex</m:field>
|
||||||
<m:field>sop.unique_scope</m:field>
|
<m:field>sop.unique_scope</m:field>
|
||||||
<m:field>sop.descr</m:field>
|
<m:field>sop.descr</m:field>
|
||||||
|
<m:field>iop.note</m:field>
|
||||||
</m:field_set>
|
</m:field_set>
|
||||||
from svc_operation_cfs_param sop
|
from svc_operation_cfs_param sop
|
||||||
left outer join instance_operation_cfs_param iop
|
left outer join instance_operation_cfs_param iop
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<m:field title="instance_operation_uid">iop.instance_operation_uid::text as instance_operation_uid</m:field>
|
<m:field title="instance_operation_uid">iop.instance_operation_uid::text as instance_operation_uid</m:field>
|
||||||
<m:field title="svc_operation_cfs_param_id">iop.svc_operation_cfs_param_id</m:field>
|
<m:field title="svc_operation_cfs_param_id">iop.svc_operation_cfs_param_id</m:field>
|
||||||
<m:field title="param_value">iop.param_value</m:field>
|
<m:field title="param_value">iop.param_value</m:field>
|
||||||
|
<m:field title="descr">iop.descr</m:field>
|
||||||
<m:field title="dt_created">to_char(iop.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created</m:field>
|
<m:field title="dt_created">to_char(iop.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created</m:field>
|
||||||
<m:field title="creator_id">iop.creator_id</m:field>
|
<m:field title="creator_id">iop.creator_id</m:field>
|
||||||
<m:field title="svc_operation_cfs_param">sop.svc_operation_cfs_param</m:field>
|
<m:field title="svc_operation_cfs_param">sop.svc_operation_cfs_param</m:field>
|
||||||
@@ -98,6 +99,7 @@
|
|||||||
<cffunction name="put" hint="запись CFS параметра операции инстанса">
|
<cffunction name="put" hint="запись CFS параметра операции инстанса">
|
||||||
<cfargument name="instanceOperationCfsParamUid" type="string" required=true hint="type:guid"/>
|
<cfargument name="instanceOperationCfsParamUid" type="string" required=true hint="type:guid"/>
|
||||||
<cfargument name="paramValue" type="string" required=true/>
|
<cfargument name="paramValue" type="string" required=true/>
|
||||||
|
<cfargument name="note" type="string" required=false default=""/>
|
||||||
|
|
||||||
<cfset var local={}/>
|
<cfset var local={}/>
|
||||||
<cftry>
|
<cftry>
|
||||||
@@ -112,6 +114,7 @@
|
|||||||
dt_created=<cfqueryparam cfsqltype="cf_sql_timestamp" value="#Now()#" />
|
dt_created=<cfqueryparam cfsqltype="cf_sql_timestamp" value="#Now()#" />
|
||||||
,creator_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.usrId#" />
|
,creator_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.usrId#" />
|
||||||
,param_value=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.paramValue#" />
|
,param_value=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.paramValue#" />
|
||||||
|
,note=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.note#" />
|
||||||
where instance_operation_cfs_param_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationCfsParamUid#" null=#!isValid('guid',arguments.instanceOperationCfsParamUid)#/>
|
where instance_operation_cfs_param_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationCfsParamUid#" null=#!isValid('guid',arguments.instanceOperationCfsParamUid)#/>
|
||||||
</cfquery>
|
</cfquery>
|
||||||
<!--- *** проверить существование - 404 --->
|
<!--- *** проверить существование - 404 --->
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
<m:field title="instance_operation_uid">iop.instance_operation_uid::text as instance_operation_uid</m:field>
|
<m:field title="instance_operation_uid">iop.instance_operation_uid::text as instance_operation_uid</m:field>
|
||||||
<m:field title="svc_operation_cfs_param_id">iop.svc_operation_cfs_param_id</m:field>
|
<m:field title="svc_operation_cfs_param_id">iop.svc_operation_cfs_param_id</m:field>
|
||||||
<m:field title="param_value">iop.param_value</m:field>
|
<m:field title="param_value">iop.param_value</m:field>
|
||||||
|
<m:field title="note">iop.note</m:field>
|
||||||
<m:field title="dt_created">to_char(iop.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created</m:field>
|
<m:field title="dt_created">to_char(iop.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created</m:field>
|
||||||
<m:field title="creator_id">iop.creator_id</m:field>
|
<m:field title="creator_id">iop.creator_id</m:field>
|
||||||
<m:field title="svc_operation_cfs_param">sop.svc_operation_cfs_param</m:field>
|
<m:field title="svc_operation_cfs_param">sop.svc_operation_cfs_param</m:field>
|
||||||
@@ -100,54 +101,12 @@
|
|||||||
</cffunction>
|
</cffunction>
|
||||||
|
|
||||||
|
|
||||||
<!--- <cffunction name="post" hint="Создание нового CFS параметра операции.">
|
|
||||||
<cfargument name="instanceOperationUid" type="string" required=true hint="type:guid"/>
|
|
||||||
<cfargument name="svcOperationCfsParamId" type="string" required=true hint="type:integer"/>
|
|
||||||
<cfargument name="paramValue" type="string" required=true hint="type:string ***Валидацию пока не проводим, а надо"/>
|
|
||||||
|
|
||||||
<cftry>
|
|
||||||
<cfset this.helper.validateField(arguments, "instanceUid", "guid")/>
|
|
||||||
<cfset this.helper.validateField(arguments, "svcOperationCfsParamId", "integer")/>
|
|
||||||
<!--- Еще возможна ошибка, что мы подадим параметр не от своей операции или сервиса - он останется невидим для всех --->
|
|
||||||
<!--- *** Проверка: операция не запущена, иначе создавать параметры нельзя --->
|
|
||||||
|
|
||||||
<cfcatch type="invalidParamValue">
|
|
||||||
<cfreturn representationOf(this.helper.formatBadRequestError(cfcatch)).withStatus(400)/>
|
|
||||||
</cfcatch>
|
|
||||||
</cftry>
|
|
||||||
|
|
||||||
<cfset local={}/>
|
|
||||||
<cfset local.instanceOperationCfsParamUid=#createGUID()#/>
|
|
||||||
|
|
||||||
<cftry>
|
|
||||||
<cfquery name="local.qSave">
|
|
||||||
insert into instance_operation_cfs_param (
|
|
||||||
instance_operation_cfs_param_uid,instance_operation_uid,svc_operation_cfs_param_id,param_value,dt_created,creator_id
|
|
||||||
) values (
|
|
||||||
<cfqueryparam cfsqltype="cf_sql_other" value="#local.instanceOperationCfsParamUid#"/>
|
|
||||||
,<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#"/>
|
|
||||||
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.svcOperationCfsParamId#"/>
|
|
||||||
,<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.paramValue#"/>
|
|
||||||
,<cfqueryparam cfsqltype="cf_sql_timestamp" value="#Now()#" />
|
|
||||||
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.usrId#" />
|
|
||||||
);
|
|
||||||
</cfquery>
|
|
||||||
|
|
||||||
<cfcatch type="any">
|
|
||||||
<cfreturn representationOf(this.helper.formatException(cfcatch, "Internal Error")).withStatus(500)/><!--- это не нужно показывать в продуктиве --->
|
|
||||||
</cfcatch>
|
|
||||||
</cftry>
|
|
||||||
|
|
||||||
<cfreturn noData()
|
|
||||||
.withHeaders({location: "./#local.instanceOperationCfsParamUid#"})
|
|
||||||
.withStatus(201, "Created")
|
|
||||||
/>
|
|
||||||
</cffunction> --->
|
|
||||||
|
|
||||||
<cffunction name="post" hint="Создание нового CFS параметра операции.">
|
<cffunction name="post" hint="Создание нового CFS параметра операции.">
|
||||||
<cfargument name="instanceOperationUid" type="string" required=true hint="type:guid"/>
|
<cfargument name="instanceOperationUid" type="string" required=true hint="type:guid"/>
|
||||||
<cfargument name="svcOperationCfsParamId" type="string" required=true hint="type:integer"/>
|
<cfargument name="svcOperationCfsParamId" type="string" required=true hint="type:integer"/>
|
||||||
<cfargument name="paramValue" type="string" required=true hint="type:string ***Валидацию пока не проводим, а надо"/>
|
<cfargument name="paramValue" type="string" required=true hint="type:string ***Валидацию пока не проводим, а надо"/>
|
||||||
|
<cfargument name="note" type="string" required=false default="" hint="type:string description: комментарий пользователя"/>
|
||||||
|
|
||||||
<cftry>
|
<cftry>
|
||||||
<cfset this.helper.validateField(arguments, "instanceOperationUid", "guid")/>
|
<cfset this.helper.validateField(arguments, "instanceOperationUid", "guid")/>
|
||||||
@@ -200,12 +159,13 @@
|
|||||||
|
|
||||||
<cfquery name="local.qSave">
|
<cfquery name="local.qSave">
|
||||||
insert into instance_operation_cfs_param (
|
insert into instance_operation_cfs_param (
|
||||||
instance_operation_cfs_param_uid,instance_operation_uid,svc_operation_cfs_param_id,param_value,dt_created,creator_id
|
instance_operation_cfs_param_uid,instance_operation_uid,svc_operation_cfs_param_id,param_value,note,dt_created,creator_id
|
||||||
) values (
|
) values (
|
||||||
<cfqueryparam cfsqltype="cf_sql_other" value="#local.instanceOperationCfsParamUid#"/>
|
<cfqueryparam cfsqltype="cf_sql_other" value="#local.instanceOperationCfsParamUid#"/>
|
||||||
,<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#"/>
|
,<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#"/>
|
||||||
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.svcOperationCfsParamId#"/>
|
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.svcOperationCfsParamId#"/>
|
||||||
,<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.paramValue#"/>
|
,<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.paramValue#"/>
|
||||||
|
,<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.note#"/>
|
||||||
,<cfqueryparam cfsqltype="cf_sql_timestamp" value="#Now()#" />
|
,<cfqueryparam cfsqltype="cf_sql_timestamp" value="#Now()#" />
|
||||||
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.usrId#" />
|
,<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.usrId#" />
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<m:field title="URL создания">(select url from svc_operation so where so.operation='create' AND so.svc_id=s.svc_id limit 1) as create_url</m:field>
|
<m:field title="URL создания">(select url from svc_operation so where so.operation='create' AND so.svc_id=s.svc_id limit 1) as create_url</m:field>
|
||||||
<m:field>s.is_production_ready</m:field>
|
<m:field>s.is_production_ready</m:field>
|
||||||
<m:field title="Описание">s.descr</m:field>
|
<m:field title="Описание">s.descr</m:field>
|
||||||
|
<m:field title="Руководство">s.man</m:field>
|
||||||
</m:field_set>
|
</m:field_set>
|
||||||
from svc s
|
from svc s
|
||||||
where svc_id=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.svcId#" null=#!isValid('integer',arguments.svcId)#/>
|
where svc_id=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.svcId#" null=#!isValid('integer',arguments.svcId)#/>
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
<m:field title="Операция">j.operation</m:field>
|
<m:field title="Операция">j.operation</m:field>
|
||||||
<m:field title="URL">j.url</m:field>
|
<m:field title="URL">j.url</m:field>
|
||||||
<m:field title="Описание">j.descr</m:field>
|
<m:field title="Описание">j.descr</m:field>
|
||||||
|
<m:field title="Руководство">j.man</m:field>
|
||||||
</m:field_set>
|
</m:field_set>
|
||||||
from svc_operation j
|
from svc_operation j
|
||||||
where j.svc_id=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.svcId#" null=#!isValid('integer',arguments.svcId)#/>
|
where j.svc_id=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.svcId#" null=#!isValid('integer',arguments.svcId)#/>
|
||||||
|
|||||||
+4
-67
@@ -12,76 +12,12 @@
|
|||||||
svc_id={prefix="s", type="integer"},
|
svc_id={prefix="s", type="integer"},
|
||||||
is_production_ready={prefix="s", type="boolean"},
|
is_production_ready={prefix="s", type="boolean"},
|
||||||
svc={prefix="s", type="string"},
|
svc={prefix="s", type="string"},
|
||||||
code={prefix="s", type="string"}
|
code={prefix="s", type="string"},
|
||||||
|
descr={prefix="s", type="string"},
|
||||||
|
man={prefix="s", type="string"}
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!--- <cffunction name="get" hint="Список сервисов">
|
|
||||||
<cfargument name="pageSize" type="string" hint="type:integer" default="100"/>
|
|
||||||
<cfargument name="page" type="string" hint="type:integer" default="1"/>
|
|
||||||
<cfargument name="orderBy" type="string" hint="type:string, description:comma-separated list of fields to sort by, example:fld1.ASC,fld2.DESC,fld3.ASC" default=""/>
|
|
||||||
<!---сюда можно воткнуть спецификацию полей для сортировки и фильтрации, но только ручками, идея компактного кода еще более отдаляется--->
|
|
||||||
|
|
||||||
<!---parse and validate request parameters--->
|
|
||||||
<cftry>
|
|
||||||
<cfset this.helper.validateField(arguments, "pageSize", "integer")/>
|
|
||||||
<cfset this.helper.validateField(arguments, "page", "integer")/>
|
|
||||||
|
|
||||||
<!---мы мирно игнорируем поля, отсутствующие в спецификации, что позволяет не делать исключения для orderBy и т.п.--->
|
|
||||||
<cfset var filter=this.helper.parseFilterParams(this.fieldsSpec)/>
|
|
||||||
<!--- <cfset var order=this.helper.parseOrderBy(this.fieldsSpec, arguments.orderBy)/> --->
|
|
||||||
|
|
||||||
<cfcatch type="invalidParamValue">
|
|
||||||
<cfreturn representationOf(this.helper.formatBadRequestError(cfcatch)).withStatus(400)/>
|
|
||||||
</cfcatch>
|
|
||||||
</cftry>
|
|
||||||
|
|
||||||
<cfset var out={}/>
|
|
||||||
<cfset var maxrows=arguments.pageSize*arguments.page/>
|
|
||||||
<cfset var startrow=arguments.pageSize*(arguments.page-1)+1/>
|
|
||||||
|
|
||||||
<cfquery name="local.qRead" result="local.result">
|
|
||||||
select
|
|
||||||
<m:field_set titleMapOut="local.titleMap" lengthOut="local.fieldCount">
|
|
||||||
<m:field title="ID" cfSqlType="CF_SQL_INTEGER">s.svc_id</m:field>
|
|
||||||
<m:field title="Сервис">s.svc</m:field>
|
|
||||||
<m:field title="URL создания">(select url from svc_operation so where so.operation='create' AND so.svc_id=s.svc_id limit 1) as create_url</m:field>
|
|
||||||
<m:field title="Описание">s.descr</m:field>
|
|
||||||
<m:field>to_char(s.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created</m:field>
|
|
||||||
<m:field>to_char(s.dt_updated, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_updated</m:field>
|
|
||||||
</m:field_set>
|
|
||||||
from svc s
|
|
||||||
where 1=1 <m:filter_build filter=#filter#/>
|
|
||||||
order by <m:order_build sortCollection=#this.helper.parseNumericOrder(local.titleMap, arguments.orderBy)# fieldCount=0/><!---no sort length limit--->
|
|
||||||
limit #maxrows#
|
|
||||||
</cfquery>
|
|
||||||
|
|
||||||
<cfquery name="local.qTotal">
|
|
||||||
select count(*) as cnt
|
|
||||||
from svc
|
|
||||||
where 1=1
|
|
||||||
</cfquery>
|
|
||||||
|
|
||||||
<cfset "out.queryDurationMs"=getTickCount() - request.startTickCount/>
|
|
||||||
<cfset "out.total"=#local.qTotal.cnt#/>
|
|
||||||
|
|
||||||
<cfset var resultSet=[]/>
|
|
||||||
<cfloop query=#local.qRead# startRow=#startrow#>
|
|
||||||
<cfset var rec={}/>
|
|
||||||
<cfset this.helper.appendRecord(rec, "", local.titleMap, local.qRead, this.helper.snake2camel)/>
|
|
||||||
<cfset arrayAppend(resultSet, rec)/>
|
|
||||||
</cfloop>
|
|
||||||
|
|
||||||
<cfset "out.results"=#resultSet#/>
|
|
||||||
<cfset "out.pageSize"=#arguments.pageSize#/>
|
|
||||||
<cfset "out.page"=#arguments.page#/>
|
|
||||||
<cfset "out.orderBy"=#arguments.orderBy#/>
|
|
||||||
<cfset "out.size"=#arrayLen(resultSet)#/>
|
|
||||||
<cfset "out.runDurationMs"=getTickCount()-request.startTickCount/>
|
|
||||||
<!---<cfset "out.sql"=#local.result.sql#/>--->
|
|
||||||
<cfreturn representationOf(out)/>
|
|
||||||
</cffunction> --->
|
|
||||||
|
|
||||||
<cffunction name="get" hint="Список сервисов">
|
<cffunction name="get" hint="Список сервисов">
|
||||||
<cfargument name="pageSize" type="string" hint="type:integer" default="100"/>
|
<cfargument name="pageSize" type="string" hint="type:integer" default="100"/>
|
||||||
<cfargument name="page" type="string" hint="type:integer" default="1"/>
|
<cfargument name="page" type="string" hint="type:integer" default="1"/>
|
||||||
@@ -124,6 +60,7 @@
|
|||||||
<m:field title="URL создания">(select url from svc_operation so where so.operation='create' AND so.svc_id=s.svc_id limit 1) as create_url</m:field>
|
<m:field title="URL создания">(select url from svc_operation so where so.operation='create' AND so.svc_id=s.svc_id limit 1) as create_url</m:field>
|
||||||
<m:field>s.is_production_ready</m:field>
|
<m:field>s.is_production_ready</m:field>
|
||||||
<m:field>s.descr</m:field>
|
<m:field>s.descr</m:field>
|
||||||
|
<m:field>s.man</m:field>
|
||||||
<m:field>to_char(s.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created</m:field>
|
<m:field>to_char(s.dt_created, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_created</m:field>
|
||||||
<m:field>to_char(s.dt_updated, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_updated</m:field>
|
<m:field>to_char(s.dt_updated, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_updated</m:field>
|
||||||
</m:field_set>
|
</m:field_set>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<m:field title="operation">o.operation</m:field>
|
<m:field title="operation">o.operation</m:field>
|
||||||
<m:field title="URL">o.url</m:field>
|
<m:field title="URL">o.url</m:field>
|
||||||
<m:field title="Описание">o.descr</m:field>
|
<m:field title="Описание">o.descr</m:field>
|
||||||
|
<m:field title="Руководство">o.man</m:field>
|
||||||
</m:field_set>
|
</m:field_set>
|
||||||
from svc_operation o
|
from svc_operation o
|
||||||
where o.svc_operation_id=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.svcOperationId#" null=#!isValid('integer',arguments.svcOperationId)#/>
|
where o.svc_operation_id=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.svcOperationId#" null=#!isValid('integer',arguments.svcOperationId)#/>
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
<m:field>p.regex</m:field>
|
<m:field>p.regex</m:field>
|
||||||
<m:field>p.unique_scope</m:field>
|
<m:field>p.unique_scope</m:field>
|
||||||
<m:field>p.descr</m:field>
|
<m:field>p.descr</m:field>
|
||||||
|
<m:field>p.man</m:field>
|
||||||
<m:field>(
|
<m:field>(
|
||||||
select 1 from svc_operation_cfs_param m
|
select 1 from svc_operation_cfs_param m
|
||||||
join svc_operation om on m.svc_operation_id=om.svc_operation_id
|
join svc_operation om on m.svc_operation_id=om.svc_operation_id
|
||||||
|
|||||||
Reference in New Issue
Block a user