From 0b6ad721165821f5be82770d15e397569cf2737f Mon Sep 17 00:00:00 2001 From: CodeLiturgy Date: Sat, 13 Aug 2022 01:53:22 +0100 Subject: [PATCH] wip adjustements finance transaction --- BlueWest.Data/Finance/FinanceTransaction.cs | 32 ++++++++++++------- .../Finance/FinanceTransactionInsertDto.cs | 30 ++++++++--------- .../Finance/FinanceTransactionReadDto.cs | 9 ++---- 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/BlueWest.Data/Finance/FinanceTransaction.cs b/BlueWest.Data/Finance/FinanceTransaction.cs index dcb2740..c7eb582 100644 --- a/BlueWest.Data/Finance/FinanceTransaction.cs +++ b/BlueWest.Data/Finance/FinanceTransaction.cs @@ -4,19 +4,34 @@ using MapTo; namespace BlueWest.Data { + public enum FinanceTransactionTypeEnum + { + ConsumerTypeBuy, + ConsumerTypeDonate, + BusinessIncomePayment + } + + + public class FinanceTransactionType + { + [Key] private FinanceTransactionTypeEnum Type; + private string FinanceTransactionDescription; + } + + [MapFrom(typeof(FinanceTransactionInsertDto))] public partial class FinanceTransaction { [Key] public TimeSpan CreationDate { get; set; } + public TimeSpan UserId { get; set; } public string Currency { get; } - public double Amount { get; } // To Buy - public double Quantity { get; } // Bought - public double Fee { get; } - public TimeSpan UploadedDate { get; } - public TimeSpan TransactionDate { get; } + + public FinanceTransactionType FinanceTransactionType {get;} + + public FinanceTransaction() { @@ -24,16 +39,11 @@ namespace BlueWest.Data } public FinanceTransaction(TimeSpan creationDate, TimeSpan userId, - string currency, double amount, double quantity, double fee, TimeSpan uploadedDate, TimeSpan transactionDate) + string currency, FinanceTransactionType financeTransactionType) { CreationDate = creationDate; UserId = userId; - Amount = amount; - Quantity = quantity; - Fee = fee; Currency = currency; - UploadedDate = uploadedDate; - TransactionDate = transactionDate; } } } \ No newline at end of file diff --git a/BlueWest.Data/Finance/FinanceTransactionInsertDto.cs b/BlueWest.Data/Finance/FinanceTransactionInsertDto.cs index 88e2357..3a04bb5 100644 --- a/BlueWest.Data/Finance/FinanceTransactionInsertDto.cs +++ b/BlueWest.Data/Finance/FinanceTransactionInsertDto.cs @@ -9,29 +9,25 @@ namespace BlueWest.Data public partial class FinanceTransactionInsertDto { - public string Currency { get; } - public double Amount { get; } // To Buy - public double Quantity { get; } // Bought - public double Fee { get; } - public TimeSpan UploadedDate { get; } - public TimeSpan TransactionDate { get; } + public TimeSpan UserId { get; set; } + + public string Currency { get; } + + public FinanceTransactionType FinanceTransactionType {get;} + public FinanceTransactionInsertDto( - string currency, - double amount , - double quantity, - double fee, - TimeSpan uploadedDate, - TimeSpan transactionDate) + TimeSpan userId, + string currency , + FinanceTransactionType financeTransactionType + ) { Currency = currency; - Amount = amount; - Quantity = quantity; - Fee = fee; - UploadedDate = uploadedDate; - TransactionDate = transactionDate; + UserId = userId; + Currency = currency; + FinanceTransactionType = financeTransactionType; } } } diff --git a/BlueWest.Data/Finance/FinanceTransactionReadDto.cs b/BlueWest.Data/Finance/FinanceTransactionReadDto.cs index 23c3e5a..606a6dd 100644 --- a/BlueWest.Data/Finance/FinanceTransactionReadDto.cs +++ b/BlueWest.Data/Finance/FinanceTransactionReadDto.cs @@ -9,14 +9,11 @@ namespace BlueWest.Data public partial class FinanceTransactionReadDto { - public TimeSpan CreationDate { get; set; } public TimeSpan UserId { get; set; } public string Currency { get; } - public double Amount { get; } // To Buy - public double Quantity { get; } // Bought - public double Fee { get; } - public TimeSpan UploadedDate { get; } - public TimeSpan TransactionDate { get; } + + public FinanceTransactionType FinanceTransactionType {get;} + } }