diff --git a/CommBank-Server/Models/Goal.cs b/CommBank-Server/Models/Goal.cs index 77ff1ad..e50eecc 100644 --- a/CommBank-Server/Models/Goal.cs +++ b/CommBank-Server/Models/Goal.cs @@ -11,6 +11,8 @@ public class Goal public string? Name { get; set; } + public string? Icon { get; set; } // ← tambahkan ini + public UInt64 TargetAmount { get; set; } = 0; public DateTime TargetDate { get; set; } diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json index 0e5bf94..c1b3d11 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "mongodb://immanueltampubolon594_db_user:f3Zd0e5bBWQVcSwF@ac-ysw4uue-shard-00-00.b2qi1df.mongodb.net:27017,ac-ysw4uue-shard-00-01.b2qi1df.mongodb.net:27017,ac-ysw4uue-shard-00-02.b2qi1df.mongodb.net:27017/?ssl=true&replicaSet=atlas-112hcj-shard-0&authSource=admin&appName=Cluster0" } } \ No newline at end of file diff --git a/CommBank-Server/appsettings.json b/CommBank-Server/appsettings.json index af0538f..55ca793 100644 --- a/CommBank-Server/appsettings.json +++ b/CommBank-Server/appsettings.json @@ -5,6 +5,9 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" -} - + "AllowedHosts": "*", + "MongoDB": { + "ConnectionString": "mongodb+srv://immanueltampubolon594_db_user:f3Zd0e5bBWQVcSwF@cluster0.b2qi1df.mongodb.net/?appName=Cluster0", + "DatabaseName": "CommBank" + } +} \ No newline at end of file diff --git a/CommBank.Tests/GoalControllerTests.cs b/CommBank.Tests/GoalControllerTests.cs index 8380181..0f774c7 100644 --- a/CommBank.Tests/GoalControllerTests.cs +++ b/CommBank.Tests/GoalControllerTests.cs @@ -66,9 +66,22 @@ public async void Get() public async void GetForUser() { // Arrange - + 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(users[0].Id!); + // Assert + Assert.NotNull(result); + foreach (Goal goal in result) + { + Assert.IsAssignableFrom(goal); + } } } \ No newline at end of file