-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/RobinTTY/PersonalFinanceD…
- Loading branch information
Showing
21 changed files
with
331 additions
and
155 deletions.
There are no files selected for viewing
4 changes: 1 addition & 3 deletions
4
src/server/RobinTTY.PersonalFinanceDashboard.API/EfModels/EfTag.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
4 changes: 1 addition & 3 deletions
4
src/server/RobinTTY.PersonalFinanceDashboard.API/EfModels/EfTransaction.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
41 changes: 0 additions & 41 deletions
41
src/server/RobinTTY.PersonalFinanceDashboard.API/Models/Queries/AccountQueryResolvers.cs
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
...binTTY.PersonalFinanceDashboard.API/Models/Queries/AuthenticationRequestQueryResolvers.cs
This file was deleted.
Oops, something went wrong.
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
1 change: 1 addition & 0 deletions
1
src/server/RobinTTY.PersonalFinanceDashboard.API/Properties/ModuleInfo.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 @@ | ||
[assembly: Module("Types")] |
46 changes: 46 additions & 0 deletions
46
src/server/RobinTTY.PersonalFinanceDashboard.API/Repositories/AccountRepository.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,46 @@ | ||
using RobinTTY.PersonalFinanceDashboard.Core.Models; | ||
using RobinTTY.PersonalFinanceDashboard.ThirdPartyDataProviders; | ||
|
||
namespace RobinTTY.PersonalFinanceDashboard.API.Repositories; | ||
|
||
/// <summary> | ||
/// Manages <see cref="Account"/> data retrieval. | ||
/// </summary> | ||
public class AccountRepository | ||
{ | ||
private readonly ApplicationDbContext _dbContext; | ||
private readonly GoCardlessDataProvider _dataProvider; | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="AccountRepository"/>. | ||
/// </summary> | ||
/// <param name="dbContext">The <see cref="ApplicationDbContext"/> to use for data retrieval.</param> | ||
/// <param name="dataProvider">The data provider to use for data retrieval.</param> | ||
public AccountRepository(ApplicationDbContext dbContext, GoCardlessDataProvider dataProvider) | ||
{ | ||
_dbContext = dbContext; | ||
_dataProvider = dataProvider; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="BankAccount"/> matching the specified id. | ||
/// </summary> | ||
/// <param name="accountId">The id of the account to retrieve.</param> | ||
/// <returns>The <see cref="BankAccount"/> if one ist matched otherwise <see langword="null"/>.</returns> | ||
public async Task<BankAccount?> Get(string accountId) | ||
{ | ||
var account = await _dataProvider.GetBankAccount(accountId); | ||
return account.Result; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="BankAccount"/>s matching the specified ids. | ||
/// </summary> | ||
/// <param name="accountIds">The ids of the accounts to retrieve.</param> | ||
/// <returns>A list of the matched <see cref="BankAccount"/>s.</returns> | ||
public async Task<IEnumerable<BankAccount>> Get(IEnumerable<string> accountIds) | ||
{ | ||
var accounts = await _dataProvider.GetBankAccounts(accountIds); | ||
return accounts.Select(query => query.Result)!; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
...ver/RobinTTY.PersonalFinanceDashboard.API/Repositories/AuthenticationRequestRepository.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,71 @@ | ||
using RobinTTY.NordigenApiClient.Models.Responses; | ||
using RobinTTY.PersonalFinanceDashboard.Core.Models; | ||
using RobinTTY.PersonalFinanceDashboard.ThirdPartyDataProviders; | ||
|
||
namespace RobinTTY.PersonalFinanceDashboard.API.Repositories; | ||
|
||
/// <summary> | ||
/// Manages <see cref="AuthenticationRequest"/> data retrieval. | ||
/// </summary> | ||
public class AuthenticationRequestRepository | ||
{ | ||
private readonly ApplicationDbContext _dbContext; | ||
private readonly GoCardlessDataProvider _dataProvider; | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="AuthenticationRequestRepository"/>. | ||
/// </summary> | ||
/// <param name="dbContext">The <see cref="ApplicationDbContext"/> to use for data retrieval.</param> | ||
/// <param name="dataProvider">The data provider to use for data retrieval.</param> | ||
public AuthenticationRequestRepository(ApplicationDbContext dbContext, GoCardlessDataProvider dataProvider) | ||
{ | ||
_dbContext = dbContext; | ||
_dataProvider = dataProvider; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="AuthenticationRequest"/> matching the specified id. | ||
/// </summary> | ||
/// <param name="authenticationId">The id of the <see cref="AuthenticationRequest"/> to retrieve.</param> | ||
/// <returns>The <see cref="AuthenticationRequest"/> if one ist matched otherwise <see langword="null"/>.</returns> | ||
public async Task<AuthenticationRequest?> Get(string authenticationId) | ||
{ | ||
var requests = await _dataProvider.GetAuthenticationRequest(authenticationId); | ||
return requests.Result!; | ||
} | ||
|
||
/// <summary> | ||
/// Gets all <see cref="AuthenticationRequest"/>s. | ||
/// </summary> | ||
/// <returns>A list of all <see cref="AuthenticationRequest"/>s.</returns> | ||
public async Task<IEnumerable<AuthenticationRequest>> GetAll() | ||
{ | ||
// TODO: limit | ||
var requests = await _dataProvider.GetAuthenticationRequests(100); | ||
return requests.Result!; | ||
} | ||
|
||
/// <summary> | ||
/// Adds a new <see cref="AuthenticationRequest"/>. | ||
/// </summary> | ||
/// <param name="institutionId">The id of the institution to create a <see cref="AuthenticationRequest"/> for.</param> | ||
/// <param name="redirectUri">The URI of the page to redirect to after successful authentication.</param> | ||
/// <returns>The added <see cref="AuthenticationRequest"/>.</returns> | ||
public async Task<AuthenticationRequest> Add(string institutionId, string redirectUri) | ||
{ | ||
// TODO: URI validation (here or in resolver?) | ||
var request = await _dataProvider.CreateAuthenticationRequest(institutionId, new Uri(redirectUri)); | ||
return request.Result!; | ||
} | ||
|
||
/// <summary> | ||
/// Deletes an existing <see cref="AuthenticationRequest"/>. | ||
/// </summary> | ||
/// <param name="authenticationId">The id of the <see cref="AuthenticationRequest"/> to delete.</param> | ||
/// <returns>TODO</returns> | ||
public async Task<BasicResponse> Delete(string authenticationId) | ||
{ | ||
var request = await _dataProvider.DeleteAuthenticationRequest(authenticationId); | ||
return request.Result!; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...server/RobinTTY.PersonalFinanceDashboard.API/Repositories/BankingInstitutionRepository.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,45 @@ | ||
using RobinTTY.PersonalFinanceDashboard.Core.Models; | ||
using RobinTTY.PersonalFinanceDashboard.ThirdPartyDataProviders; | ||
|
||
namespace RobinTTY.PersonalFinanceDashboard.API.Repositories; | ||
|
||
/// <summary> | ||
/// Manages <see cref="BankingInstitution"/> data retrieval. | ||
/// </summary> | ||
public class BankingInstitutionRepository | ||
{ | ||
private readonly ApplicationDbContext _dbContext; | ||
private readonly GoCardlessDataProvider _dataProvider; | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="BankingInstitutionRepository"/>. | ||
/// </summary> | ||
/// <param name="dbContext">The <see cref="ApplicationDbContext"/> to use for data retrieval.</param> | ||
/// <param name="dataProvider">The data provider to use for data retrieval.</param> | ||
public BankingInstitutionRepository(ApplicationDbContext dbContext, GoCardlessDataProvider dataProvider) | ||
{ | ||
_dbContext = dbContext; | ||
_dataProvider = dataProvider; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="BankingInstitution"/> matching the specified id. | ||
/// </summary> | ||
/// <param name="institutionId">The id of the <see cref="BankingInstitution"/> to retrieve.</param> | ||
/// <returns>The <see cref="BankingInstitution"/> if one ist matched otherwise <see langword="null"/>.</returns> | ||
public async Task<BankingInstitution?> Get(string institutionId) | ||
{ | ||
var request = await _dataProvider.GetBankingInstitution(institutionId); | ||
return request.Result!; | ||
} | ||
|
||
/// <summary> | ||
/// Gets all <see cref="BankingInstitution"/>s. | ||
/// </summary> | ||
/// <returns>A list of all <see cref="BankingInstitution"/>s.</returns> | ||
public async Task<IEnumerable<BankingInstitution>> GetAll(string? countryCode) | ||
{ | ||
var request = await _dataProvider.GetBankingInstitutions(countryCode); | ||
return request.Result!; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...eDashboard.API/Models/AppConfiguration.cs → ...ceDashboard.API/Types/AppConfiguration.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
Oops, something went wrong.