Skip to content

Commit

Permalink
Update to Rust 1.75.0
Browse files Browse the repository at this point in the history
This is really because code coverage started failing in CI,
I should lock the version installed… but this is fine.
  • Loading branch information
backspace committed Jan 1, 2024
1 parent 4906466 commit 0b942cf
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 42 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-unmnemonic-devices-vrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v4
- name: Set up database
run: psql -f unmnemonic_devices_vrs/tests/fixtures/schema.sql postgres://postgres:postgres@localhost:5432/postgres
- uses: dtolnay/rust-toolchain@1.68.2
- uses: dtolnay/rust-toolchain@1.75.0
- uses: Swatinem/rust-cache@v2
- name: Run tests
working-directory: unmnemonic_devices_vrs
Expand All @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.68.2
- uses: dtolnay/rust-toolchain@1.75.0
with:
components: rustfmt
- name: Enforce formatting
Expand All @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v4
- name: Set up database
run: psql -f unmnemonic_devices_vrs/tests/fixtures/schema.sql postgres://postgres:postgres@localhost:5432/postgres
- uses: dtolnay/rust-toolchain@1.68.2
- uses: dtolnay/rust-toolchain@1.75.0
with:
components: clippy
- uses: Swatinem/rust-cache@v2
Expand All @@ -85,7 +85,7 @@ jobs:
uses: actions/checkout@v4
- name: Set up database
run: psql -f unmnemonic_devices_vrs/tests/fixtures/schema.sql postgres://postgres:postgres@localhost:5432/postgres
- uses: dtolnay/rust-toolchain@1.68.2
- uses: dtolnay/rust-toolchain@1.75.0
- name: Install postgresql-client
run: sudo apt-get update && sudo apt-get install postgresql-client -y
- uses: Swatinem/rust-cache@v2
Expand Down
14 changes: 13 additions & 1 deletion unmnemonic_devices_vrs/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::WrappedPrompts;
use crate::WrappedPromptsSerialisation;
use axum::response::Response;
use axum::{extract::State, http::StatusCode, middleware::Next};
use serde::Deserialize;
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
use sqlx::Row;
use std::collections::HashMap;
Expand Down Expand Up @@ -105,3 +105,15 @@ pub async fn store_call_path_middleware<B>(

Ok(next.run(req).await)
}

#[derive(Serialize)]
pub struct ConfirmRecordingPrompt {
pub recording_url: String,
pub action: String,
}

#[derive(Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TwilioParams {
pub call_sid: String,
}
14 changes: 4 additions & 10 deletions unmnemonic_devices_vrs/src/routes/recordings_objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
use sqlx::{types::Uuid, PgPool, Row};

