Skip to content

Commit 7b27c38

Browse files
committed
Favorites support
1 parent fd15991 commit 7b27c38

2 files changed

Lines changed: 14 additions & 25 deletions

File tree

MDX2JSON/REST.cls.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Example: send HTTP GET request to web application with Dispatch class <b>MDX2JSO
7171
<Route Url="/Config/:Application" Method="GET" Call="GetConfig" />
7272
7373
<!-- Get info about user favorites-->
74-
<Route Url="/Favorites" Method="GET" Call="GetFavotites"/>
74+
<Route Url="/Favorites" Method="GET" Call="GetFavorites"/>
7575
<Route Url="/Favorites/:Item" Method="POST" Call="AddFavorite" />
7676
<Route Url="/Favorites/:Item" Method="DELETE" Call="RemoveFavorite" />
7777
@@ -282,10 +282,10 @@ Wrapper for ##class(MDX2JSON.Users).GetConfig()</Description>
282282

283283
<Method name="GetFavorites">
284284
<ClassMethod>1</ClassMethod>
285-
<ReturnType>%String</ReturnType>
285+
<ReturnType>%Status</ReturnType>
286286
<Implementation><![CDATA[
287-
do ##class(MDX2JSON.Users).GetFavorites()
288-
return 1
287+
set st = ##class(MDX2JSON.Users).GetFavorites()
288+
return st
289289
]]></Implementation>
290290
</Method>
291291

@@ -294,8 +294,8 @@ Wrapper for ##class(MDX2JSON.Users).GetConfig()</Description>
294294
<FormalSpec>Name:%String</FormalSpec>
295295
<ReturnType>%Status</ReturnType>
296296
<Implementation><![CDATA[
297-
do ##class(MDX2JSON.Users).AddFavorite(Name)
298-
return 1
297+
set Name = $ZCONVERT($ZCONVERT(Name ,"I","URL") ,"I","UTF8")
298+
return ##class(%DeepSee.UserLibrary.Utils).%AddFavorite(Name)
299299
]]></Implementation>
300300
</Method>
301301

@@ -304,8 +304,8 @@ Wrapper for ##class(MDX2JSON.Users).GetConfig()</Description>
304304
<FormalSpec>Name:%String</FormalSpec>
305305
<ReturnType>%Status</ReturnType>
306306
<Implementation><![CDATA[
307-
do ##class(MDX2JSON.Users).RemoveFavorite(Name)
308-
return 1
307+
set Name = $ZCONVERT($ZCONVERT(Name ,"I","URL") ,"I","UTF8")
308+
return ##class(%DeepSee.UserLibrary.Utils).%RemoveFavorite(Name)
309309
]]></Implementation>
310310
</Method>
311311
</Class>

MDX2JSON/Users.cls.xml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,12 @@
3434
<Method name="GetFavorites">
3535
<ClassMethod>1</ClassMethod>
3636
<ReturnType>%String</ReturnType>
37-
<Implementation><![CDATA[ return 1
38-
]]></Implementation>
39-
</Method>
40-
41-
<Method name="AddFavorite">
42-
<ClassMethod>1</ClassMethod>
43-
<FormalSpec>Name:%String</FormalSpec>
44-
<ReturnType>%Status</ReturnType>
45-
<Implementation><![CDATA[ return 1
46-
]]></Implementation>
47-
</Method>
48-
49-
<Method name="RemoveFavorite">
50-
<ClassMethod>1</ClassMethod>
51-
<FormalSpec>Name:%String</FormalSpec>
52-
<ReturnType>%Status</ReturnType>
53-
<Implementation><![CDATA[ return 1
37+
<Implementation><![CDATA[
38+
set st = ##class(%DeepSee.UserPortal.Utils).%GetFavoritesForUser(.Favorites)
39+
return:$$$ISERR(st) st
40+
set st = ##class(%ZEN.Auxiliary.jsonProvider).%ArrayToJSON($lb("FullName","ShortName","Folder","Tip","Type","Icon","AddDate","URL"),.Favorites)
41+
return:$$$ISERR(st) st
42+
return $$$OK
5443
]]></Implementation>
5544
</Method>
5645
</Class>

0 commit comments

Comments
 (0)