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"
|
sha256 = "1.1"
|
||||||
jsonwebtoken = "8.3"
|
jsonwebtoken = "8.3"
|
||||||
tera = "1"
|
tera = "1"
|
||||||
genpdf = "0.2"
|
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
|
|||||||
@ -26,7 +26,7 @@ pub async fn get_events_preview(
|
|||||||
let result = query_as!(
|
let result = query_as!(
|
||||||
Event,
|
Event,
|
||||||
r#"
|
r#"
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
@ -37,13 +37,13 @@ SELECT
|
|||||||
place,
|
place,
|
||||||
price,
|
price,
|
||||||
created_by
|
created_by
|
||||||
FROM
|
FROM
|
||||||
events
|
events
|
||||||
WHERE
|
WHERE
|
||||||
time_start BETWEEN now() AND now() + interval '1 week'
|
time_start BETWEEN now() AND now() + interval '1 week'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
time_start
|
time_start
|
||||||
LIMIT
|
LIMIT
|
||||||
10;
|
10;
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
@ -74,7 +74,7 @@ pub async fn get_all_events(
|
|||||||
let result = query_as!(
|
let result = query_as!(
|
||||||
Event,
|
Event,
|
||||||
r#"
|
r#"
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
@ -85,13 +85,13 @@ SELECT
|
|||||||
place,
|
place,
|
||||||
price,
|
price,
|
||||||
created_by
|
created_by
|
||||||
FROM
|
FROM
|
||||||
events
|
events
|
||||||
WHERE
|
WHERE
|
||||||
time_start > now()
|
time_start > now()
|
||||||
ORDER BY
|
ORDER BY
|
||||||
time_start
|
time_start
|
||||||
LIMIT
|
LIMIT
|
||||||
100;
|
100;
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
@ -135,7 +135,7 @@ pub async fn get_recent_events(
|
|||||||
e.created_by
|
e.created_by
|
||||||
FROM events e
|
FROM events e
|
||||||
INNER JOIN event_attendees ea
|
INNER JOIN event_attendees ea
|
||||||
ON ea.event_id = e.id
|
ON ea.event_id = e.id AND ea.confirmed
|
||||||
WHERE
|
WHERE
|
||||||
ea.user_id = $1
|
ea.user_id = $1
|
||||||
;
|
;
|
||||||
|
|||||||
@ -10,12 +10,6 @@ use axum::{
|
|||||||
Json,
|
Json,
|
||||||
};
|
};
|
||||||
use axum_auth::AuthBearer;
|
use axum_auth::AuthBearer;
|
||||||
use genpdf::{
|
|
||||||
elements::{self, TableLayout},
|
|
||||||
fonts::{self, FontFamily},
|
|
||||||
style::{Style, StyledString},
|
|
||||||
Document,
|
|
||||||
};
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use sqlx::{query_as, types::chrono::Local};
|
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