Add delivery

This commit is contained in:
eraden 2022-05-18 09:48:01 +02:00
parent c9eb49410b
commit 66eb6395ac
6 changed files with 45 additions and 12 deletions

12
Cargo.lock generated
View File

@ -1872,6 +1872,14 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "i18n-files"
version = "0.1.0"
dependencies = [
"proc-macro2",
"syn",
]
[[package]]
name = "ident_case"
version = "1.0.1"
@ -3582,9 +3590,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "syn"
version = "1.0.92"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52"
checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a"
dependencies = [
"proc-macro2",
"quote",

View File

@ -11,7 +11,8 @@ members = [
"actors/search_manager",
"actors/token_manager",
"actors/fs_manager",
"db-seed"
"db-seed",
"derive/i18n-files"
]
[profile.release]

View File

@ -0,0 +1,11 @@
[package]
name = "i18n-files"
version = "0.1.0"
edition = "2021"
[lib]
proc-macro = true
[dependencies]
proc-macro2 = { version = "1.0.38" }
syn = { version = "1.0.94" }

View File

@ -0,0 +1,7 @@
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro]
pub fn lang(_item: TokenStream) -> TokenStream {
"fn answer() -> u32 { 42 }".parse().unwrap()
}

View File

@ -16,6 +16,8 @@ pub struct Config {
pub pay_methods: Vec<PaymentMethod>,
pub coupons: bool,
pub currency: String,
pub shipping: bool,
pub shipping_methods: Vec<String>,
}
#[cfg_attr(feature = "dummy", derive(fake::Dummy))]

View File

@ -397,7 +397,7 @@ impl<'de> serde::Deserialize<'de> for Email {
#[serde(transparent)]
pub struct NonNegative(i32);
impl std::ops::Add for NonNegative {
impl ops::Add for NonNegative {
type Output = Self;
fn add(self, rhs: Self) -> Self::Output {
@ -405,7 +405,7 @@ impl std::ops::Add for NonNegative {
}
}
impl std::ops::Sub for NonNegative {
impl ops::Sub for NonNegative {
type Output = Self;
fn sub(self, rhs: Self) -> Self::Output {
@ -557,7 +557,7 @@ impl TryFrom<i32> for Day {
#[serde(transparent)]
pub struct Days(Vec<Day>);
impl std::ops::Deref for Days {
impl ops::Deref for Days {
type Target = Vec<Day>;
fn deref(&self) -> &Self::Target {
@ -591,12 +591,7 @@ where
{
fn decode(
value: <sqlx::Postgres as ::sqlx::database::HasValueRef<'r>>::ValueRef,
) -> ::std::result::Result<
Self,
::std::boxed::Box<
dyn ::std::error::Error + 'static + ::std::marker::Send + ::std::marker::Sync,
>,
> {
) -> Result<Self, Box<dyn Error + 'static + Send + Sync>> {
let value = <i32 as ::sqlx::decode::Decode<'r, sqlx::Postgres>>::decode(value)?;
Ok(Days(
(0..7)
@ -1102,3 +1097,12 @@ pub struct ProductPhoto {
pub product_id: ProductId,
pub photo_id: PhotoId,
}
#[cfg_attr(feature = "dummy", derive(fake::Dummy))]
#[cfg_attr(feature = "db", derive(sqlx::FromRow))]
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum ShippingMethod {
InPost,
Custom(String),
}