From 08cf86a44a9a7c513cd12cbc4a0bac7c029b9ded Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Wed, 8 Oct 2025 11:54:04 +0200 Subject: feat(crates/rocie-server/unit-property): Init --- crates/rocie-server/src/storage/sql/get/unit/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'crates/rocie-server/src/storage/sql/get/unit') diff --git a/crates/rocie-server/src/storage/sql/get/unit/mod.rs b/crates/rocie-server/src/storage/sql/get/unit/mod.rs index 6c2bbcc..6f5d297 100644 --- a/crates/rocie-server/src/storage/sql/get/unit/mod.rs +++ b/crates/rocie-server/src/storage/sql/get/unit/mod.rs @@ -1,6 +1,9 @@ use crate::{ app::App, - storage::sql::unit::{Unit, UnitId}, + storage::sql::{ + unit::{Unit, UnitId}, + unit_property::UnitPropertyId, + }, }; use sqlx::query; @@ -9,7 +12,7 @@ impl Unit { pub(crate) async fn get_all(app: &App) -> Result, get_all::Error> { let records = query!( " - SELECT id, full_name_singular, full_name_plural, short_name, description + SELECT id, unit_property, full_name_singular, full_name_plural, short_name, description FROM units " ) @@ -20,6 +23,7 @@ impl Unit { .into_iter() .map(|record| Self { id: UnitId::from_db(&record.id), + unit_property: UnitPropertyId::from_db(&record.unit_property), full_name_singular: record.full_name_singular, full_name_plural: record.full_name_plural, short_name: record.short_name, @@ -31,7 +35,7 @@ impl Unit { pub(crate) async fn from_id(app: &App, id: UnitId) -> Result, from_id::Error> { let record = query!( " - SELECT full_name_singular, full_name_plural, short_name, description + SELECT full_name_singular, unit_property, full_name_plural, short_name, description FROM units WHERE id = ? ", @@ -43,6 +47,7 @@ impl Unit { if let Some(record) = record { Ok(Some(Self { id, + unit_property: UnitPropertyId::from_db(&record.unit_property), full_name_singular: record.full_name_singular, full_name_plural: record.full_name_plural, short_name: record.short_name, -- cgit 1.4.1