Upgrade deps, clippy fixes and start payment tests

This commit is contained in:
Adrian Woźniak 2022-06-13 16:16:19 +02:00
parent ead4722989
commit 846d0b5000
No known key found for this signature in database
GPG Key ID: 0012845A89C7352B
46 changed files with 172 additions and 107 deletions

1
Cargo.lock generated
View File

@ -2918,6 +2918,7 @@ dependencies = [
"pay_u", "pay_u",
"pretty_env_logger", "pretty_env_logger",
"serde", "serde",
"testx",
"thiserror", "thiserror",
"tracing", "tracing",
"uuid 0.8.2", "uuid 0.8.2",

View File

@ -1,6 +1,6 @@
use crate::{db_async_handler, Result}; use crate::{db_async_handler, Result};
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Can't load account addresses")] #[error("Can't load account addresses")]
AccountAddresses, AccountAddresses,
@ -274,7 +274,7 @@ mod test {
city: City::new(city.clone()), city: City::new(city.clone()),
country: Country::new(country.clone()), country: Country::new(country.clone()),
zip: Zip::new(zip.clone()), zip: Zip::new(zip.clone()),
account_id: account_id.clone(), account_id,
is_default, is_default,
}, },
&mut t, &mut t,
@ -322,7 +322,7 @@ mod test {
city: address.city.clone(), city: address.city.clone(),
country: address.country.clone(), country: address.country.clone(),
zip: address.zip.clone(), zip: address.zip.clone(),
account_id: address.account_id.clone(), account_id: address.account_id,
is_default: true, is_default: true,
}, },
&mut t, &mut t,

View File

