diff options
Diffstat (limited to 'crates/rocie-server/src/storage/sql/get/unit')
| -rw-r--r-- | crates/rocie-server/src/storage/sql/get/unit/mod.rs | 11 |
1 files changed, 8 insertions, 3 deletions
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<Vec<Self>, 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<Option<Self>, 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, |
