From 1f031b1cdda84bee6949003bc6af7b8902c1072a Mon Sep 17 00:00:00 2001 From: Caleb Bourg Date: Mon, 9 Dec 2024 10:59:52 -0500 Subject: [PATCH] add protect::overarching_goals::index also fixes test --- entity_api/src/coaching_session.rs | 2 +- web/src/protect/overarching_goals.rs | 1 - web/src/router.rs | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/entity_api/src/coaching_session.rs b/entity_api/src/coaching_session.rs index 6b03069..4045b46 100644 --- a/entity_api/src/coaching_session.rs +++ b/entity_api/src/coaching_session.rs @@ -160,7 +160,7 @@ mod tests { db.into_transaction_log(), [Transaction::from_sql_and_values( DatabaseBackend::Postgres, - r#"SELECT "coaching_sessions"."id", "coaching_sessions"."coaching_relationship_id", "coaching_sessions"."date", "coaching_sessions"."timezone", "coaching_sessions"."created_at", "coaching_sessions"."updated_at", "coaching_relationships"."id", "coaching_relationships"."coach_id", "coaching_relationships"."coachee_id", "coaching_relationships"."created_at", "coaching_relationships"."updated_at" FROM "refactor_platform"."coaching_sessions" LEFT JOIN "refactor_platform"."coaching_relationships" ON "coaching_sessions"."coaching_relationship_id" = "coaching_relationships"."id" WHERE "coaching_sessions"."id" = $1 LIMIT $2"#, + r#"SELECT "coaching_sessions"."id" AS "A_id", "coaching_sessions"."coaching_relationship_id" AS "A_coaching_relationship_id", "coaching_sessions"."date" AS "A_date", "coaching_sessions"."timezone" AS "A_timezone", "coaching_sessions"."created_at" AS "A_created_at", "coaching_sessions"."updated_at" AS "A_updated_at", "coaching_relationships"."id" AS "B_id", "coaching_relationships"."organization_id" AS "B_organization_id", "coaching_relationships"."coach_id" AS "B_coach_id", "coaching_relationships"."coachee_id" AS "B_coachee_id", "coaching_relationships"."created_at" AS "B_created_at", "coaching_relationships"."updated_at" AS "B_updated_at" FROM "refactor_platform"."coaching_sessions" LEFT JOIN "refactor_platform"."coaching_relationships" ON "coaching_sessions"."coaching_relationship_id" = "coaching_relationships"."id" WHERE "coaching_sessions"."id" = $1 LIMIT $2"#, [ coaching_session_id.into(), sea_orm::Value::BigUnsigned(Some(1)) diff --git a/web/src/protect/overarching_goals.rs b/web/src/protect/overarching_goals.rs index 5ba3d34..057d922 100644 --- a/web/src/protect/overarching_goals.rs +++ b/web/src/protect/overarching_goals.rs @@ -47,6 +47,5 @@ pub(crate) async fn index( (StatusCode::INTERNAL_SERVER_ERROR, "INTERNAL SERVER ERROR").into_response() } - } } diff --git a/web/src/router.rs b/web/src/router.rs index 7dec60c..31b368c 100644 --- a/web/src/router.rs +++ b/web/src/router.rs @@ -224,6 +224,10 @@ pub fn overarching_goal_routes(app_state: AppState) -> Router { "/overarching_goals", get(overarching_goal_controller::index), ) + .route_layer(from_fn_with_state( + app_state.clone(), + protect::overarching_goals::index, + )) .route( "/overarching_goals/:id", get(overarching_goal_controller::read),