@@ -121,6 +121,15 @@ func (h *HttpHandler) Register(r *echo.Echo) {
121
121
v4 .POST ("/layout/set" , httpserver .AuthorizeHandler (h .SetUserLayout , api3 .ViewerRole ))
122
122
v4 .POST ("/layout/change-privacy" , httpserver .AuthorizeHandler (h .ChangePrivacy , api3 .ViewerRole ))
123
123
v4 .GET ("/layout/public" , httpserver .AuthorizeHandler (h .GetPublicLayouts , api3 .ViewerRole ))
124
+ v4 .POST ("/layout/widget/get" , httpserver .AuthorizeHandler (h .GetUserWidgets , api3 .ViewerRole ))
125
+ v4 .POST ("/layout/widget/get/public" , httpserver .AuthorizeHandler (h .GetAllPublicWidgets , api3 .ViewerRole ))
126
+ v4 .GET ("/layout/widget/get/:id" , httpserver .AuthorizeHandler (h .GetWidget , api3 .ViewerRole ))
127
+ v4 .DELETE ("/layout/widget/delete/:id" , httpserver .AuthorizeHandler (h .DeleteUserWidget , api3 .ViewerRole ))
128
+ v4 .POST ("/layout/update/widget" , httpserver .AuthorizeHandler (h .UpdateDashboardWidgets , api3 .ViewerRole ))
129
+ v4 .POST ("/layout/widget/update" , httpserver .AuthorizeHandler (h .UpdateWidgetDashboards , api3 .ViewerRole ))
130
+
131
+
132
+ v4 .POST ("/layout/widget/set" , httpserver .AuthorizeHandler (h .SetUserWidget , api3 .ViewerRole ))
124
133
// Chatbot
125
134
v4 .GET ("/chatbot/agents" , httpserver .AuthorizeHandler (h .GetAgents , api3 .ViewerRole ))
126
135
v4 .POST ("/chatbot/generate-query" , httpserver .AuthorizeHandler (h .GenerateQuery , api3 .ViewerRole ))
@@ -1857,3 +1866,14 @@ func (h *HttpHandler) UpdateWidgetDashboards(echoCtx echo.Context) error {
1857
1866
1858
1867
return echoCtx .NoContent (http .StatusOK )
1859
1868
}
1869
+
1870
+ // GetAllPublicWidgets returns all public widgets
1871
+ func (h * HttpHandler ) GetAllPublicWidgets (echoCtx echo.Context ) error {
1872
+ widgets , err := h .db .GetAllPublicWidgets ()
1873
+ if err != nil {
1874
+ h .logger .Error ("failed to fetch public widgets" , zap .Error (err ))
1875
+ return echo .NewHTTPError (http .StatusInternalServerError , "failed to fetch public widgets" )
1876
+ }
1877
+
1878
+ return echoCtx .JSON (http .StatusOK , widgets )
1879
+ }
0 commit comments