Skip to content
Snippets Groups Projects
Commit c511dbdf authored by Allen Gilliland's avatar Allen Gilliland
Browse files

update api endpoint GET /api/dashboard/:id to remove the superfluous wrapper...

update api endpoint GET /api/dashboard/:id to remove the superfluous wrapper with {:dashboard {real thing we want}}
parent 23d8641f
Branches
Tags
No related merge requests found
......@@ -103,7 +103,7 @@ export const fetchDashCardData = createThunkAction(FETCH_DASHCARD_DATASET, funct
export const fetchDashboard = createThunkAction(FETCH_DASHBOARD, function(id) {
return async function(dispatch, getState) {
let result = await Dashboard.get({ dashId: id });
return normalize(result, { dashboard: dashboard });
return normalize(result, dashboard);
};
});
......
......@@ -39,13 +39,13 @@
(defendpoint GET "/:id"
"Get `Dashboard` with ID."
[id]
(let-404 [db (-> (Dashboard id)
read-check
(hydrate :creator [:ordered_cards [:card :creator]] :can_read :can_write)
(assoc :actor_id *current-user-id*)
(->> (events/publish-event :dashboard-read))
(dissoc :actor_id))]
{:dashboard db})) ; why is this returned with this {:dashboard} wrapper?
(let-404 [dash (Dashboard id)]
(read-check dash)
(->500 dash
(hydrate :creator [:ordered_cards [:card :creator]] :can_read :can_write)
(assoc :actor_id *current-user-id*)
(->> (events/publish-event :dashboard-read))
(dissoc :actor_id))))
(defendpoint PUT "/:id"
"Update a `Dashboard`."
......
......@@ -76,32 +76,32 @@
;; ## GET /api/dashboard/:id
(expect
{:dashboard {:name "Test Dashboard"
:description nil
:creator_id (user->id :rasta)
:creator (user-details (fetch-user :rasta))
:public_perms 0
:can_read true
:can_write true
:updated_at true
:created_at true
:ordered_cards [{:sizeX 2
:sizeY 2
:col nil
:row nil
:updated_at true
:created_at true
:card {:name "Dashboard Test Card"
:description nil
:public_perms 0
:creator_id (user->id :rasta)
:creator (user-details (fetch-user :rasta))
:organization_id nil
:display "scalar"
:query_type nil
:dataset_query {:something "simple"}
:visualization_settings {:global {:title nil}}}}]
:organization_id nil}}
{:name "Test Dashboard"
:description nil
:creator_id (user->id :rasta)
:creator (user-details (fetch-user :rasta))
:public_perms 0
:can_read true
:can_write true
:updated_at true
:created_at true
:ordered_cards [{:sizeX 2
:sizeY 2
:col nil
:row nil
:updated_at true
:created_at true
:card {:name "Dashboard Test Card"
:description nil
:public_perms 0
:creator_id (user->id :rasta)
:creator (user-details (fetch-user :rasta))
:organization_id nil
:display "scalar"
:query_type nil
:dataset_query {:something "simple"}
:visualization_settings {:global {:title nil}}}}]
:organization_id nil}
;; fetch a dashboard WITH a dashboard card on it
(tu/with-temp Dashboard [{dashboard-id :id} {:name "Test Dashboard"
:public_perms 0
......@@ -115,7 +115,7 @@
(tu/with-temp DashboardCard [_ {:dashboard_id dashboard-id
:card_id card-id}]
(-> ((user->client :rasta) :get 200 (format "dashboard/%d" dashboard-id))
(update :dashboard dashboard-response))))))
dashboard-response)))))
;; ## PUT /api/dashboard/:id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment