put patch

This commit is contained in:
msyu
2024-11-15 01:17:34 +03:00
parent 3e3c907713
commit 43eca3da56
3 changed files with 51 additions and 1 deletions
+35
View File
@@ -174,5 +174,40 @@
<cfabort/> --->
<cfreturn representationOf(out) />
</cffunction>
<cffunction name="patch">
<cfargument name="instanceUid" type="string" required=true hint="type:guid"/>
<cfargument name="displayName" type="string" required=false hint="type:string"/>
<cfargument name="descr" type="string" required=false default="" hint="type:varchar (no cleanup here!)"/>
<!--- ****** проверка уникальности --->
<cftry>
<cfset this.helper.keyExistsAndValid(arguments, "instanceUid", "guid")/>
<cfquery name="local.qSave">
update instance set
dt_updated=<cfqueryparam cfsqltype="cf_sql_timestamp" value="#Now()#" />
,updater_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.usrId#" />
<cfif structKeyExists(arguments,"displayName")>
,display_name=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.displayName#" />
</cfif>
<cfif structKeyExists(arguments,"descr")>
,descr=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.descr#" />
</cfif>
where instance_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceUid#" />;
--select @@rowcount as cnt;
</cfquery>
<!--- <cfif local.qSave.cnt EQ 0>
<cfreturn noData().withStatus(404, "Record Not Found") />
</cfif> --->
<cfcatch type="invalidParamValue">
<cfreturn representationOf(this.helper.formatBadRequestError(cfcatch)).withStatus(400)/>
</cfcatch>
</cftry>
<cfreturn noData().withStatus(204, "No Content") />
</cffunction>
</cfcomponent>