mirror of
https://git.alemi.dev/guestbook.rs.git
synced 2024-11-14 04:19:21 +01:00
fix: return pages in descending order of timestamp
This commit is contained in:
parent
41f86634e5
commit
6fc27b47db
1 changed files with 1 additions and 1 deletions
|
@ -87,7 +87,7 @@ impl StorageProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn extract(&self, offset: i32, window: i32, public: bool) -> sqlx::Result<Vec<PageView>> {
|
pub async fn extract(&self, offset: i32, window: i32, public: bool) -> sqlx::Result<Vec<PageView>> {
|
||||||
let out = sqlx::query_as::<_, Page>("SELECT * FROM pages WHERE public = $1 LIMIT $2 OFFSET $3")
|
let out = sqlx::query_as::<_, Page>("SELECT * FROM pages WHERE public = $1 ORDER BY timestamp DESC LIMIT $2 OFFSET $3")
|
||||||
.bind(if public { 1 } else { 0 }) // TODO since AnyPool won't handle booleans we compare with an integer
|
.bind(if public { 1 } else { 0 }) // TODO since AnyPool won't handle booleans we compare with an integer
|
||||||
.bind(window)
|
.bind(window)
|
||||||
.bind(offset)
|
.bind(offset)
|
||||||
|
|
Loading…
Reference in a new issue