87 lines
1.9 KiB
Rust
87 lines
1.9 KiB
Rust
|
use strum::IntoStaticStr;
|
||
|
|
||
|
pub mod create_category {
|
||
|
use model::v2::*;
|
||
|
|
||
|
use crate::stocks::Error;
|
||
|
|
||
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||
|
pub struct Input {
|
||
|
pub parent_id: Option<CategoryId>,
|
||
|
pub name: CategoryName,
|
||
|
pub key: CategoryKey,
|
||
|
pub svg: CategorySvg,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||
|
pub struct Details {
|
||
|
pub product: Category,
|
||
|
}
|
||
|
|
||
|
pub type Output = Result<Details, Error>;
|
||
|
}
|
||
|
|
||
|
pub mod delete_category {
|
||
|
use model::v2::*;
|
||
|
|
||
|
use crate::stocks::Error;
|
||
|
|
||
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||
|
pub struct Input {
|
||
|
pub category_id: CategoryId,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||
|
pub struct Details {}
|
||
|
|
||
|
pub type Output = Result<Details, Error>;
|
||
|
}
|
||
|
|
||
|
pub mod update_category {
|
||
|
use model::v2::*;
|
||
|
|
||
|
use crate::stocks::Error;
|
||
|
|
||
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||
|
pub struct Input {
|
||
|
pub id: CategoryId,
|
||
|
pub parent_id: Option<CategoryId>,
|
||
|
pub name: CategoryName,
|
||
|
pub key: CategoryKey,
|
||
|
pub svg: CategorySvg,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||
|
pub struct Details {
|
||
|
pub limit: Limit,
|
||
|
pub offset: Offset,
|
||
|
}
|
||
|
|
||
|
pub type Output = Result<Details, Error>;
|
||
|
}
|
||
|
|
||
|
pub mod all_categories {
|
||
|
use model::v2::*;
|
||
|
|
||
|
use crate::stocks::Error;
|
||
|
|
||
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||
|
pub struct Input {}
|
||
|
|
||
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||
|
pub struct Details {
|
||
|
pub categories: Vec<Category>,
|
||
|
}
|
||
|
|
||
|
pub type Output = Result<Details, Error>;
|
||
|
}
|
||
|
|
||
|
#[derive(
|
||
|
Copy, Clone, Debug, PartialOrd, PartialEq, serde::Serialize, serde::Deserialize, IntoStaticStr,
|
||
|
)]
|
||
|
pub enum Topic {
|
||
|
CategoryCreated,
|
||
|
CategoryUpdated,
|
||
|
CategoryDeleted,
|
||
|
}
|