diff --git a/unmnemonic_devices_vrs/src/routes/teams.rs b/unmnemonic_devices_vrs/src/routes/teams.rs index 91ac1c96..91c95347 100644 --- a/unmnemonic_devices_vrs/src/routes/teams.rs +++ b/unmnemonic_devices_vrs/src/routes/teams.rs @@ -29,7 +29,7 @@ pub struct Team { #[axum_macros::debug_handler] pub async fn get_teams(Key(key): Key, State(state): State) -> impl IntoResponse { let teams = sqlx::query_as::<_, Team>( - "SELECT *, ARRAY[]::VARCHAR[] AS excerpts, ARRAY[]::VARCHAR[] AS answers FROM teams", + "SELECT *, ARRAY[]::VARCHAR[] AS excerpts, ARRAY[]::VARCHAR[] AS answers FROM teams WHERE voicepass IS NOT NULL", ) .fetch_all(&state.db) .await diff --git a/unmnemonic_devices_vrs/tests/api/fixtures/teams-with-no-voicepass.sql b/unmnemonic_devices_vrs/tests/api/fixtures/teams-with-no-voicepass.sql new file mode 100644 index 00000000..9b020f21 --- /dev/null +++ b/unmnemonic_devices_vrs/tests/api/fixtures/teams-with-no-voicepass.sql @@ -0,0 +1,9 @@ +INSERT INTO + public.teams (id, name, inserted_at, updated_at) +VALUES + ( + '00000000-db52-4c99-985f-337e266f7832', + 'hmm', + now(), + now() + ); \ No newline at end of file diff --git a/unmnemonic_devices_vrs/tests/api/teams.rs b/unmnemonic_devices_vrs/tests/api/teams.rs index f9099c6a..5798d31a 100644 --- a/unmnemonic_devices_vrs/tests/api/teams.rs +++ b/unmnemonic_devices_vrs/tests/api/teams.rs @@ -9,7 +9,7 @@ use unmnemonic_devices_vrs::InjectableServices; use wiremock::matchers::{body_string, method, path_regex}; use wiremock::{Mock, MockServer, ResponseTemplate}; -#[sqlx::test(fixtures("schema", "teams"))] +#[sqlx::test(fixtures("schema", "teams", "teams-with-no-voicepass"))] async fn teams_show_gathers_team_voicepasses(db: PgPool) { let response = get(db, "/teams", false) .await