backend/model/dto/
new_seed_impl.rs

1//! Contains the implementation of [`NewSeedDto`].
2
3use uuid::Uuid;
4
5use crate::model::entity::NewSeed;
6
7use super::NewSeedDto;
8
9impl From<(NewSeedDto, Uuid)> for NewSeed {
10    fn from((new_seed, user_id): (NewSeedDto, Uuid)) -> Self {
11        Self {
12            name: new_seed.name,
13            plant_id: new_seed.plant_id,
14            harvest_year: new_seed.harvest_year,
15            quantity: new_seed.quantity,
16            use_by: new_seed.use_by,
17            origin: new_seed.origin,
18            taste: new_seed.taste,
19            yield_: new_seed.yield_,
20            generation: new_seed.generation,
21            quality: new_seed.quality,
22            price: new_seed.price,
23            notes: new_seed.notes,
24            created_by: user_id,
25        }
26    }
27}