use crate::{
helpers::MaybeRecordingParams,
helpers::{ConfirmRecordingPrompt, MaybeRecordingParams},
render_xml::RenderXml,
twilio_form::{TwilioForm, TwilioRecordingForm},
AppState,
Expand Down Expand Up @@ -131,7 +131,7 @@ pub async fn post_recording_objects(
}

#[derive(Serialize)]
pub struct UnrecordedIntroduction {
struct UnrecordedIntroduction {
object_type: String,
skip_message: bool,
redirect: String,
Expand Down Expand Up @@ -241,12 +241,6 @@ pub async fn get_recording_object(
.into_response()
}

#[derive(Serialize)]
pub struct ConfirmRecordingPrompt {
recording_url: String,
action: String,
}

#[axum_macros::debug_handler]
pub async fn post_recording_object(
Path((object, id)): Path<(String, Uuid)>,
Expand Down Expand Up @@ -276,7 +270,7 @@ pub async fn post_recording_object(
}

#[derive(Deserialize)]
pub struct DecideParams {
pub struct ObjectDecideParams {
recording_url: String,
unrecorded: Option<String>,
}
Expand All @@ -285,7 +279,7 @@ pub struct DecideParams {
pub async fn post_recording_object_decide(
Key(_key): Key,
Path((object, id)): Path<(String, Uuid)>,
params: Query<DecideParams>,
params: Query<ObjectDecideParams>,
State(state): State<AppState>,
Form(form): Form<TwilioForm>,
) -> impl IntoResponse {
Expand Down
14 changes: 4 additions & 10 deletions unmnemonic_devices_vrs/src/routes/recordings_prompts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use sqlx::PgPool;
use uuid::Uuid;

use crate::{
helpers::{get_all_prompts, MaybeRecordingParams},
helpers::{get_all_prompts, ConfirmRecordingPrompt, MaybeRecordingParams},
render_xml::RenderXml,
twilio_form::{TwilioForm, TwilioRecordingForm},
AppState,
Expand Down Expand Up @@ -115,7 +115,7 @@ pub struct PromptNotFound {
}

#[derive(Serialize)]
pub struct UnrecordedIntroduction {
struct UnrecordedIntroduction {
skip_message: bool,
character_name: String,
redirect: String,
Expand Down Expand Up @@ -239,12 +239,6 @@ pub async fn get_character_prompt(
}
}

#[derive(Serialize)]
pub struct ConfirmRecordingPrompt {
recording_url: String,
action: String,
}

#[axum_macros::debug_handler]
pub async fn post_character_prompt(
Key(_key): Key,
Expand Down Expand Up @@ -275,7 +269,7 @@ pub async fn post_character_prompt(
}

#[derive(Deserialize)]
pub struct DecideParams {
pub struct PromptDecideParams {
recording_url: String,
unrecorded: Option<String>,
}
Expand All @@ -284,7 +278,7 @@ pub struct DecideParams {
pub async fn post_character_prompt_decide(
Key(_key): Key,
Path((character_name, prompt_name)): Path<(String, String)>,
params: Query<DecideParams>,
params: Query<PromptDecideParams>,
State(state): State<AppState>,
Form(form): Form<TwilioForm>,
) -> Redirect {
Expand Down
8 changes: 1 addition & 7 deletions unmnemonic_devices_vrs/src/routes/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use base64::{engine::general_purpose, Engine as _};
use serde::{Deserialize, Serialize};
use serde_querystring_axum::QueryString;

use crate::{render_xml::RenderXml, twilio_form::TwilioForm, AppState};
use crate::{helpers::TwilioParams, render_xml::RenderXml, twilio_form::TwilioForm, AppState};

#[derive(Deserialize)]
pub struct RootParams {
Expand All @@ -36,12 +36,6 @@ pub async fn get_prerecord(Key(key): Key, State(state): State<AppState>) -> impl
)
}

#[derive(Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TwilioParams {
call_sid: String,
}

#[axum_macros::debug_handler]
pub async fn get_record(
Key(key): Key,
Expand Down
17 changes: 7 additions & 10 deletions unmnemonic_devices_vrs/src/routes/teams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ use axum::{
};
use axum_template::Key;
use base64::{engine::general_purpose, Engine as _};
use serde::{Deserialize, Serialize};
use serde::Serialize;
use serde_querystring_axum::QueryString;
use sqlx::types::Uuid;
use std::env;

use crate::config::{ConfigProvider, EnvVarProvider};
use crate::{
config::{ConfigProvider, EnvVarProvider},
helpers::TwilioParams,
};
use crate::{render_xml::RenderXml, twilio_form::TwilioForm, AppState};

#[derive(Serialize)]
pub struct Teams {
struct Teams {
teams: Vec<Team>,
}

#[derive(sqlx::FromRow, Serialize)]
pub struct Team {
struct Team {
id: Uuid,
name: String,
voicepass: String,
Expand Down Expand Up @@ -146,12 +149,6 @@ pub async fn post_confirm_team(
}
}

#[derive(Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct TwilioParams {
call_sid: String,
}

#[derive(Serialize)]
pub struct TeamAndMaybeEncouraging {
team: Team,
Expand Down

0 comments on commit 0b942cf

Please sign in to comment.