Fix formatting of short ID on label

PostgreSQL adds a space in front of the number if not specified
otherwise, to account for a minus sign with negative numbers. As all
short IDs are positive, it can be suppressed here.
This commit is contained in:
Simon Bruder 2024-07-27 15:58:38 +02:00
parent 716ac1a698
commit 6e4e8d3d93
Signed by: simon
GPG key ID: 347FF8699CDA0776
2 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "SELECT id AS \"id?\", to_char(short_id, '000000') AS \"short_id?\"\n FROM items\n WHERE id = ANY ($1)",
"query": "SELECT id AS \"id?\", to_char(short_id, 'FM000000') AS \"short_id?\"\n FROM items\n WHERE id = ANY ($1)",
"describe": {
"columns": [
{
@ -24,5 +24,5 @@
null
]
},
"hash": "265104a03d3ce2a41b58b1fa5cac5a55622b6d4f035d0276d1644f6500491989"
"hash": "b7b928c24918aa24f80e4c74eeca04b60bf7295a6d7505ab4897e18b8d7cfbee"
}

View file

@ -12,7 +12,7 @@ impl ItemRepository {
pub async fn label_pages(&self, ids: &[Uuid]) -> sqlx::Result<Vec<LabelPage>> {
query_as!(
LabelPage,
r#"SELECT id AS "id?", to_char(short_id, '000000') AS "short_id?"
r#"SELECT id AS "id?", to_char(short_id, 'FM000000') AS "short_id?"
FROM items
WHERE id = ANY ($1)"#,
ids