blob: 6225a4b92d98ebebb53eae585dd64956c7e0f3a3 (
plain) (
blame)
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
28
29
30
31
|
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use crate::storage::sql::mk_id;
/// The grouping system for recipes.
///
/// Every recipe can have a related parent, and every parent can have a parent themselves.
/// As such, the recipe list constructs a DAG.
#[derive(Clone, ToSchema, Serialize, Deserialize)]
pub(crate) struct RecipeParent {
/// The id of the recipe parent.
pub(crate) id: RecipeParentId,
/// The optional id of the parent of this recipe parent.
///
/// This must not form a cycle.
#[schema(nullable = false)]
pub(crate) parent: Option<RecipeParentId>,
/// The name of the recipe parent.
///
/// This should be globally unique, to make searching easier for the user.
pub(crate) name: String,
/// An optional description of this recipe parent.
#[schema(nullable = false)]
pub(super) description: Option<String>,
}
mk_id!(RecipeParentId and RecipeParentIdStub);
|