From 97cbddd0472221b6ba10a34c7713ab59b2b5ead9 Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Tue, 30 Aug 2022 08:14:53 +0000 Subject: [PATCH] data type of money is changed --- Cargo.toml | 4 ++-- migrations/202207011110_member_bank_deposit/up.sql | 2 +- migrations/202207011120_member_bank_withdraw/up.sql | 2 +- src/compositions/member_bank_deposit/models.rs | 4 ++-- src/compositions/member_bank_withdraw/models.rs | 4 ++-- src/repositories/member_bank_deposit/models.rs | 10 +++++----- src/repositories/member_bank_deposit/schema.rs | 4 ++-- src/repositories/member_bank_withdraw/models.rs | 10 +++++----- src/repositories/member_bank_withdraw/schema.rs | 4 ++-- src/services/member_bank_deposit/models.rs | 4 ++-- src/services/member_bank_deposit/service.rs | 6 +++--- src/services/member_bank_withdraw/models.rs | 4 ++-- src/services/member_bank_withdraw/service.rs | 6 +++--- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b8f22ef..470d83f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] } tokio-cron-scheduler = { version = "0" } uuid = { version = "0", features = ["serde", "v4", "v5"] } -beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.83-snapshot" } -beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.69-snapshot" } +beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.84-snapshot" } +beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.70-snapshot" } [build-dependencies] diff --git a/migrations/202207011110_member_bank_deposit/up.sql b/migrations/202207011110_member_bank_deposit/up.sql index 7e63850..dcd743b 100644 --- a/migrations/202207011110_member_bank_deposit/up.sql +++ b/migrations/202207011110_member_bank_deposit/up.sql @@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS member_bank_deposits ( id UUID DEFAULT uuid_generate_v4(), member_id UUID NOT NULL, name TEXT NOT NULL, - amount INTEGER NOT NULL, + amount DOUBLE PRECISION NOT NULL, memo TEXT, state MEMBER_BANK_DEPOSIT_STATE DEFAULT 'application', state_changed_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000), diff --git a/migrations/202207011120_member_bank_withdraw/up.sql b/migrations/202207011120_member_bank_withdraw/up.sql index 9a50f43..171599e 100644 --- a/migrations/202207011120_member_bank_withdraw/up.sql +++ b/migrations/202207011120_member_bank_withdraw/up.sql @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS member_bank_withdraws ( bank_name TEXT NOT NULL, name TEXT NOT NULL, account_number TEXT NOT NULL, - amount INTEGER NOT NULL, + amount DOUBLE PRECISION NOT NULL, password TEXT NOT NULL, memo TEXT, state MEMBER_BANK_WITHDRAW_STATE DEFAULT 'application', diff --git a/src/compositions/member_bank_deposit/models.rs b/src/compositions/member_bank_deposit/models.rs index ba1bb87..d68cbfe 100644 --- a/src/compositions/member_bank_deposit/models.rs +++ b/src/compositions/member_bank_deposit/models.rs @@ -5,7 +5,7 @@ use crate::repositories::member_bank_deposit::schema::MemberBankDepositState; use diesel::deserialize::QueryableByName; /// -#[derive(Eq, Hash, PartialEq, Debug, Clone)] +#[derive(PartialEq, Debug, Clone)] pub struct MemberBankDepositModel { /// pub id: uuid::Uuid, @@ -14,7 +14,7 @@ pub struct MemberBankDepositModel { /// pub name: String, /// - pub amount: i32, + pub amount: f64, /// pub memo: Option, /// diff --git a/src/compositions/member_bank_withdraw/models.rs b/src/compositions/member_bank_withdraw/models.rs index 11ec215..b7917c4 100644 --- a/src/compositions/member_bank_withdraw/models.rs +++ b/src/compositions/member_bank_withdraw/models.rs @@ -5,7 +5,7 @@ use crate::repositories::member_bank_withdraw::schema::MemberBankWithdrawState; use diesel::deserialize::QueryableByName; /// -#[derive(Eq, Hash, PartialEq, Debug, Clone)] +#[derive(PartialEq, Debug, Clone)] pub struct MemberBankWithdrawModel { /// pub id: uuid::Uuid, @@ -18,7 +18,7 @@ pub struct MemberBankWithdrawModel { /// pub account_number: String, /// - pub amount: i32, + pub amount: f64, /// pub password: String, /// diff --git a/src/repositories/member_bank_deposit/models.rs b/src/repositories/member_bank_deposit/models.rs index c05dd0a..082c3d0 100644 --- a/src/repositories/member_bank_deposit/models.rs +++ b/src/repositories/member_bank_deposit/models.rs @@ -2,7 +2,7 @@ use super::schema::{member_bank_deposits, MemberBankDepositState}; use beteran_common_rust as bcr; /// -#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, Debug, Clone)] +#[derive(Identifiable, Queryable, PartialEq, Debug, Clone)] #[table_name = "member_bank_deposits"] pub struct MemberBankDeposit { /// @@ -12,7 +12,7 @@ pub struct MemberBankDeposit { /// pub name: String, /// - pub amount: i32, + pub amount: f64, /// pub memo: Option, /// @@ -34,7 +34,7 @@ pub struct NewMemberBankDeposit { /// pub name: String, /// - pub amount: i32, + pub amount: f64, /// pub memo: Option, } @@ -46,7 +46,7 @@ pub struct ModifyMemberBankDeposit { /// pub name: String, /// - pub amount: i32, + pub amount: f64, /// pub memo: Option, } @@ -67,7 +67,7 @@ pub struct FindAllSearch { /// pub name_like: Option, /// - pub amount: Option, + pub amount: Option, /// pub memo_like: Option, /// diff --git a/src/repositories/member_bank_deposit/schema.rs b/src/repositories/member_bank_deposit/schema.rs index bca92de..47b6b91 100644 --- a/src/repositories/member_bank_deposit/schema.rs +++ b/src/repositories/member_bank_deposit/schema.rs @@ -10,7 +10,7 @@ pub enum MemberBankDepositState { } table! { - use diesel::sql_types::{Uuid, Text, BigInt, Nullable, Integer}; + use diesel::sql_types::{Uuid, Text, BigInt, Nullable, Double}; use super::MemberBankDepositStateMapping; /// @@ -22,7 +22,7 @@ table! { /// name -> Text, /// - amount -> Integer, + amount -> Double, /// memo -> Nullable, /// diff --git a/src/repositories/member_bank_withdraw/models.rs b/src/repositories/member_bank_withdraw/models.rs index e5e9d8d..5270edc 100644 --- a/src/repositories/member_bank_withdraw/models.rs +++ b/src/repositories/member_bank_withdraw/models.rs @@ -2,7 +2,7 @@ use super::schema::{member_bank_withdraws, MemberBankWithdrawState}; use beteran_common_rust as bcr; /// -#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, Debug, Clone)] +#[derive(Identifiable, Queryable, PartialEq, Debug, Clone)] #[table_name = "member_bank_withdraws"] pub struct MemberBankWithdraw { /// @@ -16,7 +16,7 @@ pub struct MemberBankWithdraw { /// pub account_number: String, /// - pub amount: i32, + pub amount: f64, /// pub password: String, /// @@ -44,7 +44,7 @@ pub struct NewMemberBankWithdraw { /// pub account_number: String, /// - pub amount: i32, + pub amount: f64, /// pub password: String, /// @@ -62,7 +62,7 @@ pub struct ModifyMemberBankWithdraw { /// pub account_number: String, /// - pub amount: i32, + pub amount: f64, /// pub password: String, /// @@ -89,7 +89,7 @@ pub struct FindAllSearch { /// pub account_number_like: Option, /// - pub amount: Option, + pub amount: Option, /// pub memo_like: Option, /// diff --git a/src/repositories/member_bank_withdraw/schema.rs b/src/repositories/member_bank_withdraw/schema.rs index e6cfe79..8f3df86 100644 --- a/src/repositories/member_bank_withdraw/schema.rs +++ b/src/repositories/member_bank_withdraw/schema.rs @@ -10,7 +10,7 @@ pub enum MemberBankWithdrawState { } table! { - use diesel::sql_types::{Uuid, Text, BigInt, Nullable, Integer}; + use diesel::sql_types::{Uuid, Text, BigInt, Nullable, Double}; use super::MemberBankWithdrawStateMapping; /// @@ -26,7 +26,7 @@ table! { /// account_number -> Text, /// - amount -> Integer, + amount -> Double, /// password -> Text, /// diff --git a/src/services/member_bank_deposit/models.rs b/src/services/member_bank_deposit/models.rs index 1ea8ae0..b4bdd17 100644 --- a/src/services/member_bank_deposit/models.rs +++ b/src/services/member_bank_deposit/models.rs @@ -10,7 +10,7 @@ impl From<&repositories::member_bank_deposit::models::MemberBankDeposit> id: d.id.to_string(), member_id: d.member_id.to_string(), name: d.name.clone(), - amount: d.amount as u32, + amount: d.amount, memo: d.memo.clone(), state: d.state as i32, state_changed_at: d.state_changed_at as u64, @@ -28,7 +28,7 @@ impl From<&compositions::member_bank_deposit::models::MemberBankDepositModel> id: d.id.to_string(), member: Some(bpr::models::member::Member::from(&d.member)), name: d.name.clone(), - amount: d.amount as u32, + amount: d.amount, memo: d.memo.clone(), state: d.state as i32, state_changed_at: d.state_changed_at as u64, diff --git a/src/services/member_bank_deposit/service.rs b/src/services/member_bank_deposit/service.rs index 64d9221..0c8695e 100644 --- a/src/services/member_bank_deposit/service.rs +++ b/src/services/member_bank_deposit/service.rs @@ -177,7 +177,7 @@ impl Service { &repositories::member_bank_deposit::models::NewMemberBankDeposit { member_id, name: request.name, - amount: request.amount as i32, + amount: request.amount, memo: request.memo, }, ) @@ -323,7 +323,7 @@ impl Service { Some(repositories::member_bank_deposit::models::FindAllSearch { member_id, name_like: s.name_like, - amount: s.amount.map(|d| d as i32), + amount: s.amount, memo_like: s.memo_like, state: s.state.map(|d| { repositories::member_bank_deposit::schema::MemberBankDepositState::from(d) @@ -624,7 +624,7 @@ impl Service { let modify_member_bank_deposit = repositories::member_bank_deposit::models::ModifyMemberBankDeposit { name: request.name, - amount: request.amount as i32, + amount: request.amount, memo: request.memo, }; diff --git a/src/services/member_bank_withdraw/models.rs b/src/services/member_bank_withdraw/models.rs index 3a61741..03de7b4 100644 --- a/src/services/member_bank_withdraw/models.rs +++ b/src/services/member_bank_withdraw/models.rs @@ -13,7 +13,7 @@ impl From<&repositories::member_bank_withdraw::models::MemberBankWithdraw> account_number: d.account_number.clone(), password: d.password.clone(), name: d.name.clone(), - amount: d.amount as u32, + amount: d.amount, memo: d.memo.clone(), state: d.state as i32, state_changed_at: d.state_changed_at as u64, @@ -34,7 +34,7 @@ impl From<&compositions::member_bank_withdraw::models::MemberBankWithdrawModel> account_number: d.account_number.clone(), password: d.password.clone(), name: d.name.clone(), - amount: d.amount as u32, + amount: d.amount, memo: d.memo.clone(), state: d.state as i32, state_changed_at: d.state_changed_at as u64, diff --git a/src/services/member_bank_withdraw/service.rs b/src/services/member_bank_withdraw/service.rs index d4cbee0..1484f92 100644 --- a/src/services/member_bank_withdraw/service.rs +++ b/src/services/member_bank_withdraw/service.rs @@ -175,7 +175,7 @@ impl Service { bank_name: request.bank_name, name: request.name, account_number: request.account_number, - amount: request.amount as i32, + amount: request.amount, password: request.password, memo: request.memo, }; @@ -326,7 +326,7 @@ impl Service { bank_name_like: s.bank_name_like, name_like: s.name_like, account_number_like: s.account_number_like, - amount: s.amount.map(|d| d as i32), + amount: s.amount, memo_like: s.memo_like, state: s.state.map(|d| { repositories::member_bank_withdraw::schema::MemberBankWithdrawState::from(d) @@ -629,7 +629,7 @@ impl Service { bank_name: request.bank_name, name: request.name, account_number: request.account_number, - amount: request.amount as i32, + amount: request.amount, password: request.password, memo: request.memo, };