inbox: show mails in descending order

This commit is contained in:
Guilherme Rugai Freire 2024-07-21 02:06:54 -03:00
parent 9c600d863e
commit 661922ce35
No known key found for this signature in database
GPG Key ID: AC1D9B6E48E16AC1

View File

@ -111,7 +111,20 @@ func (sr ServerResouces) handleInbox(res http.ResponseWriter, req *http.Request)
}
defer tx.Commit()
stmt, err := tx.Prepare("SELECT mails.id, mails.arrived_at, mails.rcpt_addr, mails.from_addr, mails.subject FROM mails WHERE mails.rcpt_addr = ?")
stmt, err := tx.Prepare(
"SELECT " +
"mails.id, " +
"mails.arrived_at, " +
"mails.rcpt_addr, " +
"mails.from_addr, " +
"mails.subject " +
"FROM " +
"mails " +
"WHERE " +
"mails.rcpt_addr = ? " +
"ORDER BY " +
"mails.arrived_at DESC",
)
if err != nil {
res.WriteHeader(500)
res.Write([]byte("internal server error"))