From 32cb87997153ab978ceb2fb07ccd234feca594ab Mon Sep 17 00:00:00 2001 From: Nika Oragvelidze Date: Sun, 21 Jun 2026 06:33:47 +0400 Subject: [PATCH 1/4] Add optional Icon field to Goal model --- CommBank-Server/Models/Goal.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CommBank-Server/Models/Goal.cs b/CommBank-Server/Models/Goal.cs index 77ff1ad5..20b9b5d4 100644 --- a/CommBank-Server/Models/Goal.cs +++ b/CommBank-Server/Models/Goal.cs @@ -27,4 +27,6 @@ public class Goal [BsonRepresentation(BsonType.ObjectId)] public string? UserId { get; set; } + + public string? Icon { get; set; } } \ No newline at end of file From 6fb156ebebe35ca4d3b07f29c62ea7ac1efa7744 Mon Sep 17 00:00:00 2001 From: Nika Oragvelidze Date: Sun, 21 Jun 2026 09:03:43 +0400 Subject: [PATCH 2/4] fixing --- CommBank-Server/CommBank.csproj | 4 ++-- CommBank-Server/Secrets.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CommBank-Server/CommBank.csproj b/CommBank-Server/CommBank.csproj index 983cc882..4e75ca3a 100644 --- a/CommBank-Server/CommBank.csproj +++ b/CommBank-Server/CommBank.csproj @@ -1,7 +1,7 @@ - net6.0 + net80 enable enable CommBank_Server @@ -13,7 +13,7 @@ - + diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json index 0e5bf949..fbe31444 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "mongodb+srv://oragvelidzeniko2024_db_user:JnsIuSd8smh7Sbxu@cluster0.4uny9uv.mongodb.net/?appName=Cluster0" } } \ No newline at end of file From 87c2e038299260c0630b402371e04905b8e66e14 Mon Sep 17 00:00:00 2001 From: Nika Oragvelidze Date: Sun, 21 Jun 2026 09:17:17 +0400 Subject: [PATCH 3/4] Support icons --- .gitignore | 3 +++ CommBank.Tests/GoalControllerTests.cs | 25 +++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 67697151..622ecd9e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ autom4te.cache/ tarballs/ test-results/ +# Local secrets - never commit +Secrets.json + # Mac bundle stuff *.dmg *.app diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs index 8380181f..76a6d9dc 100644 --- a/CommBank.Tests/GoalControllerTests.cs +++ b/CommBank.Tests/GoalControllerTests.cs @@ -66,9 +66,26 @@ public async void Get() public async void GetForUser() { // Arrange - - // Act - - // Assert + var goals = collections.GetGoals(); + var users = collections.GetUsers(); + IGoalsService goalsService = new FakeGoalsService(goals, goals[0]); + IUsersService usersService = new FakeUsersService(users, users[0]); + GoalController controller = new(goalsService, usersService); + + // Act + var httpContext = new Microsoft.AspNetCore.Http.DefaultHttpContext(); + controller.ControllerContext.HttpContext = httpContext; + var result = await controller.GetForUser(goals[0].UserId!); + + // Assert + Assert.NotNull(result); + + var index = 0; + foreach (Goal goal in result!) + { + Assert.IsAssignableFrom(goal); + Assert.Equal(goals[0].UserId, goal.UserId); + index++; + } } } \ No newline at end of file From f1d5b70df0041dee4a9e25eea5b3f1c100ecb070 Mon Sep 17 00:00:00 2001 From: Nika Oragvelidze Date: Sun, 21 Jun 2026 09:31:00 +0400 Subject: [PATCH 4/4] revert --- CommBank-Server/CommBank.csproj | 4 ++-- CommBank-Server/Secrets.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CommBank-Server/CommBank.csproj b/CommBank-Server/CommBank.csproj index 4e75ca3a..5d76d035 100644 --- a/CommBank-Server/CommBank.csproj +++ b/CommBank-Server/CommBank.csproj @@ -1,7 +1,7 @@ - net80 + net8.0 enable enable CommBank_Server @@ -13,7 +13,7 @@ - + diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json index fbe31444..0e5bf949 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "mongodb+srv://oragvelidzeniko2024_db_user:JnsIuSd8smh7Sbxu@cluster0.4uny9uv.mongodb.net/?appName=Cluster0" + "CommBank": "{CONNECTION_STRING}" } } \ No newline at end of file