fixed get_previous_events endpoint
This commit is contained in:
parent
df532dcf8b
commit
98568e38e2
@ -17,5 +17,4 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
sha256 = "1.1"
|
||||
jsonwebtoken = "8.3"
|
||||
tera = "1"
|
||||
genpdf = "0.2"
|
||||
lazy_static = "1.4"
|
||||
|
||||
@ -26,25 +26,25 @@ pub async fn get_events_preview(
|
||||
let result = query_as!(
|
||||
Event,
|
||||
r#"
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
time_start,
|
||||
time_end,
|
||||
event_type AS "event_type!: EventType",
|
||||
points,
|
||||
place,
|
||||
price,
|
||||
created_by
|
||||
FROM
|
||||
events
|
||||
WHERE
|
||||
time_start BETWEEN now() AND now() + interval '1 week'
|
||||
ORDER BY
|
||||
time_start
|
||||
LIMIT
|
||||
10;
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
time_start,
|
||||
time_end,
|
||||
event_type AS "event_type!: EventType",
|
||||
points,
|
||||
place,
|
||||
price,
|
||||
created_by
|
||||
FROM
|
||||
events
|
||||
WHERE
|
||||
time_start BETWEEN now() AND now() + interval '1 week'
|
||||
ORDER BY
|
||||
time_start
|
||||
LIMIT
|
||||
10;
|
||||
"#
|
||||
)
|
||||
.fetch_all(&app_state.db_pool)
|
||||
@ -74,25 +74,25 @@ pub async fn get_all_events(
|
||||
let result = query_as!(
|
||||
Event,
|
||||
r#"
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
time_start,
|
||||
time_end,
|
||||
event_type AS "event_type!: EventType",
|
||||
points,
|
||||
place,
|
||||
price,
|
||||
created_by
|
||||
FROM
|
||||
events
|
||||
WHERE
|
||||
time_start > now()
|
||||
ORDER BY
|
||||
time_start
|
||||
LIMIT
|
||||
100;
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
time_start,
|
||||
time_end,
|
||||
event_type AS "event_type!: EventType",
|
||||
points,
|
||||
place,
|
||||
price,
|
||||
created_by
|
||||
FROM
|
||||
events
|
||||
WHERE
|
||||
time_start > now()
|
||||
ORDER BY
|
||||
time_start
|
||||
LIMIT
|
||||
100;
|
||||
"#
|
||||
)
|
||||
.fetch_all(&app_state.db_pool)
|
||||
@ -135,7 +135,7 @@ pub async fn get_recent_events(
|
||||
e.created_by
|
||||
FROM events e
|
||||
INNER JOIN event_attendees ea
|
||||
ON ea.event_id = e.id
|
||||
ON ea.event_id = e.id AND ea.confirmed
|
||||
WHERE
|
||||
ea.user_id = $1
|
||||
;
|
||||
|
||||
@ -10,12 +10,6 @@ use axum::{
|
||||
Json,
|
||||
};
|
||||
use axum_auth::AuthBearer;
|
||||
use genpdf::{
|
||||
elements::{self, TableLayout},
|
||||
fonts::{self, FontFamily},
|
||||
style::{Style, StyledString},
|
||||
Document,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use serde_json::json;
|
||||
use sqlx::{query_as, types::chrono::Local};
|
||||
@ -98,5 +92,5 @@ pub async fn get_report(
|
||||
}
|
||||
};
|
||||
|
||||
(StatusCode::OK, Json(json!({ "report": report }))).into_response()
|
||||
(StatusCode::OK, report).into_response()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user