From 6e4e8d3d9306749c9da9c11b95eb7c74f93fb138 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 27 Jul 2024 15:58:38 +0200 Subject: [PATCH] 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. --- ...aa24f80e4c74eeca04b60bf7295a6d7505ab4897e18b8d7cfbee.json} | 4 ++-- src/database/items/label.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename .sqlx/{query-265104a03d3ce2a41b58b1fa5cac5a55622b6d4f035d0276d1644f6500491989.json => query-b7b928c24918aa24f80e4c74eeca04b60bf7295a6d7505ab4897e18b8d7cfbee.json} (63%) diff --git a/.sqlx/query-265104a03d3ce2a41b58b1fa5cac5a55622b6d4f035d0276d1644f6500491989.json b/.sqlx/query-b7b928c24918aa24f80e4c74eeca04b60bf7295a6d7505ab4897e18b8d7cfbee.json similarity index 63% rename from .sqlx/query-265104a03d3ce2a41b58b1fa5cac5a55622b6d4f035d0276d1644f6500491989.json rename to .sqlx/query-b7b928c24918aa24f80e4c74eeca04b60bf7295a6d7505ab4897e18b8d7cfbee.json index b4dbb06..66f1c7a 100644 --- a/.sqlx/query-265104a03d3ce2a41b58b1fa5cac5a55622b6d4f035d0276d1644f6500491989.json +++ b/.sqlx/query-b7b928c24918aa24f80e4c74eeca04b60bf7295a6d7505ab4897e18b8d7cfbee.json @@ -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" } diff --git a/src/database/items/label.rs b/src/database/items/label.rs index 8e73b3d..6802dd7 100644 --- a/src/database/items/label.rs +++ b/src/database/items/label.rs @@ -12,7 +12,7 @@ impl ItemRepository { pub async fn label_pages(&self, ids: &[Uuid]) -> sqlx::Result> { 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