From b01b5bdea4f70d46c6ba33d5706e2c41f4879aa8 Mon Sep 17 00:00:00 2001 From: Amos Date: Tue, 9 Jun 2026 20:28:28 +0300 Subject: [PATCH] Your commit message --- .editorconfig | 0 CommBank-Server/Collections/Accounts.json | 53 +++ CommBank-Server/Collections/Goals.json | 94 ++++++ CommBank-Server/Collections/Tags.json | 26 ++ CommBank-Server/Collections/Transactions.json | 310 ++++++++++++++++++ CommBank-Server/Collections/Users.json | 69 ++++ CommBank-Server/CommBank.csproj | 8 + .../Controllers/AccountController.cs | 6 + CommBank-Server/Controllers/AuthController.cs | 6 + CommBank-Server/Controllers/GoalController.cs | 7 + CommBank-Server/Controllers/HomeController.cs | 6 + CommBank-Server/Controllers/TagController.cs | 6 + .../Controllers/TransactionController.cs | 6 + CommBank-Server/Controllers/UserController.cs | 6 + CommBank-Server/Models/Goal.cs | 5 + CommBank-Server/Models/LoginInput.cs | 7 + CommBank-Server/Models/UpdatedIcon.cs | 6 + CommBank-Server/Program.cs | 41 +++ CommBank-Server/Secrets.json | 4 + CommBank-Server/Services/AccountService.cs | 6 + CommBank-Server/Services/AuthService.cs | 6 + CommBank-Server/Services/GoalService.cs | 6 + CommBank-Server/Services/TagsService.cs | 6 + .../Services/TransactionsService.cs | 6 + CommBank-Server/Services/UsersService.cs | 6 + CommBank.Tests/CommBank.Tests.csproj | 4 + CommBank.Tests/Fake/FakeAccountsService.cs | 7 + CommBank.Tests/Fake/FakeGoalsService.cs | 7 + CommBank.Tests/Fake/FakeTagsService.cs | 7 + .../Fake/FakeTransactionsService.cs | 7 + CommBank.Tests/Fake/FakeUsersService.cs | 7 + 31 files changed, 741 insertions(+) create mode 100644 .editorconfig create mode 100644 CommBank-Server/Collections/Accounts.json create mode 100644 CommBank-Server/Collections/Goals.json create mode 100644 CommBank-Server/Collections/Tags.json create mode 100644 CommBank-Server/Collections/Transactions.json create mode 100644 CommBank-Server/Collections/Users.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..e69de29b diff --git a/CommBank-Server/Collections/Accounts.json b/CommBank-Server/Collections/Accounts.json new file mode 100644 index 00000000..c94a91dc --- /dev/null +++ b/CommBank-Server/Collections/Accounts.json @@ -0,0 +1,53 @@ +[{ + "_id": { + "$oid": "62a3e6aad25715026d1a2938" + }, + "Number": 123456789, + "Name": "Tag's Goal Saver", + "Balance": 6483.81, + "AccountType": "GoalSaver", + "TransactionIds": [ + { + "$oid": "62a3a284d07648900df72860" + }, + { + "$oid": "62a3a2ded07648900df72861" + }, + { + "$oid": "62a3a2ded07648900df72862" + }, + { + "$oid": "62a3a2ded07648900df72863" + }, + { + "$oid": "62a3a2ded07648900df72864" + }, + { + "$oid": "62a3a2ded07648900df72865" + }, + { + "$oid": "62a3a2ded07648900df72866" + }, + { + "$oid": "62a3a2ded07648900df72867" + }, + { + "$oid": "62a3a2ded07648900df72868" + }, + { + "$oid": "62a3a2ded07648900df72869" + }, + { + "$oid": "62a3a344d07648900df7286a" + }, + { + "$oid": "62a3a344d07648900df7286b" + }, + { + "$oid": "62a3a344d07648900df7286c" + }, + { + "$oid": "62a3a344d07648900df7286d" + } + ] +}] \ No newline at end of file diff --git a/CommBank-Server/Collections/Goals.json b/CommBank-Server/Collections/Goals.json new file mode 100644 index 00000000..f42d18ba --- /dev/null +++ b/CommBank-Server/Collections/Goals.json @@ -0,0 +1,94 @@ +[ + { + "_id": { + "$oid": "62a3f587102e921da1253d32" + }, + "Name": "House Down Payment", + "TargetAmount": 100000, + "TargetDate": { + "$date": { + "$numberLong": "1736312400000" + } + }, + "Balance": 73501.82, + "Created": { + "$date": { + "$numberLong": "1654912390857" + } + }, + "TransactionIds": null, + "TagIds": null, + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3f5e0102e921da1253d33" + }, + "Name": "Tesla Model Y", + "TargetAmount": 60000, + "TargetDate": { + "$date": { + "$numberLong": "1662004800000" + } + }, + "Balance": 43840.02, + "Created": { + "$date": { + "$numberLong": "1654912480950" + } + }, + "TransactionIds": null, + "TagIds": null, + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3f62e102e921da1253d34" + }, + "Name": "Trip to London", + "TargetAmount": 3500, + "TargetDate": { + "$date": { + "$numberLong": "1659412800000" + } + }, + "Created": { + "$date": { + "$numberLong": "1654912558236" + } + }, + "TransactionIds": null, + "TagIds": null, + "Balance": 753.89, + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a61945fa15f1cd18516a5f" + }, + "Name": "Trip to NYC", + "TargetAmount": 800, + "TargetDate": { + "$date": { + "$numberLong": "1702184400000" + } + }, + "Balance": 0, + "Created": { + "$date": { + "$numberLong": "1655053065668" + } + }, + "TransactionIds": null, + "TagIds": null, + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + } +] \ No newline at end of file diff --git a/CommBank-Server/Collections/Tags.json b/CommBank-Server/Collections/Tags.json new file mode 100644 index 00000000..202e1abc --- /dev/null +++ b/CommBank-Server/Collections/Tags.json @@ -0,0 +1,26 @@ +[{ + "_id": { + "$oid": "62a39d27025ca1ba8f1f1c1e" + }, + "Name": "Groceries" +},{ + "_id": { + "$oid": "62a39d42025ca1ba8f1f1c1f" + }, + "Name": "Restaurant" +},{ + "_id": { + "$oid": "62a39d4e025ca1ba8f1f1c20" + }, + "Name": "Income" +},{ + "_id": { + "$oid": "62a39d5a025ca1ba8f1f1c21" + }, + "Name": "Gas" +},{ + "_id": { + "$oid": "62a39d63025ca1ba8f1f1c22" + }, + "Name": "Investment" +}] \ No newline at end of file diff --git a/CommBank-Server/Collections/Transactions.json b/CommBank-Server/Collections/Transactions.json new file mode 100644 index 00000000..9320984d --- /dev/null +++ b/CommBank-Server/Collections/Transactions.json @@ -0,0 +1,310 @@ +[ + { + "_id": { + "$oid": "62a3a284d07648900df72860" + }, + "TransactionType": "Debit", + "Amount": 135.39, + "DateTime": { + "$date": { + "$numberLong": "1654891140391" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d27025ca1ba8f1f1c1e" + } + ], + "Description": "Whole Foods", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a2ded07648900df72861" + }, + "TransactionType": "Debit", + "Amount": 139.26, + "DateTime": { + "$date": { + "$numberLong": "1654027230566" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d27025ca1ba8f1f1c1e" + } + ], + "Description": "Whole Foods", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a2ebd07648900df72862" + }, + "TransactionType": "Debit", + "Amount": 26.39, + "DateTime": { + "$date": { + "$numberLong": "1654891243091" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d42025ca1ba8f1f1c1f" + } + ], + "Description": "Chipotle", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a2ecd07648900df72863" + }, + "TransactionType": "Debit", + "Amount": 21.9, + "DateTime": { + "$date": { + "$numberLong": "1654027230566" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d42025ca1ba8f1f1c1f" + } + ], + "Description": "Chipotle", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a316d07648900df72864" + }, + "TransactionType": "Credit", + "Amount": 5622.81, + "DateTime": { + "$date": { + "$numberLong": "1654891286080" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d4e025ca1ba8f1f1c20" + } + ], + "Description": "Dropbox", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a318d07648900df72865" + }, + "TransactionType": "Credit", + "Amount": 5622.92, + "DateTime": { + "$date": { + "$numberLong": "1654027230566" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d4e025ca1ba8f1f1c20" + } + ], + "Description": "Dropbox", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a323d07648900df72866" + }, + "TransactionType": "Credit", + "Amount": 1439.18, + "DateTime": { + "$date": { + "$numberLong": "1654891299481" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d4e025ca1ba8f1f1c20" + } + ], + "Description": "Fencer", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a324d07648900df72867" + }, + "TransactionType": "Credit", + "Amount": 1439.89, + "DateTime": { + "$date": { + "$numberLong": "1654027230566" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d4e025ca1ba8f1f1c20" + } + ], + "Description": "Fencer", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a337d07648900df72868" + }, + "TransactionType": "Debit", + "Amount": 44.52, + "DateTime": { + "$date": { + "$numberLong": "1654891319411" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d5a025ca1ba8f1f1c21" + } + ], + "Description": "Gas", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a338d07648900df72869" + }, + "TransactionType": "Debit", + "Amount": 44.13, + "DateTime": { + "$date": { + "$numberLong": "1654027230566" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d5a025ca1ba8f1f1c21" + } + ], + "Description": "Gas", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a344d07648900df7286a" + }, + "TransactionType": "Debit", + "Amount": 1500, + "DateTime": { + "$date": { + "$numberLong": "1654891332111" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d63025ca1ba8f1f1c22" + } + ], + "Description": "Coinbase", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a344d07648900df7286b" + }, + "TransactionType": "Debit", + "Amount": 1500, + "DateTime": { + "$date": { + "$numberLong": "1654027230566" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d63025ca1ba8f1f1c22" + } + ], + "Description": "Coinbase", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a348d07648900df7286c" + }, + "TransactionType": "Debit", + "Amount": 1500, + "DateTime": { + "$date": { + "$numberLong": "1654891336929" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d63025ca1ba8f1f1c22" + } + ], + "Description": "Titan", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + }, + { + "_id": { + "$oid": "62a3a349d07648900df7286d" + }, + "TransactionType": "Debit", + "Amount": 1500, + "DateTime": { + "$date": { + "$numberLong": "1654027230566" + } + }, + "GoalId": null, + "TagIds": [ + { + "$oid": "62a39d63025ca1ba8f1f1c22" + } + ], + "Description": "Titan", + "UserId": { + "$oid": "62a29c15f4605c4c9fa7f306" + } + } +] \ No newline at end of file diff --git a/CommBank-Server/Collections/Users.json b/CommBank-Server/Collections/Users.json new file mode 100644 index 00000000..aa8243cd --- /dev/null +++ b/CommBank-Server/Collections/Users.json @@ -0,0 +1,69 @@ +[ + { + "_id": { + "$oid": "62a29c15f4605c4c9fa7f306" + }, + "Name": "Tag Ramotar", + "Email": "tag@dropbox.com", + "Password": "$2a$11$10VhY5XIwBeWA4uLIE.sr.c34UvwLRQPD8yy7z/4iiN6ez5z2Pg1S", + "AccountIds": null, + "GoalIds": [ + { + "$oid": "62a3f587102e921da1253d32" + }, + { + "$oid": "62a3f5e0102e921da1253d33" + }, + { + "$oid": "62a3f62e102e921da1253d34" + }, + { + "$oid": "62a61945fa15f1cd18516a5f" + } + ], + "TransactionIds": [ + { + "$oid": "62a3a284d07648900df72860" + }, + { + "$oid": "62a3a2ded07648900df72861" + }, + { + "$oid": "62a3a2ebd07648900df72862" + }, + { + "$oid": "62a3a2ebd07648900df72863" + }, + { + "$oid": "62a3a2ebd07648900df72864" + }, + { + "$oid": "62a3a2ebd07648900df72865" + }, + { + "$oid": "62a3a2ebd07648900df72866" + }, + { + "$oid": "62a3a2ebd07648900df72867" + }, + { + "$oid": "62a3a2ebd07648900df72868" + }, + { + "$oid": "62a3a2ebd07648900df72869" + }, + { + "$oid": "62a3a344d07648900df7286a" + }, + { + "$oid": "62a3a344d07648900df7286b" + }, + { + "$oid": "62a3a348d07648900df7286c" + }, + { + "$oid": "62a3a349d07648900df7286d" + } + ] + } +] \ No newline at end of file diff --git a/CommBank-Server/CommBank.csproj b/CommBank-Server/CommBank.csproj index 983cc882..18fb0263 100644 --- a/CommBank-Server/CommBank.csproj +++ b/CommBank-Server/CommBank.csproj @@ -1,7 +1,11 @@ +<<<<<<< HEAD net6.0 +======= + net10.0 +>>>>>>> 2bc1eb6 (Your commit message) enable enable CommBank_Server @@ -13,7 +17,11 @@ +<<<<<<< HEAD +======= + +>>>>>>> 2bc1eb6 (Your commit message) diff --git a/CommBank-Server/Controllers/AccountController.cs b/CommBank-Server/Controllers/AccountController.cs index b5b22995..e201c801 100644 --- a/CommBank-Server/Controllers/AccountController.cs +++ b/CommBank-Server/Controllers/AccountController.cs @@ -6,12 +6,18 @@ namespace CommBank.Controllers; [ApiController] [Route("api/[controller]")] +<<<<<<< HEAD public class AccountController : ControllerBase { private readonly IAccountsService _accountsService; public AccountController(IAccountsService accountsService) => _accountsService = accountsService; +======= +public class AccountController(IAccountsService accountsService) : ControllerBase +{ + private readonly IAccountsService _accountsService = accountsService; +>>>>>>> 2bc1eb6 (Your commit message) [HttpGet] public async Task> Get() => diff --git a/CommBank-Server/Controllers/AuthController.cs b/CommBank-Server/Controllers/AuthController.cs index 52bbe0c9..c5eeec34 100644 --- a/CommBank-Server/Controllers/AuthController.cs +++ b/CommBank-Server/Controllers/AuthController.cs @@ -6,12 +6,18 @@ namespace CommBank.Controllers; [ApiController] [Route("api/Auth")] +<<<<<<< HEAD public class AuthController : ControllerBase { private readonly AuthService _authService; public AuthController(AuthService authService) => _authService = authService; +======= +public class AuthController(AuthService authService) : ControllerBase +{ + private readonly AuthService _authService = authService; +>>>>>>> 2bc1eb6 (Your commit message) [HttpPost("Login")] public async Task Post(LoginInput input) diff --git a/CommBank-Server/Controllers/GoalController.cs b/CommBank-Server/Controllers/GoalController.cs index 98271a5f..2e4c5210 100644 --- a/CommBank-Server/Controllers/GoalController.cs +++ b/CommBank-Server/Controllers/GoalController.cs @@ -6,6 +6,7 @@ namespace CommBank.Controllers; [ApiController] [Route("api/[controller]")] +<<<<<<< HEAD public class GoalController : ControllerBase { private readonly IGoalsService _goalsService; @@ -16,6 +17,12 @@ public GoalController(IGoalsService goalsService, IUsersService usersService) _goalsService = goalsService; _usersService = usersService; } +======= +public class GoalController(IGoalsService goalsService, IUsersService usersService) : ControllerBase +{ + private readonly IGoalsService _goalsService = goalsService; + private readonly IUsersService _usersService = usersService; +>>>>>>> 2bc1eb6 (Your commit message) [HttpGet] public async Task> Get() => diff --git a/CommBank-Server/Controllers/HomeController.cs b/CommBank-Server/Controllers/HomeController.cs index 1bbc6cff..003642f2 100644 --- a/CommBank-Server/Controllers/HomeController.cs +++ b/CommBank-Server/Controllers/HomeController.cs @@ -4,6 +4,7 @@ namespace CommBank.Controllers; +<<<<<<< HEAD public class HomeController : Controller { private readonly ILogger _logger; @@ -12,6 +13,11 @@ public HomeController(ILogger logger) { _logger = logger; } +======= +public class HomeController(ILogger logger) : Controller +{ + private readonly ILogger _logger = logger; +>>>>>>> 2bc1eb6 (Your commit message) public IActionResult Index() { diff --git a/CommBank-Server/Controllers/TagController.cs b/CommBank-Server/Controllers/TagController.cs index 1311a2f9..c5e8652a 100644 --- a/CommBank-Server/Controllers/TagController.cs +++ b/CommBank-Server/Controllers/TagController.cs @@ -5,12 +5,18 @@ namespace CommBank.Controllers; [ApiController] [Route("api/[controller]")] +<<<<<<< HEAD public class TagController : ControllerBase { private readonly ITagsService _tagsService; public TagController(ITagsService tagsService) => _tagsService = tagsService; +======= +public class TagController(ITagsService tagsService) : ControllerBase +{ + private readonly ITagsService _tagsService = tagsService; +>>>>>>> 2bc1eb6 (Your commit message) [HttpGet] public async Task> Get() => diff --git a/CommBank-Server/Controllers/TransactionController.cs b/CommBank-Server/Controllers/TransactionController.cs index c8e0293a..e67e8c88 100644 --- a/CommBank-Server/Controllers/TransactionController.cs +++ b/CommBank-Server/Controllers/TransactionController.cs @@ -6,12 +6,18 @@ namespace CommBank.Controllers; [ApiController] [Route("api/[controller]")] +<<<<<<< HEAD public class TransactionController : ControllerBase { private readonly ITransactionsService _transactionsService; public TransactionController(ITransactionsService transactionsService) => _transactionsService = transactionsService; +======= +public class TransactionController(ITransactionsService transactionsService) : ControllerBase +{ + private readonly ITransactionsService _transactionsService = transactionsService; +>>>>>>> 2bc1eb6 (Your commit message) [HttpGet] public async Task> Get() => diff --git a/CommBank-Server/Controllers/UserController.cs b/CommBank-Server/Controllers/UserController.cs index b4d1e7ce..99b595d0 100644 --- a/CommBank-Server/Controllers/UserController.cs +++ b/CommBank-Server/Controllers/UserController.cs @@ -6,12 +6,18 @@ namespace CommBank.Controllers; [ApiController] [Route("api/[controller]")] +<<<<<<< HEAD public class UserController : ControllerBase { private readonly IUsersService _usersService; public UserController(IUsersService usersService) => _usersService = usersService; +======= +public class UserController(IUsersService usersService) : ControllerBase +{ + private readonly IUsersService _usersService = usersService; +>>>>>>> 2bc1eb6 (Your commit message) [HttpGet] public async Task> Get() => diff --git a/CommBank-Server/Models/Goal.cs b/CommBank-Server/Models/Goal.cs index 77ff1ad5..d6f6883c 100644 --- a/CommBank-Server/Models/Goal.cs +++ b/CommBank-Server/Models/Goal.cs @@ -27,4 +27,9 @@ public class Goal [BsonRepresentation(BsonType.ObjectId)] public string? UserId { get; set; } +<<<<<<< HEAD +======= + public string? Icon { get; set; } + +>>>>>>> 2bc1eb6 (Your commit message) } \ No newline at end of file diff --git a/CommBank-Server/Models/LoginInput.cs b/CommBank-Server/Models/LoginInput.cs index deb7336f..a782cbb5 100644 --- a/CommBank-Server/Models/LoginInput.cs +++ b/CommBank-Server/Models/LoginInput.cs @@ -7,6 +7,7 @@ interface ILoginInput } +<<<<<<< HEAD public class LoginInput : ILoginInput { public LoginInput(string email, string password) @@ -17,4 +18,10 @@ public LoginInput(string email, string password) public string Email { get; set; } public string Password { get; set; } +======= +public class LoginInput(string email, string password) : ILoginInput +{ + public string Email { get; set; } = email; + public string Password { get; set; } = password; +>>>>>>> 2bc1eb6 (Your commit message) } diff --git a/CommBank-Server/Models/UpdatedIcon.cs b/CommBank-Server/Models/UpdatedIcon.cs index 9b3602f2..28340594 100644 --- a/CommBank-Server/Models/UpdatedIcon.cs +++ b/CommBank-Server/Models/UpdatedIcon.cs @@ -6,6 +6,7 @@ interface IUpdatedIcon } +<<<<<<< HEAD public class UpdatedIcon : IUpdatedIcon { public UpdatedIcon(string icon) @@ -14,4 +15,9 @@ public UpdatedIcon(string icon) } public string Icon { get; set; } +======= +public class UpdatedIcon(string icon) : IUpdatedIcon +{ + public string Icon { get; set; } = icon; +>>>>>>> 2bc1eb6 (Your commit message) } diff --git a/CommBank-Server/Program.cs b/CommBank-Server/Program.cs index a88e560d..52d3559e 100644 --- a/CommBank-Server/Program.cs +++ b/CommBank-Server/Program.cs @@ -5,6 +5,7 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); +<<<<<<< HEAD builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); @@ -13,6 +14,26 @@ var mongoClient = new MongoClient(builder.Configuration.GetConnectionString("CommBank")); var mongoDatabase = mongoClient.GetDatabase("CommBank"); +======= +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +// Load config +builder.Configuration + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("Secrets.json"); + +// ✅ CREATE CLIENT FIRST (this was missing) +var mongoClient = new MongoClient( + builder.Configuration.GetConnectionString("CommBank") +); + +var mongoDatabase = mongoClient.GetDatabase("commbank"); + +// DI registrations +builder.Services.AddSingleton(mongoClient); +builder.Services.AddSingleton(mongoDatabase); +>>>>>>> 2bc1eb6 (Your commit message) IAccountsService accountsService = new AccountsService(mongoDatabase); IAuthService authService = new AuthService(mongoDatabase); @@ -28,14 +49,26 @@ builder.Services.AddSingleton(transactionsService); builder.Services.AddSingleton(usersService); +<<<<<<< HEAD +======= + +>>>>>>> 2bc1eb6 (Your commit message) builder.Services.AddCors(); var app = builder.Build(); +<<<<<<< HEAD app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); +======= +app.UseCors(cors => cors + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() +); +>>>>>>> 2bc1eb6 (Your commit message) if (app.Environment.IsDevelopment()) { @@ -44,10 +77,18 @@ } app.UseHttpsRedirection(); +<<<<<<< HEAD app.UseAuthorization(); app.MapControllers(); +======= +app.UseAuthorization(); +app.MapControllers(); + +// Import data on startup + +>>>>>>> 2bc1eb6 (Your commit message) app.Run(); diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json index 0e5bf949..26d0d235 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,9 @@ { "ConnectionStrings": { +<<<<<<< HEAD "CommBank": "{CONNECTION_STRING}" +======= + "CommBank": "mongodb+srv://amos:Kl.61541913@vstudy.q90jlep.mongodb.net/CommBank?appName=vstudy" +>>>>>>> 2bc1eb6 (Your commit message) } } \ No newline at end of file diff --git a/CommBank-Server/Services/AccountService.cs b/CommBank-Server/Services/AccountService.cs index 52d1cb9b..77b4e590 100644 --- a/CommBank-Server/Services/AccountService.cs +++ b/CommBank-Server/Services/AccountService.cs @@ -4,6 +4,7 @@ namespace CommBank.Services; +<<<<<<< HEAD public class AccountsService : IAccountsService { private readonly IMongoCollection _accountsCollection; @@ -12,6 +13,11 @@ public AccountsService(IMongoDatabase mongoDatabase) { _accountsCollection = mongoDatabase.GetCollection("Accounts"); } +======= +public class AccountsService(IMongoDatabase mongoDatabase) : IAccountsService +{ + private readonly IMongoCollection _accountsCollection = mongoDatabase.GetCollection("Accounts"); +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await _accountsCollection.Find(_ => true).ToListAsync(); diff --git a/CommBank-Server/Services/AuthService.cs b/CommBank-Server/Services/AuthService.cs index c37de8ea..f4cb385a 100644 --- a/CommBank-Server/Services/AuthService.cs +++ b/CommBank-Server/Services/AuthService.cs @@ -4,6 +4,7 @@ namespace CommBank.Services; +<<<<<<< HEAD public class AuthService : IAuthService { private readonly IMongoCollection _usersCollection; @@ -12,6 +13,11 @@ public AuthService(IMongoDatabase mongoDatabase) { _usersCollection = mongoDatabase.GetCollection("Users"); } +======= +public class AuthService(IMongoDatabase mongoDatabase) : IAuthService +{ + private readonly IMongoCollection _usersCollection = mongoDatabase.GetCollection("Users"); +>>>>>>> 2bc1eb6 (Your commit message) public async Task Login(string email, string password) { diff --git a/CommBank-Server/Services/GoalService.cs b/CommBank-Server/Services/GoalService.cs index b0c600a1..9622876e 100644 --- a/CommBank-Server/Services/GoalService.cs +++ b/CommBank-Server/Services/GoalService.cs @@ -3,6 +3,7 @@ namespace CommBank.Services; +<<<<<<< HEAD public class GoalsService : IGoalsService { private readonly IMongoCollection _goalsCollection; @@ -11,6 +12,11 @@ public GoalsService(IMongoDatabase mongoDatabase) { _goalsCollection = mongoDatabase.GetCollection("Goals"); } +======= +public class GoalsService(IMongoDatabase mongoDatabase) : IGoalsService +{ + private readonly IMongoCollection _goalsCollection = mongoDatabase.GetCollection("Goals"); +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await _goalsCollection.Find(_ => true).ToListAsync(); diff --git a/CommBank-Server/Services/TagsService.cs b/CommBank-Server/Services/TagsService.cs index daf8e589..756e7a98 100644 --- a/CommBank-Server/Services/TagsService.cs +++ b/CommBank-Server/Services/TagsService.cs @@ -4,6 +4,7 @@ namespace CommBank.Services; +<<<<<<< HEAD public class TagsService : ITagsService { private readonly IMongoCollection _tagsCollection; @@ -12,6 +13,11 @@ public TagsService(IMongoDatabase mongoDatabase) { _tagsCollection = mongoDatabase.GetCollection("Tags"); } +======= +public class TagsService(IMongoDatabase mongoDatabase) : ITagsService +{ + private readonly IMongoCollection _tagsCollection = mongoDatabase.GetCollection("Tags"); +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await _tagsCollection.Find(_ => true).ToListAsync(); diff --git a/CommBank-Server/Services/TransactionsService.cs b/CommBank-Server/Services/TransactionsService.cs index 77718468..ebe787f1 100644 --- a/CommBank-Server/Services/TransactionsService.cs +++ b/CommBank-Server/Services/TransactionsService.cs @@ -4,6 +4,7 @@ namespace CommBank.Services; +<<<<<<< HEAD public class TransactionsService : ITransactionsService { private readonly IMongoCollection _transactionsCollection; @@ -12,6 +13,11 @@ public TransactionsService(IMongoDatabase mongoDatabase) { _transactionsCollection = mongoDatabase.GetCollection("Transactions"); } +======= +public class TransactionsService(IMongoDatabase mongoDatabase) : ITransactionsService +{ + private readonly IMongoCollection _transactionsCollection = mongoDatabase.GetCollection("Transactions"); +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await _transactionsCollection.Find(_ => true).ToListAsync(); diff --git a/CommBank-Server/Services/UsersService.cs b/CommBank-Server/Services/UsersService.cs index 4c4c32f0..f2319892 100644 --- a/CommBank-Server/Services/UsersService.cs +++ b/CommBank-Server/Services/UsersService.cs @@ -4,6 +4,7 @@ namespace CommBank.Services; +<<<<<<< HEAD public class UsersService : IUsersService { private readonly IMongoCollection _usersCollection; @@ -12,6 +13,11 @@ public UsersService(IMongoDatabase mongoDatabase) { _usersCollection = mongoDatabase.GetCollection("Users"); } +======= +public class UsersService(IMongoDatabase mongoDatabase) : IUsersService +{ + private readonly IMongoCollection _usersCollection = mongoDatabase.GetCollection("Users"); +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await _usersCollection.Find(_ => true).ToListAsync(); diff --git a/CommBank.Tests/CommBank.Tests.csproj b/CommBank.Tests/CommBank.Tests.csproj index 4d9413f4..2f17240c 100644 --- a/CommBank.Tests/CommBank.Tests.csproj +++ b/CommBank.Tests/CommBank.Tests.csproj @@ -1,7 +1,11 @@ +<<<<<<< HEAD net6.0 +======= + net10.0 +>>>>>>> 2bc1eb6 (Your commit message) enable enable diff --git a/CommBank.Tests/Fake/FakeAccountsService.cs b/CommBank.Tests/Fake/FakeAccountsService.cs index c16ff219..0ef649ac 100644 --- a/CommBank.Tests/Fake/FakeAccountsService.cs +++ b/CommBank.Tests/Fake/FakeAccountsService.cs @@ -4,6 +4,7 @@ namespace CommBank.Tests.Fake; +<<<<<<< HEAD public class FakeAccountsService : IAccountsService { List _accounts; @@ -14,6 +15,12 @@ public FakeAccountsService(List accounts, Account account) _accounts = accounts; _account = account; } +======= +public class FakeAccountsService(List accounts, Account account) : IAccountsService +{ + List _accounts = accounts; + Account _account = account; +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await Task.FromResult(_accounts); diff --git a/CommBank.Tests/Fake/FakeGoalsService.cs b/CommBank.Tests/Fake/FakeGoalsService.cs index 643a27e6..c71e3c08 100644 --- a/CommBank.Tests/Fake/FakeGoalsService.cs +++ b/CommBank.Tests/Fake/FakeGoalsService.cs @@ -4,6 +4,7 @@ namespace CommBank.Tests.Fake; +<<<<<<< HEAD public class FakeGoalsService : IGoalsService { List _goals; @@ -14,6 +15,12 @@ public FakeGoalsService(List goals, Goal goal) _goals = goals; _goal = goal; } +======= +public class FakeGoalsService(List goals, Goal goal) : IGoalsService +{ + List _goals = goals; + Goal _goal = goal; +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await Task.FromResult(_goals); diff --git a/CommBank.Tests/Fake/FakeTagsService.cs b/CommBank.Tests/Fake/FakeTagsService.cs index fc796930..66519121 100644 --- a/CommBank.Tests/Fake/FakeTagsService.cs +++ b/CommBank.Tests/Fake/FakeTagsService.cs @@ -3,6 +3,7 @@ namespace CommBank.Tests.Fake; +<<<<<<< HEAD public class FakeTagsService : ITagsService { List _tags; @@ -13,6 +14,12 @@ public FakeTagsService(List tags, Tag tag) _tags = tags; _tag = tag; } +======= +public class FakeTagsService(List tags, Tag tag) : ITagsService +{ + List _tags = tags; + Tag _tag = tag; +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await Task.FromResult(_tags); diff --git a/CommBank.Tests/Fake/FakeTransactionsService.cs b/CommBank.Tests/Fake/FakeTransactionsService.cs index 555a5865..785b13df 100644 --- a/CommBank.Tests/Fake/FakeTransactionsService.cs +++ b/CommBank.Tests/Fake/FakeTransactionsService.cs @@ -3,6 +3,7 @@ namespace CommBank.Tests.Fake; +<<<<<<< HEAD public class FakeTransactionsService : ITransactionsService { List _transactions; @@ -13,6 +14,12 @@ public FakeTransactionsService(List transactions, Transaction trans _transactions = transactions; _transaction = transaction; } +======= +public class FakeTransactionsService(List transactions, Transaction transaction) : ITransactionsService +{ + List _transactions = transactions; + Transaction _transaction = transaction; +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await Task.FromResult(_transactions); diff --git a/CommBank.Tests/Fake/FakeUsersService.cs b/CommBank.Tests/Fake/FakeUsersService.cs index 8b6476bd..df5d08c6 100644 --- a/CommBank.Tests/Fake/FakeUsersService.cs +++ b/CommBank.Tests/Fake/FakeUsersService.cs @@ -3,6 +3,7 @@ namespace CommBank.Tests.Fake; +<<<<<<< HEAD public class FakeUsersService : IUsersService { List _users; @@ -13,6 +14,12 @@ public FakeUsersService(List users, User user) _users = users; _user = user; } +======= +public class FakeUsersService(List users, User user) : IUsersService +{ + List _users = users; + User _user = user; +>>>>>>> 2bc1eb6 (Your commit message) public async Task> GetAsync() => await Task.FromResult(_users);