diff --git a/01.workspace/heave/src/str/entity.rs b/01.workspace/heave/src/str/entity.rs index 1cb278e..ca84d8e 100644 --- a/01.workspace/heave/src/str/entity.rs +++ b/01.workspace/heave/src/str/entity.rs @@ -27,8 +27,11 @@ impl O { self.id = id.to_string(); self } - pub fn with_class(mut self, class: &str) -> Self { - self.class = class.to_string(); + pub fn with_class(mut self) -> Self + where + T: EAV, + { + self.class = T::class().to_string(); self } pub fn with_ref_date(mut self, ref_date: u64) -> Self { diff --git a/01.workspace/heave/src/tst/intended_use.rs b/01.workspace/heave/src/tst/intended_use.rs index a1aecd4..b75faf5 100644 --- a/01.workspace/heave/src/tst/intended_use.rs +++ b/01.workspace/heave/src/tst/intended_use.rs @@ -15,7 +15,7 @@ mod tests { impl From for Entity { fn from(value: Product) -> Entity { Entity::default() - .with_class("product") + .with_class::() .with_id(&value.id) .with_attribute("name", value.name) .with_attribute("price", value.price) diff --git a/01.workspace/heave/src/tst/rusty_budger_use.rs b/01.workspace/heave/src/tst/rusty_budger_use.rs index 885c4f8..e6a90e4 100644 --- a/01.workspace/heave/src/tst/rusty_budger_use.rs +++ b/01.workspace/heave/src/tst/rusty_budger_use.rs @@ -19,7 +19,7 @@ mod tests { impl From for Entity { fn from(value: OperationToCategory) -> Entity { Entity::default() - .with_class("operation_has_category") + .with_class::() .with_id(&value.id) .with_attribute("operation_id", value.operation_id) .with_attribute("category_id", value.category_id) @@ -49,7 +49,7 @@ mod tests { impl From for Entity { fn from(value: Category) -> Entity { Entity::default() - .with_class("category") + .with_class::() .with_id(&value.id) .with_attribute("label", value.label) } @@ -79,7 +79,7 @@ mod tests { impl From for Entity { fn from(value: Operation) -> Entity { Entity::default() - .with_class("operation") + .with_class::() .with_id(&value.id) .with_attribute("date", value.date) .with_attribute("amount", value.amount)