1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//! Contains the implementation of [`NewSeedDto`].

use uuid::Uuid;

use crate::model::entity::NewSeed;

use super::NewSeedDto;

impl From<(NewSeedDto, Uuid)> for NewSeed {
    fn from((new_seed, user_id): (NewSeedDto, Uuid)) -> Self {
        Self {
            name: new_seed.name,
            plant_id: new_seed.plant_id,
            harvest_year: new_seed.harvest_year,
            quantity: new_seed.quantity,
            use_by: new_seed.use_by,
            origin: new_seed.origin,
            taste: new_seed.taste,
            yield_: new_seed.yield_,
            generation: new_seed.generation,
            quality: new_seed.quality,
            price: new_seed.price,
            notes: new_seed.notes,
            created_by: user_id,
        }
    }
}