You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/06 20:56:43 UTC

[GitHub] [superset] dpgaspar commented on a diff in pull request #19434: feat: deprecate old API and create new API for dashes created by me

dpgaspar commented on code in PR #19434:
URL: https://github.com/apache/superset/pull/19434#discussion_r844415925


##########
superset/dashboards/api.py:
##########
@@ -455,6 +453,43 @@ def get_charts(self, id_or_slug: str) -> Response:
         except DashboardNotFoundError:
             return self.response_404()
 
+    @expose("/created_by_me/", methods=["GET"])
+    @protect()
+    @safe
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.get",
+        log_to_statsd=False,
+    )
+    def created_by_me(self) -> Response:
+        """Gets all dashboards created by the current user
+        ---
+        get:
+          description: >-
+            Gets all dashboards created by the current user
+          responses:
+            200:
+              description: Dashboard
+              content:
+                application/json:
+                  schema:
+                    type: object
+                    properties:
+                      result:
+                        type: array
+                        items:
+                          $ref: '#/components/schemas/DashboardCreatedByMeResponseSchema'
+            401:
+              $ref: '#/components/responses/401'
+            403:
+              $ref: '#/components/responses/403'
+            404:
+              $ref: '#/components/responses/404'
+        """
+        dashboards = DashboardDAO.get_dashboards_created_by(g.user.id)

Review Comment:
   I get what your saying @craig-rueda, but this is kind of the current pattern for custom get's, also @eschutho has a very good point here, I'll refactor this and make a custom filter for the `get_list` endpoint



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org