diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index b6d4ee96e1e..4d49ca1b8ee 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -9,7 +9,6 @@ using Altinn.Studio.Designer.Events; using Altinn.Studio.Designer.Filters; using Altinn.Studio.Designer.Helpers; -using Altinn.Studio.Designer.Infrastructure.GitRepository; using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Models.Dto; using Altinn.Studio.Designer.Services.Interfaces; @@ -32,7 +31,6 @@ public class AppDevelopmentController : Controller private readonly IAppDevelopmentService _appDevelopmentService; private readonly IRepository _repository; private readonly ISourceControl _sourceControl; - private readonly IAltinnGitRepositoryFactory _altinnGitRepositoryFactory; private readonly ApplicationInsightsSettings _applicationInsightsSettings; private readonly IMediator _mediator; @@ -43,15 +41,13 @@ public class AppDevelopmentController : Controller /// The app development service /// The application repository service /// The source control service. - /// /// An /// - public AppDevelopmentController(IAppDevelopmentService appDevelopmentService, IRepository repositoryService, ISourceControl sourceControl, IAltinnGitRepositoryFactory altinnGitRepositoryFactory, ApplicationInsightsSettings applicationInsightsSettings, IMediator mediator) + public AppDevelopmentController(IAppDevelopmentService appDevelopmentService, IRepository repositoryService, ISourceControl sourceControl, ApplicationInsightsSettings applicationInsightsSettings, IMediator mediator) { _appDevelopmentService = appDevelopmentService; _repository = repositoryService; _sourceControl = sourceControl; - _altinnGitRepositoryFactory = altinnGitRepositoryFactory; _applicationInsightsSettings = applicationInsightsSettings; _mediator = mediator; } @@ -543,20 +539,6 @@ public ActionResult GetWidgetSettings(string org, string app) return Ok(widgetSettings); } - [HttpGet] - [Route("option-list-ids")] - public ActionResult GetOptionListIds(string org, string app) - { - string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); - AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(org, app, developer); - string[] optionListIds = altinnAppGitRepository.GetOptionsListIds(); - if (optionListIds.Length == 0) - { - return NoContent(); - } - return Ok(optionListIds); - } - [HttpGet("app-version")] public VersionResponse GetAppVersion(string org, string app) { diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetOptionListIdsTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetOptionListIdsTests.cs deleted file mode 100644 index ccc4301023b..00000000000 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetOptionListIdsTests.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Text.Json; -using System.Threading.Tasks; -using Designer.Tests.Controllers.ApiTests; -using Designer.Tests.Utils; -using Microsoft.AspNetCore.Mvc.Testing; -using Xunit; - -namespace Designer.Tests.Controllers.AppDevelopmentController -{ - public class GetOptionListIdsTests : DesignerEndpointsTestsBase, IClassFixture> - { - private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development"; - public GetOptionListIdsTests(WebApplicationFactory factory) : base(factory) - { - } - - [Theory] - [InlineData("ttd", "app-with-options", "testUser")] - public async Task GetOptionsListIds_ShouldReturnOk(string org, string app, string developer) - { - string targetRepository = TestDataHelper.GenerateTestRepoName(); - await CopyRepositoryForTest(org, app, developer, targetRepository); - - var expectedOptionsListIds = new List() - { - { "other-options" }, - { "test-options" }, - { "options-with-null-fields" }, - }; - - string url = $"{VersionPrefix(org, targetRepository)}/option-list-ids"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); - - using var response = await HttpClient.SendAsync(httpRequestMessage); - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - - string responseContent = await response.Content.ReadAsStringAsync(); - List responseList = JsonSerializer.Deserialize>(responseContent); - Assert.Equal(3, responseList.Count); - foreach (string id in expectedOptionsListIds) - { - Assert.Contains(id, responseList); - } - } - - [Theory] - [InlineData("ttd", "empty-app")] - public async Task GetOptionsListIds_WhenNotExists_ReturnsNotFound(string org, string app) - { - string url = $"{VersionPrefix(org, app)}/option-list-ids"; - using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); - - using var response = await HttpClient.SendAsync(httpRequestMessage); - - Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); - } - } -} diff --git a/frontend/packages/shared/src/api/paths.js b/frontend/packages/shared/src/api/paths.js index ba82ff96e56..a8ce17184b9 100644 --- a/frontend/packages/shared/src/api/paths.js +++ b/frontend/packages/shared/src/api/paths.js @@ -45,7 +45,7 @@ export const widgetSettingsPath = (org, app) => `${basePath}/${org}/${app}/app-d export const optionListPath = (org, app, optionsListId) => `${basePath}/${org}/${app}/options/${optionsListId}`; // Get, Delete export const optionListsPath = (org, app) => `${basePath}/${org}/${app}/options/option-lists`; // Get export const optionListReferencesPath = (org, app) => `${basePath}/${org}/${app}/options/usage`; // Get -export const optionListIdsPath = (org, app) => `${basePath}/${org}/${app}/app-development/option-list-ids`; // Get +export const optionListIdsPath = (org, app) => `${basePath}/${org}/${app}/options`; // Get export const optionListUpdatePath = (org, app, optionsListId) => `${basePath}/${org}/${app}/options/${optionsListId}`; // Put export const optionListIdUpdatePath = (org, app, optionsListId) => `${basePath}/${org}/${app}/options/change-name/${optionsListId}`; // Put export const optionListUploadPath = (org, app) => `${basePath}/${org}/${app}/options/upload`; // Post