diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index f8afc7e..0000000 --- a/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -.woodpecker/ -target/ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 130951a..0000000 --- a/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM rust:1.69-alpine AS builder - -ARG DI_VER=1.2.5 - -RUN apk update && \ - apk add --no-cache build-base curl - -WORKDIR /build - -# Build dumb-init -RUN curl -Lo - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.tar.gz" | tar -xzf - && \ - cd "dumb-init-${DI_VER}" && \ - make SHELL=/bin/sh && \ - mv dumb-init .. - -WORKDIR /build/affy - -COPY ./ ./ - -RUN cargo build --release && \ - [ "$(readelf -d target/release/affy | grep NEEDED | wc -l)" = 0 ] - - -FROM busybox:1.36.0 - -COPY --from=builder /build/dumb-init /build/affy/target/release/affy /bin/ - -WORKDIR /data - -USER www-data:www-data - -ENTRYPOINT ["/bin/dumb-init", "--"] -CMD ["/bin/affy"] diff --git a/affluences-api/src/lib.rs b/affluences-api/src/lib.rs index 7994b0d..3e11326 100644 --- a/affluences-api/src/lib.rs +++ b/affluences-api/src/lib.rs @@ -22,19 +22,11 @@ impl AffluencesClient { pub async fn search(&self, query: String) -> reqwest::Result { let url = "https://api.affluences.com/app/v3/sites"; - let body = SiteSearch { - search_query: query, + let body = SiteSearch{ + search_query: query }; - Ok(self - .client - .post(url) - .json(&body) - .send() - .await? - .json::>() - .await? - .data) + Ok(self.client.post(url).json(&body).send().await?.json::>().await?.data) } pub async fn available( @@ -89,9 +81,3 @@ impl AffluencesClient { .await } } - -impl Default for AffluencesClient { - fn default() -> Self { - AffluencesClient::new() - } -} diff --git a/affluences-api/src/models/hh_mm_time_format.rs b/affluences-api/src/models/hh_mm_time_format.rs index 8858d4f..7d535f6 100644 --- a/affluences-api/src/models/hh_mm_time_format.rs +++ b/affluences-api/src/models/hh_mm_time_format.rs @@ -1,7 +1,7 @@ use chrono::NaiveTime; use serde::{self, Deserialize, Deserializer, Serializer}; -const FORMAT: &str = "%H:%M"; +const FORMAT: &'static str = "%H:%M"; pub fn serialize(time: &NaiveTime, serializer: S) -> Result where diff --git a/affluences-api/src/models/site_data.rs b/affluences-api/src/models/site_data.rs index 68f5efb..c2a7d98 100644 --- a/affluences-api/src/models/site_data.rs +++ b/affluences-api/src/models/site_data.rs @@ -1,4 +1,4 @@ -use serde::{Deserialize, Serialize}; +use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug)] pub struct Data { @@ -107,12 +107,12 @@ pub struct SiteData { #[derive(Serialize, Debug)] pub struct SiteSearch { - pub search_query: String, + pub search_query: String } #[derive(Serialize, Deserialize, Debug)] pub struct SiteSearchResponse { pub page: u32, pub max_size: u32, - pub results: Vec, + pub results: Vec } diff --git a/src/commands.rs b/src/commands.rs index b955679..6a2c548 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -4,7 +4,7 @@ use chrono::{Duration, NaiveDate}; use uuid::{uuid, Uuid}; const STERRE_BIB_ID: Uuid = uuid!("4737e57a-ee05-4f7b-901a-7bb541eeb297"); -const TIME_FORMAT: &str = "%H:%M"; +const TIME_FORMAT: &'static str = "%H:%M"; /// Show this help menu #[poise::command(prefix_command, track_edits, slash_command)] @@ -90,7 +90,7 @@ pub async fn available(ctx: Context<'_>, date: NaiveDate) -> Result<(), Error> { let mut fields: Vec<(String, String, bool)> = Default::default(); for resource in &resources { - if resource.hours.is_empty() { + if resource.hours.len() == 0 { fields.push(( resource.resource_name.clone(), "Nothing available.".to_string(), @@ -158,5 +158,5 @@ pub async fn available(ctx: Context<'_>, date: NaiveDate) -> Result<(), Error> { // ctx: Context<'_>, // date: NaiveDate, // ) -> Result<(), Error> { - + // }