@ -4,7 +4,7 @@ use model::*;
use crate::{db_async_handler, Result}; use crate::{db_async_handler, Result};
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
pub enum Error { pub enum Error {
#[error("Can't create account")] #[error("Can't create account")]

View File

@ -32,7 +32,7 @@ pub mod tokens;
#[macro_export] #[macro_export]
macro_rules! db_async_handler { macro_rules! db_async_handler {
($msg: ty, $async: ident, $res: ty) => { ($msg: ty, $async: ident, $res: ty) => {
impl actix::Handler<$msg> for crate::Database { impl actix::Handler<$msg> for $crate::Database {
type Result = actix::ResponseActFuture<Self, Result<$res>>; type Result = actix::ResponseActFuture<Self, Result<$res>>;
fn handle(&mut self, msg: $msg, _ctx: &mut Self::Context) -> Self::Result { fn handle(&mut self, msg: $msg, _ctx: &mut Self::Context) -> Self::Result {
@ -63,7 +63,7 @@ macro_rules! db_async_handler {
} }
} }
impl actix::Handler<$msg> for crate::Database { impl actix::Handler<$msg> for $crate::Database {
type Result = actix::ResponseActFuture<Self, Result<$res>>; type Result = actix::ResponseActFuture<Self, Result<$res>>;
fn handle(&mut self, msg: $msg, _ctx: &mut Self::Context) -> Self::Result { fn handle(&mut self, msg: $msg, _ctx: &mut Self::Context) -> Self::Result {
@ -74,7 +74,7 @@ macro_rules! db_async_handler {
} }
#[async_trait::async_trait] #[async_trait::async_trait]
impl $crate::Queue<$msg> for crate::Transaction { impl $crate::Queue<$msg> for $crate::Transaction {
type Result = $res; type Result = $res;
async fn handle(&mut self, msg: $msg) -> Result<Self::Result> { async fn handle(&mut self, msg: $msg) -> Result<Self::Result> {
@ -134,7 +134,7 @@ macro_rules! query_db {
}; };
} }
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
pub enum Error { pub enum Error {
#[error("{0}")] #[error("{0}")]
@ -336,7 +336,7 @@ where
if let Some(s) = self.sort.as_deref() { if let Some(s) = self.sort.as_deref() {
query.push_str("\nORDER BY "); query.push_str("\nORDER BY ");
query.push_str(s); query.push_str(s);
query.push_str(" "); query.push(' ');
} }
let q = sqlx::query_as_with( let q = sqlx::query_as_with(
query.as_str(), query.as_str(),

View File

@ -1,6 +1,6 @@
use crate::{db_async_handler, Result}; use crate::{db_async_handler, Result};
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Can't load order addresses")] #[error("Can't load order addresses")]
OrderAddress, OrderAddress,

View File

@ -5,7 +5,7 @@ use model::*;
use super::Result; use super::Result;
use crate::db_async_handler; use crate::db_async_handler;
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Can't create order item")] #[error("Can't create order item")]
CantCreate, CantCreate,

View File

@ -6,7 +6,7 @@ use crate::{
ShoppingCartSetState, ShoppingCartSetState,
}; };
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
#[serde(rename_all = "kebab-case", tag = "account-order")] #[serde(rename_all = "kebab-case", tag = "account-order")]
pub enum Error { pub enum Error {
#[error("Can't create account order")] #[error("Can't create account order")]

View File

@ -1,6 +1,6 @@
use crate::{MultiLoad, Result}; use crate::{MultiLoad, Result};
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Failed to create photo")] #[error("Failed to create photo")]
Create, Create,

View File

@ -1,6 +1,6 @@
use crate::{db_async_handler, Result}; use crate::{db_async_handler, Result};
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Failed to attach photo to product")] #[error("Failed to attach photo to product")]
Create, Create,

View File

@ -9,7 +9,7 @@ use model::{
use super::Result; use super::Result;
use crate::MultiLoad; use crate::MultiLoad;
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Unable to load all products")] #[error("Unable to load all products")]
All, All,

View File

@ -3,7 +3,7 @@ use model::*;
use super::Result; use super::Result;
use crate::db_async_handler; use crate::db_async_handler;
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Can't create shopping cart item")] #[error("Can't create shopping cart item")]
CantCreate, CantCreate,

View File

@ -4,7 +4,7 @@ use sqlx::PgPool;
use super::Result; use super::Result;
use crate::db_async_handler; use crate::db_async_handler;
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Can't create shopping cart")] #[error("Can't create shopping cart")]
CantCreate, CantCreate,

View File

@ -3,7 +3,7 @@ use model::{ProductId, Quantity, QuantityUnit, Stock, StockId};
use crate::{MultiLoad, Result}; use crate::{MultiLoad, Result};
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Unable to load all stocks")] #[error("Unable to load all stocks")]
All, All,
@ -193,7 +193,7 @@ async fn product_stock(
msg: ProductsStock, msg: ProductsStock,
pool: &mut sqlx::Transaction<'_, sqlx::Postgres>, pool: &mut sqlx::Transaction<'_, sqlx::Postgres>,
) -> Result<Vec<Stock>> { ) -> Result<Vec<Stock>> {
Ok(MultiLoad::new( MultiLoad::new(
pool, pool,
r#" r#"
SELECT id, product_id, quantity, quantity_unit SELECT id, product_id, quantity, quantity_unit
@ -207,7 +207,7 @@ WHERE
msg.product_ids.into_iter().map(|id| *id), msg.product_ids.into_iter().map(|id| *id),
|_e| crate::Error::Stock(Error::ProductStock), |_e| crate::Error::Stock(Error::ProductStock),
) )
.await?) .await
} }
#[cfg(test)] #[cfg(test)]
@ -251,7 +251,7 @@ mod tests {
_ => test_product(&mut *pool).await.id, _ => test_product(&mut *pool).await.id,
}; };
let quantity = quantity.unwrap_or_else(|| Quantity::from_u32(345)); let quantity = quantity.unwrap_or_else(|| Quantity::from_u32(345));
let quantity_unit = quantity_unit.unwrap_or_else(|| QuantityUnit::Piece); let quantity_unit = quantity_unit.unwrap_or(QuantityUnit::Piece);
super::create_stock( super::create_stock(
CreateStock { CreateStock {

View File

@ -3,7 +3,7 @@ use model::{AccountId, Audience, Token, TokenId};
use crate::{db_async_handler, Result}; use crate::{db_async_handler, Result};
#[derive(Debug, Copy, Clone, PartialEq, serde::Serialize, thiserror::Error)] #[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, thiserror::Error)]
pub enum Error { pub enum Error {
#[error("Failed to save new token")] #[error("Failed to save new token")]
Create, Create,
@ -204,13 +204,13 @@ mod tests {
audience: Option<Audience>, audience: Option<Audience>,
expiration_time: Option<chrono::NaiveDateTime>, expiration_time: Option<chrono::NaiveDateTime>,
) -> Token { ) -> Token {
let customer_id = customer_id.unwrap_or_else(|| Uuid::new_v4()); let customer_id = customer_id.unwrap_or_else(Uuid::new_v4);
let role = role.unwrap_or_else(|| Role::Admin); let role = role.unwrap_or(Role::Admin);
let subject = match subject { let subject = match subject {
Some(id) => id, Some(id) => id,
_ => test_create_account(t).await.id, _ => test_create_account(t).await.id,
}; };
let audience = audience.unwrap_or_else(|| Audience::Web); let audience = audience.unwrap_or(Audience::Web);
let expiration_time = expiration_time let expiration_time = expiration_time
.unwrap_or_else(|| (chrono::Utc::now() + chrono::Duration::days(60)).naive_utc()); .unwrap_or_else(|| (chrono::Utc::now() + chrono::Duration::days(60)).naive_utc());

View File

@ -25,3 +25,6 @@ parking_lot = { version = "0.12", features = [] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
pay_u = { version = '0.1', features = ["single-client"] } pay_u = { version = '0.1', features = ["single-client"] }
[dev-dependencies]
testx = { path = "../../shared/testx" }

View File

@ -100,7 +100,8 @@ impl PaymentManager {
) )
}; };
client.authorize().await.unwrap_or_else(|e| { client.authorize().await.unwrap_or_else(|e| {
tracing::error!("{}", e); tracing::error!("{e}");
dbg!(e);
std::process::exit(1); std::process::exit(1);
}); });
Self { Self {
@ -315,3 +316,22 @@ pub(crate) async fn update_payment(
.await; .await;
Ok(()) Ok(())
} }
#[cfg(test)]
mod tests {
use actix::Actor;
use crate::*;
pub struct NoOpts;
impl config::UpdateConfig for NoOpts {}
#[actix::test]
async fn create() {
testx::db!(config, db);
let db = db.start();
let manager = PaymentManager::build(config, db).await;
}
}

View File

@ -9,11 +9,11 @@ macro_rules! admin_send_db {
Ok(Ok(res)) => res, Ok(Ok(res)) => res,
Ok(Err(e)) => { Ok(Err(e)) => {
tracing::error!("{}", e); tracing::error!("{}", e);
return Err(crate::routes::Error::from(e)); return Err($crate::routes::Error::from(e));
} }
Err(e) => { Err(e) => {
tracing::error!("{}", e); tracing::error!("{}", e);
return Err(crate::routes::Error::CriticalFailure); return Err($crate::routes::Error::CriticalFailure);
} }
} }
}}; }};

View File

@ -274,7 +274,7 @@ pub(crate) async fn create_order(
zip, zip,
}) => order_manager::OrderAddressInput::Address(order_manager::CreateOrderAddress { }) => order_manager::OrderAddressInput::Address(order_manager::CreateOrderAddress {
name, name,
email: email.clone(), email,
phone, phone,
street, street,
city, city,

View File

@ -15,11 +15,11 @@ macro_rules! public_send_db {
Ok(Ok(res)) => Ok(HttpResponse::Ok().json(res)), Ok(Ok(res)) => Ok(HttpResponse::Ok().json(res)),
Ok(Err(e)) => { Ok(Err(e)) => {
tracing::error!("{}", e); tracing::error!("{}", e);
Err(crate::routes::Error::Public(PublicError::Database(e))) Err($crate::routes::Error::Public(PublicError::Database(e)))
} }
Err(e) => { Err(e) => {
tracing::error!("{}", e); tracing::error!("{}", e);
Err(crate::routes::Error::Public( Err($crate::routes::Error::Public(
PublicError::DatabaseConnection, PublicError::DatabaseConnection,
)) ))
} }

View File

@ -22,10 +22,10 @@ async fn create_product(
database_manager::CreateProduct { database_manager::CreateProduct {
name: ProductName::from(String::from(name)), name: ProductName::from(String::from(name)),
short_description: short_desc short_description: short_desc
.map(|s| model::ProductShortDesc::new(s)) .map(model::ProductShortDesc::new)
.unwrap_or_else(|| Faker.fake()), .unwrap_or_else(|| Faker.fake()),
long_description: long_desc long_description: long_desc
.map(|s| model::ProductLongDesc::new(s)) .map(model::ProductLongDesc::new)
.unwrap_or_else(|| Faker.fake()), .unwrap_or_else(|| Faker.fake()),
category: Some(ProductCategory::new(category)), category: Some(ProductCategory::new(category)),
price: Faker.fake(), price: Faker.fake(),

View File

@ -37,7 +37,7 @@ impl<T> fake::Dummy<T> for ProductLongDesc {
.into_iter() .into_iter()
.map(|_| { .map(|_| {
let words: Vec<String> = Paragraphs(4..8).fake(); let words: Vec<String> = Paragraphs(4..8).fake();
words.join(" ").to_string() words.join(" ")
}) })
.collect(); .collect();
Self(words.join("\n")) Self(words.join("\n"))

View File

@ -127,7 +127,7 @@ pub const CATEGORIES: [Category; 9] = [
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))] #[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Display, Deserialize, Serialize)] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, Display, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum OrderStatus { pub enum OrderStatus {
#[display(fmt = "Potwierdzone")] #[display(fmt = "Potwierdzone")]
@ -147,7 +147,7 @@ pub enum OrderStatus {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))] #[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Display, Deserialize, Serialize)] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, Display, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum Role { pub enum Role {
#[display(fmt = "Adminitrator")] #[display(fmt = "Adminitrator")]
@ -173,7 +173,7 @@ impl Role {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[derive(Copy, Clone, Debug, PartialEq, Hash, Display, Deserialize, Serialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Display, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum QuantityUnit { pub enum QuantityUnit {
#[cfg_attr(feature = "db", sqlx(rename = "g"))] #[cfg_attr(feature = "db", sqlx(rename = "g"))]
@ -209,7 +209,7 @@ impl QuantityUnit {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))] #[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Display, Deserialize, Serialize)] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, Display, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum PaymentMethod { pub enum PaymentMethod {
PayU, PayU,
@ -225,7 +225,7 @@ impl Default for PaymentMethod {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))] #[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Display, Deserialize, Serialize)] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, Display, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum ShoppingCartState { pub enum ShoppingCartState {
Active, Active,
@ -235,7 +235,7 @@ pub enum ShoppingCartState {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))] #[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))]
#[derive(Copy, Clone, Debug, Hash, Display, Deserialize, Serialize, PartialEq)] #[derive(Copy, Clone, Debug, Hash, Display, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum Audience { pub enum Audience {
Web, Web,
@ -264,7 +264,7 @@ impl Audience {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))] #[cfg_attr(feature = "db", sqlx(rename_all = "snake_case"))]
#[derive(Copy, Clone, Debug, Display, Deserialize, Serialize, PartialEq)] #[derive(Copy, Clone, Debug, Display, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum AccountState { pub enum AccountState {
Active, Active,
@ -281,7 +281,18 @@ impl Default for Audience {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive( #[derive(
Default, Debug, Copy, Clone, Hash, PartialOrd, PartialEq, Serialize, Deserialize, Deref, From, Default,
Debug,
Copy,
Clone,
Hash,
PartialOrd,
PartialEq,
Eq,
Serialize,
Deserialize,
Deref,
From,
)] )]
#[serde(transparent)] #[serde(transparent)]
pub struct Price(NonNegative); pub struct Price(NonNegative);
@ -303,7 +314,7 @@ impl ops::Mul<Quantity> for Price {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Serialize, Deserialize, Default, Debug, PartialEq, Copy, Clone, Hash, Deref, From)] #[derive(Serialize, Deserialize, Default, Debug, PartialEq, Eq, Copy, Clone, Hash, Deref, From)]
#[serde(transparent)] #[serde(transparent)]
pub struct Quantity(NonNegative); pub struct Quantity(NonNegative);
@ -339,7 +350,7 @@ impl TryFrom<i32> for Quantity {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Deref, From, Display)] #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Deref, From, Display)]
#[serde(transparent)] #[serde(transparent)]
pub struct Login(String); pub struct Login(String);
@ -352,7 +363,7 @@ impl Login {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive( #[derive(
Serialize, Debug, Clone, Default, PartialOrd, PartialEq, Deref, DerefMut, From, Display, Serialize, Debug, Clone, Default, PartialOrd, PartialEq, Eq, Deref, DerefMut, From, Display,
)] )]
#[serde(transparent)] #[serde(transparent)]
pub struct Email(String); pub struct Email(String);
@ -377,6 +388,7 @@ impl Email {
Default, Default,
PartialOrd, PartialOrd,
PartialEq, PartialEq,
Eq,
Deref, Deref,
DerefMut, DerefMut,
From, From,
@ -438,7 +450,9 @@ impl<'de> serde::Deserialize<'de> for Email {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Default, Debug, PartialEq, PartialOrd, Copy, Clone, Hash, Serialize, Deref, Display)] #[derive(
Default, Debug, PartialEq, Eq, PartialOrd, Copy, Clone, Hash, Serialize, Deref, Display,
)]
#[serde(transparent)] #[serde(transparent)]
pub struct NonNegative(i32); pub struct NonNegative(i32);
@ -537,7 +551,7 @@ impl<'de> serde::Deserialize<'de> for NonNegative {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[derive( #[derive(
Debug, Copy, Clone, Hash, PartialOrd, PartialEq, Serialize, Deserialize, Display, From, Debug, Copy, Clone, Hash, PartialOrd, PartialEq, Eq, Serialize, Deserialize, Display, From,
)] )]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum Day { pub enum Day {
@ -608,7 +622,7 @@ impl TryFrom<i32> for Day {
} }
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[derive(Hash, Debug, PartialOrd, PartialEq, Serialize, Deserialize)] #[derive(Hash, Debug, PartialOrd, PartialEq, Eq, Serialize, Deserialize)]
#[serde(transparent)] #[serde(transparent)]
pub struct Days(pub Vec<Day>); pub struct Days(pub Vec<Day>);
@ -719,7 +733,7 @@ impl PasswordConfirmation {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Serialize, Deserialize, Debug, PartialEq, Deref, From, Display)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Deref, From, Display)]
#[serde(transparent)] #[serde(transparent)]
pub struct PassHash(String); pub struct PassHash(String);
@ -739,14 +753,14 @@ impl PartialEq<PasswordConfirmation> for Password {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive( #[derive(
Serialize, Deserialize, Copy, Clone, Debug, PartialOrd, PartialEq, Deref, Display, From, Serialize, Deserialize, Copy, Clone, Debug, PartialOrd, PartialEq, Eq, Deref, Display, From,
)] )]
#[serde(transparent)] #[serde(transparent)]
pub struct AccountId(RecordId); pub struct AccountId(RecordId);
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct FullAccount { pub struct FullAccount {
pub id: AccountId, pub id: AccountId,
pub email: Email, pub email: Email,
@ -807,7 +821,7 @@ impl Display for ProductId {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Clone, Hash, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
#[serde(transparent)] #[serde(transparent)]
pub struct ProductName(String); pub struct ProductName(String);
@ -823,7 +837,7 @@ impl ProductName {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Clone, Hash, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
#[serde(transparent)] #[serde(transparent)]
pub struct ProductShortDesc(String); pub struct ProductShortDesc(String);
@ -839,7 +853,7 @@ impl ProductShortDesc {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Clone, Hash, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
#[serde(transparent)] #[serde(transparent)]
pub struct ProductLongDesc(String); pub struct ProductLongDesc(String);
@ -858,7 +872,7 @@ impl ProductLongDesc {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Clone, Hash, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
#[serde(transparent)] #[serde(transparent)]
pub struct ProductCategory(String); pub struct ProductCategory(String);
@ -870,7 +884,7 @@ impl ProductCategory {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, Hash, PartialEq, Serialize, Deserialize)] #[derive(Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub struct Product { pub struct Product {
pub id: ProductId, pub id: ProductId,
pub name: ProductName, pub name: ProductName,
@ -884,13 +898,13 @@ pub struct Product {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, PartialEq, Copy, Clone, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
#[serde(transparent)] #[serde(transparent)]
pub struct StockId(pub RecordId); pub struct StockId(pub RecordId);
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Stock { pub struct Stock {
pub id: StockId, pub id: StockId,
pub product_id: ProductId, pub product_id: ProductId,
@ -931,7 +945,7 @@ impl ExtOrderId {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Order { pub struct Order {
pub id: OrderId, pub id: OrderId,
/// Optional customer account id /// Optional customer account id
@ -984,12 +998,12 @@ impl From<Order> for PublicOrder {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize, Deref)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Deref)]
pub struct OrderItemId(pub RecordId); pub struct OrderItemId(pub RecordId);
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct OrderItem { pub struct OrderItem {
pub id: OrderItemId, pub id: OrderItemId,
pub product_id: ProductId, pub product_id: ProductId,
@ -1001,13 +1015,13 @@ pub struct OrderItem {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Serialize, Deserialize, PartialEq, Copy, Clone, Debug, Deref, Display)] #[derive(Serialize, Deserialize, PartialEq, Eq, Copy, Clone, Debug, Deref, Display)]
#[serde(transparent)] #[serde(transparent)]
pub struct ShoppingCartId(pub RecordId); pub struct ShoppingCartId(pub RecordId);
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ShoppingCart { pub struct ShoppingCart {
pub id: ShoppingCartId, pub id: ShoppingCartId,
pub buyer_id: AccountId, pub buyer_id: AccountId,
@ -1019,12 +1033,12 @@ pub struct ShoppingCart {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize, Deref, Display)] #[derive(PartialEq, Eq, Copy, Clone, Debug, Serialize, Deserialize, Deref, Display)]
#[serde(transparent)] #[serde(transparent)]
pub struct ShoppingCartItemId(RecordId); pub struct ShoppingCartItemId(RecordId);
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ShoppingCartItem { pub struct ShoppingCartItem {
pub id: ShoppingCartItemId, pub id: ShoppingCartItemId,
pub product_id: ProductId, pub product_id: ProductId,
@ -1042,13 +1056,13 @@ impl ShoppingCartItem {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, Deref, Display, Debug)] #[derive(Serialize, Deserialize, Copy, Clone, PartialEq, Eq, Deref, Display, Debug)]
#[serde(transparent)] #[serde(transparent)]
pub struct TokenId(RecordId); pub struct TokenId(RecordId);
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Token { pub struct Token {
pub id: TokenId, pub id: TokenId,
pub customer_id: uuid::Uuid, pub customer_id: uuid::Uuid,
@ -1081,7 +1095,7 @@ impl Token {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
pub struct AccessTokenString(String); pub struct AccessTokenString(String);
impl AccessTokenString { impl AccessTokenString {
@ -1099,7 +1113,7 @@ impl From<RefreshTokenString> for AccessTokenString {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
pub struct RefreshTokenString(String); pub struct RefreshTokenString(String);
impl From<AccessTokenString> for RefreshTokenString { impl From<AccessTokenString> for RefreshTokenString {
@ -1117,7 +1131,7 @@ impl RefreshTokenString {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Hash, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Hash, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
pub struct LocalPath(String); pub struct LocalPath(String);
impl LocalPath { impl LocalPath {
@ -1129,7 +1143,7 @@ impl LocalPath {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Hash, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Hash, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
pub struct UniqueName(String); pub struct UniqueName(String);
impl UniqueName { impl UniqueName {
@ -1141,7 +1155,7 @@ impl UniqueName {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Hash, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Hash, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
pub struct FileName(String); pub struct FileName(String);
impl FileName { impl FileName {
@ -1154,19 +1168,30 @@ impl FileName {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive( #[derive(
Debug, Copy, Clone, Hash, PartialOrd, PartialEq, Serialize, Deserialize, Deref, Display, From, Debug,
Copy,
Clone,
Hash,
PartialOrd,
PartialEq,
Eq,
Serialize,
Deserialize,
Deref,
Display,
From,
)] )]
pub struct PhotoId(RecordId); pub struct PhotoId(RecordId);
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive(Debug, Hash, Copy, Clone, PartialEq, Serialize, Deserialize, Deref, Display, From)] #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Deref, Display, From)]
pub struct ProductPhotoId(RecordId); pub struct ProductPhotoId(RecordId);
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, Hash, PartialEq, Serialize, Deserialize)] #[derive(Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub struct Photo { pub struct Photo {
pub id: PhotoId, pub id: PhotoId,
pub local_path: LocalPath, pub local_path: LocalPath,
@ -1176,7 +1201,7 @@ pub struct Photo {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, Hash, PartialEq, Serialize, Deserialize)] #[derive(Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProductLinkedPhoto { pub struct ProductLinkedPhoto {
pub photo_id: PhotoId, pub photo_id: PhotoId,
pub local_path: LocalPath, pub local_path: LocalPath,
@ -1187,7 +1212,7 @@ pub struct ProductLinkedPhoto {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProductPhoto { pub struct ProductPhoto {
pub id: ProductPhotoId, pub id: ProductPhotoId,
pub product_id: ProductId, pub product_id: ProductId,
@ -1209,7 +1234,18 @@ pub enum ShippingMethod {
#[cfg_attr(feature = "db", derive(sqlx::Type))] #[cfg_attr(feature = "db", derive(sqlx::Type))]
#[cfg_attr(feature = "db", sqlx(transparent))] #[cfg_attr(feature = "db", sqlx(transparent))]
#[derive( #[derive(
Serialize, Deserialize, Debug, Copy, Clone, Hash, PartialOrd, PartialEq, Deref, Display, From, Serialize,
Deserialize,
Debug,
Copy,
Clone,
Hash,
PartialOrd,
PartialEq,
Eq,
Deref,
Display,
From,
)] )]
pub struct AddressId(RecordId); pub struct AddressId(RecordId);
@ -1229,6 +1265,7 @@ impl AddressId {
Default, Default,
PartialOrd, PartialOrd,
PartialEq, PartialEq,
Eq,
Deref, Deref,
DerefMut, DerefMut,
From, From,
@ -1253,6 +1290,7 @@ impl Name {
Default, Default,
PartialOrd, PartialOrd,
PartialEq, PartialEq,
Eq,
Deref, Deref,
DerefMut, DerefMut,
From, From,
@ -1277,6 +1315,7 @@ impl Street {
Default, Default,
PartialOrd, PartialOrd,
PartialEq, PartialEq,
Eq,
Deref, Deref,
DerefMut, DerefMut,
From, From,
@ -1301,6 +1340,7 @@ impl City {
Default, Default,
PartialOrd, PartialOrd,
PartialEq, PartialEq,
Eq,
Deref, Deref,
DerefMut, DerefMut,
From, From,
@ -1325,6 +1365,7 @@ impl Country {
Default, Default,
PartialOrd, PartialOrd,
PartialEq, PartialEq,
Eq,
Deref, Deref,
DerefMut, DerefMut,
From, From,
@ -1341,7 +1382,7 @@ impl Zip {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Serialize, Deserialize, PartialEq, Debug)] #[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub struct AccountAddress { pub struct AccountAddress {
pub id: AddressId, pub id: AddressId,
pub name: Name, pub name: Name,
@ -1357,7 +1398,7 @@ pub struct AccountAddress {
#[cfg_attr(feature = "dummy", derive(fake::Dummy))] #[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))] #[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct OrderAddress { pub struct OrderAddress {
pub id: OrderAddressId, pub id: OrderAddressId,
pub name: Name, pub name: Name,

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BlikAlias { pub struct BlikAlias {
/// alias generated in merchant system (unique for each customer) /// alias generated in merchant system (unique for each customer)
#[serde(rename = "value", skip_serializing_if = "Option::is_none")] #[serde(rename = "value", skip_serializing_if = "Option::is_none")]

View File

@ -10,7 +10,7 @@
/// BlikAliasResponse : Array containing list of banks associated with this alias /// BlikAliasResponse : Array containing list of banks associated with this alias
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BlikAliasResponse { pub struct BlikAliasResponse {
/// Alias user friendly name saved at mobile app (blik request label parameter) /// Alias user friendly name saved at mobile app (blik request label parameter)
#[serde(rename = "applicationName", skip_serializing_if = "Option::is_none")] #[serde(rename = "applicationName", skip_serializing_if = "Option::is_none")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BlikFields { pub struct BlikFields {
/// Transaction title /// Transaction title
#[serde(rename = "title")] #[serde(rename = "title")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BlikResponse { pub struct BlikResponse {
/// Attention! result: 1 does not indicate transfer of funds! This is successful user app popup indicator. /// Attention! result: 1 does not indicate transfer of funds! This is successful user app popup indicator.
#[serde(rename = "result", skip_serializing_if = "Option::is_none")] #[serde(rename = "result", skip_serializing_if = "Option::is_none")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CheckFields { pub struct CheckFields {
/// API password. /// API password.
#[serde(rename = "api_password", skip_serializing_if = "Option::is_none")] #[serde(rename = "api_password", skip_serializing_if = "Option::is_none")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CheckResponse { pub struct CheckResponse {
#[serde(rename = "result", skip_serializing_if = "Option::is_none")] #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
pub result: Option<crate::models::Result>, pub result: Option<crate::models::Result>,

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct DeregisterFields { pub struct DeregisterFields {
/// Client token /// Client token
#[serde(rename = "cli_auth")] #[serde(rename = "cli_auth")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct GetFields { pub struct GetFields {
/// Transaction title /// Transaction title
#[serde(rename = "title")] #[serde(rename = "title")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct MasspaymentAuthorizeFields { pub struct MasspaymentAuthorizeFields {
/// ID of created pack using method create. /// ID of created pack using method create.
#[serde(rename = "pack_id")] #[serde(rename = "pack_id")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct MasspaymentAuthorizeResponse { pub struct MasspaymentAuthorizeResponse {
#[serde(rename = "result", skip_serializing_if = "Option::is_none")] #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
pub result: Option<crate::models::Result>, pub result: Option<crate::models::Result>,

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct MasspaymentCreateFields { pub struct MasspaymentCreateFields {
/// Transfers list encoded with base64. Format has been described in metchod description /// Transfers list encoded with base64. Format has been described in metchod description
#[serde(rename = "csv")] #[serde(rename = "csv")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct MasspaymentPacksFields { pub struct MasspaymentPacksFields {
/// ID of created pack using method create. /// ID of created pack using method create.
#[serde(rename = "pack_id", skip_serializing_if = "Option::is_none")] #[serde(rename = "pack_id", skip_serializing_if = "Option::is_none")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct MasspaymentTransfersFields { pub struct MasspaymentTransfersFields {
/// ID of created pack using method create. /// ID of created pack using method create.
#[serde(rename = "pack_id", skip_serializing_if = "Option::is_none")] #[serde(rename = "pack_id", skip_serializing_if = "Option::is_none")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct PaymentAttempts { pub struct PaymentAttempts {
/// Time of payment attempt /// Time of payment attempt
#[serde(rename = "date", skip_serializing_if = "Option::is_none")] #[serde(rename = "date", skip_serializing_if = "Option::is_none")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct RefundAnyResponse { pub struct RefundAnyResponse {
/// Request result (digit; 1 correct, 0 - incorrect) /// Request result (digit; 1 correct, 0 - incorrect)
#[serde(rename = "result")] #[serde(rename = "result")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct RefundTransactionFields { pub struct RefundTransactionFields {
/// Transaction title /// Transaction title
#[serde(rename = "title")] #[serde(rename = "title")]

View File

@ -10,7 +10,7 @@
/// RegisterSaleResponse : Successful response schema /// RegisterSaleResponse : Successful response schema
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct RegisterSaleResponse { pub struct RegisterSaleResponse {
#[serde(rename = "result", skip_serializing_if = "Option::is_none")] #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
pub result: Option<crate::models::Result>, pub result: Option<crate::models::Result>,

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ReportFields { pub struct ReportFields {
/// start range of generated report /// start range of generated report
#[serde(rename = "from_date")] #[serde(rename = "from_date")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ReportResponse { pub struct ReportResponse {
#[serde(rename = "result", skip_serializing_if = "Option::is_none")] #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
pub result: Option<crate::models::Result>, pub result: Option<crate::models::Result>,

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SaleFields { pub struct SaleFields {
/// Client token /// Client token
#[serde(rename = "cli_auth")] #[serde(rename = "cli_auth")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct VcFinishFields { pub struct VcFinishFields {
/// API password. /// API password.
#[serde(rename = "api_password")] #[serde(rename = "api_password")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct VcPrepareFields { pub struct VcPrepareFields {
/// API password. /// API password.
#[serde(rename = "api_password")] #[serde(rename = "api_password")]

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct VcPrepareResponse { pub struct VcPrepareResponse {
#[serde(rename = "result", skip_serializing_if = "Option::is_none")] #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
pub result: Option<crate::models::Result>, pub result: Option<crate::models::Result>,

View File

@ -23,21 +23,21 @@ use crate::session::SessionMsg;
macro_rules! fetch_page { macro_rules! fetch_page {
(public $model: expr, $page: ident, $ret: expr) => {{ (public $model: expr, $page: ident, $ret: expr) => {{
let p = match &mut $model.page { let p = match &mut $model.page {
crate::pages::Page::Public(p) => p, $crate::pages::Page::Public(p) => p,
_ => return $ret, _ => return $ret,
}; };
match p { match p {
crate::pages::PublicPage::$page(p) => p, $crate::pages::PublicPage::$page(p) => p,
_ => return $ret, _ => return $ret,
} }
}}; }};
(admin $model: expr, $page: ident, $ret: expr) => {{ (admin $model: expr, $page: ident, $ret: expr) => {{
let p = match &mut $model.page { let p = match &mut $model.page {
crate::pages::Page::Admin(p) => p, $crate::pages::Page::Admin(p) => p,
_ => return $ret, _ => return $ret,
}; };
match p { match p {
crate::pages::AdminPage::$page(p) => p, $crate::pages::AdminPage::$page(p) => p,
_ => return $ret, _ => return $ret,
} }
}}; }};