Skip to content

Commit 7915fae

Browse files
add tile api corrected
1 parent bc00691 commit 7915fae

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

src/handlers/http/modal/server.rs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -260,30 +260,33 @@ impl Server {
260260
),
261261
)
262262
.service(
263-
web::resource("/{dashboard_id}")
264-
.route(
265-
web::get()
266-
.to(dashboards::get_dashboard)
267-
.authorize(Action::GetDashboard),
268-
)
269-
.route(
270-
web::delete()
271-
.to(dashboards::delete_dashboard)
272-
.authorize(Action::DeleteDashboard),
263+
web::scope("/{dashboard_id}")
264+
.service(
265+
web::resource("")
266+
.route(
267+
web::get()
268+
.to(dashboards::get_dashboard)
269+
.authorize(Action::GetDashboard),
270+
)
271+
.route(
272+
web::delete()
273+
.to(dashboards::delete_dashboard)
274+
.authorize(Action::DeleteDashboard),
275+
)
276+
.route(
277+
web::put()
278+
.to(dashboards::update_dashboard)
279+
.authorize(Action::CreateDashboard),
280+
),
273281
)
274-
.route(
275-
web::put()
276-
.to(dashboards::update_dashboard)
277-
.authorize(Action::CreateDashboard),
282+
.service(
283+
web::resource("/add_tile").route(
284+
web::put()
285+
.to(dashboards::add_tile)
286+
.authorize(Action::CreateDashboard),
287+
),
278288
),
279289
)
280-
.service(
281-
web::resource("/add_tile").route(
282-
web::put()
283-
.to(dashboards::add_tile)
284-
.authorize(Action::CreateDashboard),
285-
),
286-
)
287290
}
288291

289292
// get the filters web scope

src/users/dashboards.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,10 @@ impl Dashboards {
294294
&self,
295295
dashboard_id: Ulid,
296296
user_id: &str,
297-
) -> Result<Dashboard, DashboardError> {
297+
) -> Result<(), DashboardError> {
298298
self.get_dashboard_by_user(dashboard_id, user_id)
299299
.await
300-
.ok_or(DashboardError::Unauthorized)
300+
.ok_or_else(|| DashboardError::Unauthorized)
301+
.map(|_| ())
301302
}
302303
}

0 commit comments

Comments
 (0)