add: products api
This commit is contained in:
parent
2be2409d66
commit
cf2af1e1e9
6 changed files with 241 additions and 9 deletions
|
@ -6,6 +6,7 @@ pub mod domains;
|
|||
pub mod journals;
|
||||
pub mod notes;
|
||||
pub mod notifications;
|
||||
pub mod products;
|
||||
pub mod reactions;
|
||||
pub mod reports;
|
||||
pub mod requests;
|
||||
|
@ -31,6 +32,7 @@ use tetratto_core::model::{
|
|||
littleweb::{DomainData, DomainTld, ServiceFsEntry},
|
||||
oauth::AppScope,
|
||||
permissions::{FinePermission, SecondaryPermission},
|
||||
products::{ProductType, ProductPrice},
|
||||
reactions::AssetType,
|
||||
stacks::{StackMode, StackPrivacy, StackSort},
|
||||
};
|
||||
|
@ -652,6 +654,17 @@ pub fn routes() -> Router {
|
|||
.route("/domains/{id}", get(domains::get_request))
|
||||
.route("/domains/{id}", delete(domains::delete_request))
|
||||
.route("/domains/{id}/data", post(domains::update_data_request))
|
||||
// products
|
||||
.route("/products", get(products::list_request))
|
||||
.route("/products", post(products::create_request))
|
||||
.route("/products/{id}", get(products::get_request))
|
||||
.route("/products/{id}", delete(products::delete_request))
|
||||
.route("/products/{id}/name", post(products::update_name_request))
|
||||
.route(
|
||||
"/products/{id}/description",
|
||||
post(products::update_description_request),
|
||||
)
|
||||
.route("/products/{id}/price", post(products::update_price_request))
|
||||
}
|
||||
|
||||
pub fn lw_routes() -> Router {
|
||||
|
@ -1086,3 +1099,26 @@ pub struct CreateDomain {
|
|||
pub struct UpdateDomainData {
|
||||
pub data: Vec<(String, DomainData)>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct CreateProduct {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub product_type: ProductType,
|
||||
pub price: ProductPrice,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct UpdateProductName {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct UpdateProductDescription {
|
||||
pub description: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct UpdateProductPrice {
|
||||
pub price: ProductPrice,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue