-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Star-Academy/feature/get-all-transactions
Feature/get all transactions
- Loading branch information
Showing
9 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/Application/DTOs/TransactionCsv/GetAllTransactionsResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Web.DTOs.Transaction; | ||
|
||
public class GetAllTransactionsResponse | ||
{ | ||
public List<TransactionDto> Transactions { get; set; } = new(); | ||
|
||
public class TransactionDto | ||
{ | ||
public long TransactionId { get; set; } | ||
public long SourceAccountId { get; set; } | ||
public long DestinationAccountId { get; set; } | ||
public decimal Amount { get; set; } | ||
public DateTime Date { get; set; } | ||
public string Type { get; set; } = string.Empty; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
using Application.DTOs; | ||
using Web.DTOs.Transaction; | ||
|
||
namespace Application.Interfaces.Services; | ||
|
||
public interface ITransactionService | ||
{ | ||
Task AddTransactionsFromCsvAsync(string filePath); | ||
Task<Result<GetAllTransactionsResponse>> GetAllTransactions(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Web.DTOs.Transaction; | ||
using Domain.Entities; | ||
|
||
namespace Application.Mappers | ||
{ | ||
public static class TransactionMapper | ||
{ | ||
public static GetAllTransactionsResponse ToGetAllTransactionsResponse(this List<Transaction> transactions) | ||
{ | ||
return new GetAllTransactionsResponse | ||
{ | ||
Transactions = transactions.Select(transaction => new GetAllTransactionsResponse.TransactionDto | ||
{ | ||
TransactionId = transaction.TransactionId, | ||
SourceAccountId = transaction.SourceAccountId, | ||
DestinationAccountId = transaction.DestinationAccountId, | ||
Amount = transaction.Amount, | ||
Date = transaction.Date, | ||
Type = transaction.Type | ||
}).ToList() | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Web.DTOs.Transaction; | ||
|
||
public class GotAllTransactionsDto | ||
{ | ||
public long TransactionId { get; set; } | ||
public long SourceAccountId { get; set; } | ||
public long DestinationAccountId { get; set; } | ||
public decimal Amount { get; set; } | ||
public DateTime Date { get; set; } | ||
public string Type { get; set; } = string.Empty; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters