Sort posts by published dated descending
This commit is contained in:
parent
c89b6e6754
commit
5715225050
1 changed files with 1 additions and 0 deletions
|
@ -30,6 +30,7 @@ pub(crate) async fn posts(state: State<AppState>) -> impl IntoResponse {
|
|||
|
||||
let posts: Vec<post::Model> = Post::find()
|
||||
.filter(post::Column::Draft.eq(false))
|
||||
.order_by_desc(post::Column::Published)
|
||||
.all(&state.db_conn)
|
||||
.await
|
||||
.expect("Failed to load posts!");
|
||||
|
|
Reference in a new issue