diff --git a/Dockerfile b/Dockerfile index 901ee96..c87d3f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,8 @@ ENV DATABASE_URL="postgres://school_app_api_user:school_app_api_pass@mdev.local/ WORKDIR /usr/src/school_app_api COPY . . +RUN cargo install sqlx-cli RUN cargo install --path . -FROM debian:buster-slim -COPY --from=build /usr/local/cargo/bin/school_app_api /usr/local/bin/school_app_api -CMD ["school_app_api"] +CMD ["start.sh"] diff --git a/src/main.rs b/src/main.rs index ee60787..bf769cc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,6 +45,7 @@ async fn main() { .route("/user/signin", post(signin)) .route("/event", post(events::create_event)) .route("/event/preview", get(events::get_events_preview)) + .route("/report", get(report::get_report)) .with_state(AppState { db_pool, jwt_encode, diff --git a/src/report.rs b/src/report.rs index e6f2c30..b4dbcbb 100644 --- a/src/report.rs +++ b/src/report.rs @@ -6,7 +6,7 @@ use axum::{ }; use axum_auth::AuthBearer; use serde_json::json; -use sqlx::{query, query_as}; +use sqlx::query_as; use crate::{ jwt::handle_token, @@ -14,7 +14,7 @@ use crate::{ AppState, }; -pub async fn report( +pub async fn get_report( AuthBearer(token): AuthBearer, State(app_state): State, Query(report_query): Query, diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..1b37316 --- /dev/null +++ b/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sqlx migrate run +RUST_LOG="DEBUG" school_app_api