Skip to content

Commit 8831313

Browse files
add tile api corrected
1 parent e961b23 commit 8831313

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
@@ -280,30 +280,33 @@ impl Server {
280280
),
281281
)
282282
.service(
283-
web::resource("/{dashboard_id}")
284-
.route(
285-
web::get()
286-
.to(dashboards::get_dashboard)
287-
.authorize(Action::GetDashboard),
288-
)
289-
.route(
290-
web::delete()
291-
.to(dashboards::delete_dashboard)
292-
.authorize(Action::DeleteDashboard),
283+
web::scope("/{dashboard_id}")
284+
.service(
285+
web::resource("")
286+
.route(
287+
web::get()
288+
.to(dashboards::get_dashboard)
289+
.authorize(Action::GetDashboard),
290+
)
291+
.route(
292+
web::delete()
293+
.to(dashboards::delete_dashboard)
294+
.authorize(Action::DeleteDashboard),
295+
)
296+
.route(
297+
web::put()
298+
.to(dashboards::update_dashboard)
299+
.authorize(Action::CreateDashboard),
300+
),
293301
)
294-
.route(
295-
web::put()
296-
.to(dashboards::update_dashboard)
297-
.authorize(Action::CreateDashboard),
302+
.service(
303+
web::resource("/add_tile").route(
304+
web::put()
305+
.to(dashboards::add_tile)
306+
.authorize(Action::CreateDashboard),
307+
),
298308
),
299309
)
300-
.service(
301-
web::resource("/add_tile").route(
302-
web::put()
303-
.to(dashboards::add_tile)
304-
.authorize(Action::CreateDashboard),
305-
),
306-
)
307310
}
308311

309312
// 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)