cscart_rs/service/
cart_service.rs1use crate::prelude::*;
2use crate::service::config::ServiceConfig;
3use crate::types::Cart;
4use crate::{impl_delete_by_id_method, impl_get_all_method, impl_get_by_id_method};
5
6use serde::Deserialize;
7
8pub type DeleteCartResponse = ();
9
10pub struct CartService {
11 config: ServiceConfig<Authenticated>,
12}
13
14impl CartService {
15 pub fn with_config(service: ServiceConfig<Authenticated>) -> CartService {
16 Self { config: service }
17 }
18}
19
20#[derive(Deserialize, Debug)]
21pub struct GetAllCartResponse {
22 pub carts: Vec<Cart>,
23}
24
25impl_get_by_id_method!(CartService, Cart);
26impl_get_all_method!(CartService, GetAllCartResponse);
27impl_delete_by_id_method!(CartService, DeleteCartResponse);