This commit is contained in:
msyu
2024-10-23 11:17:42 +03:00
commit ab5c944862
380 changed files with 55823 additions and 0 deletions
@@ -0,0 +1,39 @@
<cfcomponent extends="taffy.core.api">
<cfscript>
this.name = hash(getCurrentTemplatePath());
// In the interest of compatibility, we'll write this out long-form so it works on CF8
variables.framework = structNew();
variables.framework.debugKey = "debug";
variables.framework.reloadKey = "reload";
variables.framework.reloadPassword = "true";
variables.framework.serializer = "taffy.core.nativeJsonSerializer";
variables.framework.dashboardKey = "dashboard";
variables.framework.disableDashboard = false;
variables.framework.unhandledPaths = "/flex2gateway";
variables.framework.allowCrossDomain = false;
variables.framework.globalHeaders = structNew();
variables.framework.globalHeaders["X-MY-HEADER"] = "my header value";
//variables.framework.beanFactory = "";
/* If you have CF9+, the above could be written as:
variables.framework {
debugKey = "debug",
reloadKey = "reload",
reloadPassword = "true",
serializer = "taffy.core.nativeJsonSerializer",
dashboardKey = "dashboard",
disableDashboard = false,
unhandledPaths = "/flex2gateway",
allowCrossDomain = false,
globalHeaders = {
"X-MY-HEADER" = "my header value"
}
}
*/
</cfscript>
</cfcomponent>
@@ -0,0 +1,6 @@
<!---
DO NOT DELETE THIS FILE
===============================
This file is necessary for Taffy to work, but should be blank.
All requests funnel through it, but are handled by framework internal functionality.
--->
@@ -0,0 +1,15 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/artist/{artistId}/art" hint="Collection of art data">
<cfset variables.dummyData = StructNew() />
<cfset variables.dummyData.whatever = true />
<cffunction name="get" access="public" output="false" hint="Get some collection of art data">
<cfargument name="artistId" type="numeric" required="true" />
<cfreturn representationOf(variables.dummyData).withStatus(200) />
</cffunction>
<cffunction name="post" access="public" output="false" hint="Insert a new art record">
<cfreturn representationOf(variables.dummyData).withStatus(200) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,22 @@
<cfcomponent extends="taffy.core.resource" taffy_uri="/artist/{artistId}/art/{artId}">
<cfset variables.dummyData = StructNew() />
<cfset variables.dummyData.whatever = true />
<cffunction name="get" access="public" output="false">
<cfreturn representationOf(variables.dummyData).withStatus(200) />
</cffunction>
<cffunction name="post" access="public" output="false">
<cfreturn representationOf(variables.dummyData).withStatus(200) />
</cffunction>
<cffunction name="put" access="public" output="false">
<cfreturn representationOf(variables.dummyData).withStatus(200) />
</cffunction>
<cffunction name="delete" access="public" output="false">
<cfreturn representationOf(variables.dummyData).withStatus(200) />
</cffunction>
</cfcomponent>
@@ -0,0 +1,59 @@
<cfcomponent extends="taffy.core.resource" taffy_uri="/artists">
<cffunction name="get" access="public" output="false">
<cfset var q = "" />
<cfquery name="q" datasource="cfartgallery">
select * from artists
</cfquery>
<cfreturn representationOf(q).withStatus(200) />
</cffunction>
<cffunction name="post" access="public" output="false">
<cfargument name="firstname" type="string" required="false" default="" />
<cfargument name="lastname" type="string" required="false" default="" />
<cfargument name="address" type="string" required="false" default="" />
<cfargument name="city" type="string" required="false" default="" />
<cfargument name="state" type="string" required="false" default="" />
<cfargument name="postalcode" type="string" required="false" default="" />
<cfargument name="email" type="string" required="false" default="" />
<cfargument name="phone" type="string" required="false" default="" />
<cfargument name="fax" type="string" required="false" default="" />
<cfargument name="thepassword" type="string" required="false" default="" />
<cfset var q = "" />
<cfquery name="q" datasource="cfartgallery">
insert into artists (firstname,lastname,address,city,state,postalcode,email,phone,fax,thepassword)
values (
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.firstname#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.lastname#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.address#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.city#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.state#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.postalcode#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.email#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.phone#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.fax#" />,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.thepassword#" />
)
</cfquery>
<cfquery name="q" datasource="cfartgallery">
select * from artists
where
firstname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.firstname#" />
and lastname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.lastname#" />
and address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.address#" />
and city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.city#" />
and state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.state#" />
and postalcode = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.postalcode#" />
and email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.email#" />
and phone = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.phone#" />
and fax = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.fax#" />
and thepassword = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.thepassword#" />
</cfquery>
<cfreturn representationOf(q).withStatus(200) />
</cffunction>
<!---
The DELETE and PUT verbs are not implemented, so those actions are not permitted.
--->
</cfcomponent>
@@ -0,0 +1,81 @@
<cfcomponent extends="taffy.core.resource" taffy:uri="/artist/{id}" hint="some hint about this resource">
<cffunction name="get" access="public" output="false">
<cfargument name="id" type="numeric" required="true" />
<cfset var q = ""/>
<cfset var col = "" />
<cfset var rtn = StructNew() />
<cfquery name="q" datasource="cfartgallery">
select * from artists where artistId = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.id#" />
</cfquery>
<cfif q.recordCount gt 0>
<cfloop list="#q.ColumnList#" index="col">
<cfset rtn[col] = q[col][1] />
</cfloop>
<cfreturn representationOf(rtn).withStatus(200) />
<cfelse>
<cfreturn noData().withStatus(404) />
</cfif>
</cffunction>
<cffunction name="put" access="public" output="false">
<cfargument name="id" type="numeric" required="true" />
<cfargument name="firstname" type="string" required="false" default="" />
<cfargument name="lastname" type="string" required="false" default="" />
<cfargument name="address" type="string" required="false" default="" hint="some hint about this parameter" />
<cfargument name="city" type="string" required="false" default="" />
<cfargument name="state" type="string" required="false" default="" />
<cfargument name="postalcode" type="string" required="false" default="" />
<cfargument name="email" type="string" required="false" default="" />
<cfargument name="phone" type="string" required="false" default="" />
<cfargument name="fax" type="string" required="false" default="" />
<cfargument name="thepassword" type="string" required="false" default="" />
<cfset var q = "" />
<cfquery name="q" datasource="cfartgallery">
update artists
set artistid=artistid
<cfif len(arguments.firstname)>
,firstname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.firstname#" />
</cfif>
<cfif len(arguments.lastname)>
,lastname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.lastname#" />
</cfif>
<cfif len(arguments.address)>
,address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.address#" />
</cfif>
<cfif len(arguments.city)>
,city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.city#" />
</cfif>
<cfif len(arguments.state)>
,state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.state#" />
</cfif>
<cfif len(arguments.postalcode)>
,postalcode = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.postalcode#" />
</cfif>
<cfif len(arguments.email)>
,email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.email#" />
</cfif>
<cfif len(arguments.phone)>
,phone = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.phone#" />
</cfif>
<cfif len(arguments.fax)>
,fax = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.fax#" />
</cfif>
<cfif len(arguments.thepassword)>
,thepassword = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.thepassword#" />
</cfif>
where artistid = <cfqueryparam cfsqltype="cf_sql_numeric" value="#arguments.id#" />
</cfquery>
<cfreturn noData().withStatus(200) />
</cffunction>
<cffunction name="delete" access="public" output="false">
<cfargument name="id" type="numeric" required="true" />
<cfset var q = "" />
<cfquery name="q" datasource="cfartgallery">
delete from artists where artistid = <cfqueryparam cfsqltype="cf_sql_numeric" value="#arguments.id#" />
</cfquery>
<cfreturn noData().withStatus(200) />
</cffunction>
</cfcomponent>