Skip to content

Commit b7441ad

Browse files
authored
Clean up
1 parent 2e5508c commit b7441ad

File tree

1 file changed

+0
-97
lines changed

1 file changed

+0
-97
lines changed

src/shvarov/SQL/REST/Query.cls

-97
Original file line numberDiff line numberDiff line change
@@ -35,104 +35,7 @@ ClassMethod RunSQLQuery() As %Status
3535
return 1
3636
}
3737

38-
/// Retreive all the records of Sample.Person
39-
ClassMethod GetAllPersons() As %Status
40-
{
41-
42-
#dim tSC As %Status = $$$OK
43-
44-
Set rset = ##class(Sample.Person).ExtentFunc()
45-
46-
Set %response.ContentType = ..#CONTENTTYPEJSON
47-
Write "["
48-
if rset.%Next() {
49-
Set person = ##class(Sample.Person).%OpenId(rset.ID)
50-
Do person.%JSONExport()
51-
}
52-
While rset.%Next() {
53-
Write ","
54-
Set person = ##class(Sample.Person).%OpenId(rset.ID)
55-
Do person.%JSONExport()
56-
}
57-
Write "]"
58-
Quit tSC
59-
}
60-
61-
/// Return one record fo Sample.Person
62-
ClassMethod GetPerson(id As %Integer) As %Status
63-
{
64-
#dim tSC As %Status = $$$OK
65-
#dim e As %Exception.AbstractException
66-
67-
68-
#; Set the response header to plain text
69-
Set %response.ContentType = ..#CONTENTTYPEJSON
70-
71-
Set person = ##class(Sample.Person).%OpenId(id)
72-
73-
If '$IsObject(person) Quit ..Http404()
74-
75-
Do person.%JSONExport()
76-
77-
Quit tSC
78-
}
79-
80-
/// Creates a new Sample.Person record
81-
ClassMethod CreatePerson() As %Status
82-
{
83-
#dim tSC As %Status = $$$OK
84-
#dim e As %Exception.AbstractException
85-
Set person = ##class(Sample.Person).%New()
86-
Set data=%request.Content
87-
8838

89-
$$$TOE(tSC,person.%JSONImport(data))
90-
$$$TOE(tSC,person.%Save())
91-
92-
Set %response.Status = 204
93-
Set %response.ContentType = ..#CONTENTTYPEJSON
94-
//d data.%ToJSON()
95-
Do person.%JSONExport()
96-
97-
Quit tSC
98-
}
99-
100-
/// Update a record in Sample.Person with id
101-
ClassMethod UpdatePerson(id As %Integer) As %Status
102-
{
103-
#dim tSC As %Status = $$$OK
104-
#dim e As %Exception.AbstractException
105-
Set person = ##class(Sample.Person).%OpenId(id)
106-
If '$IsObject(person) Return ..Http404()
107-
Set data=%request.Content
108-
109-
$$$TOE(tSC,person.%JSONImport(data))
110-
$$$TOE(tSC,person.%Save())
111-
112-
Set %response.Status = 200
113-
114-
Set %response.ContentType = ..#CONTENTTYPEJSON
115-
Do person.%JSONExport()
116-
117-
Quit tSC
118-
}
119-
120-
/// Delete a record with id in Sample.Person
121-
ClassMethod DeletePerson(id As %Integer) As %Status
122-
{
123-
#dim tSC As %Status = $$$OK
124-
#dim e As %Exception.AbstractException
125-
Set person = ##class(Sample.Person).%OpenId(id)
126-
If '$IsObject(person) Return ..Http404()
127-
128-
$$$TOE(tSC,person.%DeleteId(id))
129-
130-
Set %response.Status = 200
131-
132-
Set %response.ContentType = ..#CONTENTTYPEJSON
133-
134-
Quit tSC
135-
}
13639

13740
ClassMethod SwaggerSpec() As %Status
13841
{

0 commit comments

Comments
 (0)