-
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.
Implement remaining GraphQL operations for bank accounts. Resolves #67
- Loading branch information
Showing
4 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/server/RobinTTY.PersonalFinanceDashboard.API/Resolvers/Mutations/BankAccountMutations.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,44 @@ | ||
using HotChocolate.Types; | ||
using RobinTTY.PersonalFinanceDashboard.Core.Models; | ||
using RobinTTY.PersonalFinanceDashboard.Infrastructure.Repositories; | ||
|
||
namespace RobinTTY.PersonalFinanceDashboard.Api.Resolvers.Mutations; | ||
|
||
/// <summary> | ||
/// <see cref="BankAccount"/> related mutation resolvers. | ||
/// </summary> | ||
[MutationType] | ||
public class BankAccountMutations | ||
{ | ||
/// <summary> | ||
/// Create a new banking account. | ||
/// </summary> | ||
/// <param name="repository">The injected repository to use for data retrieval.</param> | ||
/// <param name="bankAccount">The banking account to create.</param> | ||
public async Task<BankAccount> CreateBankAccount(BankAccountRepository repository, BankAccount bankAccount) | ||
{ | ||
return await repository.AddBankAccount(bankAccount); | ||
} | ||
|
||
/// <summary> | ||
/// Update an existing banking account. | ||
/// </summary> | ||
/// <param name="repository">The injected repository to use for data retrieval.</param> | ||
/// <param name="bankAccount">The banking account to update.</param> | ||
/// <returns></returns> | ||
public async Task<BankAccount> UpdateBankAccount(BankAccountRepository repository, BankAccount bankAccount) | ||
{ | ||
return await repository.UpdateBankAccount(bankAccount); | ||
} | ||
|
||
/// <summary> | ||
/// Delete an existing bank account. | ||
/// </summary> | ||
/// <param name="repository">The injected repository to use for data retrieval.</param> | ||
/// <param name="bankAccountId">The id of the bank account to delete.</param> | ||
public async Task<bool> DeleteBankAccount(BankAccountRepository repository, | ||
Guid bankAccountId) | ||
{ | ||
return await repository.DeleteBankAccount(bankAccountId); | ||
} | ||
} |
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