aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rocie-server/src/storage/sql/get/unit
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-10-08 11:54:04 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-10-08 11:54:04 +0200
commit08cf86a44a9a7c513cd12cbc4a0bac7c029b9ded (patch)
tree88b202b25ec22b86f3b4df9f2022b7b23ec3cba1 /crates/rocie-server/src/storage/sql/get/unit
parentchore(crates/rocie-client): Regenerate (diff)
downloadserver-08cf86a44a9a7c513cd12cbc4a0bac7c029b9ded.zip
feat(crates/rocie-server/unit-property): Init
Diffstat (limited to 'crates/rocie-server/src/storage/sql/get/unit')
-rw-r--r--crates/rocie-server/src/storage/sql/get/unit/mod.rs11
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,