1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2025-03-14 05:04:40 -05:00

new: Enforce ordering of data

Closes #46
Data is returned in order of id, which should match the order it was
inserted in. In the WebUI, the entries are shown in reverse, so the
latest link is at the top.
This commit is contained in:
Sayantan Santra 2025-03-03 12:27:59 -06:00
parent c557b8b262
commit 6f419c7b3d
Signed by: SinTan1729
GPG key ID: 0538DD402EA50898
2 changed files with 2 additions and 2 deletions

View file

@ -33,7 +33,7 @@ pub fn find_url(shortlink: &str, db: &Connection, needhits: bool) -> (Option<Str
// Get all URLs in DB
pub fn getall(db: &Connection) -> Vec<DBRow> {
let mut statement = db
.prepare_cached("SELECT * FROM urls")
.prepare_cached("SELECT * FROM urls ORDER BY id ASC")
.expect("Error preparing SQL statement for getall.");
let mut data = statement

View file

@ -56,7 +56,7 @@ const refreshData = async () => {
}
} else {
let data = await res.json();
displayData(data);
displayData(data.reverse());
}
}