Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create controller and service for options/code lists #13046

Merged
merged 19 commits into from
Jul 11, 2024
Merged

Conversation

ErlingHauan
Copy link
Contributor

@ErlingHauan ErlingHauan commented Jun 28, 2024

Description

In this PR an OptionsController and an OptionsService has been created.
The OptionsService uses the AltinnAppGitRepository to manipulate the options files.

5 4 new endpoints have been added:

  • GET an array of the names of all option lists from a repo
  • GET a single option list from a repo
  • POST a single option list to a repo
  • PUT a single option list to a repo
  • DELETE a single option list from a repo

Considerations

  • I was unsure what to call the methods, e.g. GetOptions, GetOptionLists or GetCodeLists. What do you think?
  • I'm not 100% sure if my usage of CancellationToken is correct. Please keep it in the back of your mind when reviewing.
  • These endpoints only handle static code lists. Is there a need for endpoints for dynamic code lists?

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required) - tested OK with Postman when temporarily disabling [AutoValidateAntiforgeryToken]
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

@github-actions github-actions bot added solution/studio/designer Issues related to the Altinn Studio Designer solution. quality/testing Tests that are missing, needs to be created or could be improved. labels Jun 28, 2024
@ErlingHauan ErlingHauan changed the title Create Controller and Service for Options/Code lists Create controller and service for options/code lists Jun 28, 2024
@ErlingHauan ErlingHauan marked this pull request as ready for review July 2, 2024 12:26
@ErlingHauan ErlingHauan marked this pull request as draft July 3, 2024 09:21
@ErlingHauan ErlingHauan marked this pull request as ready for review July 3, 2024 12:01
Copy link
Contributor

@standeren standeren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good! Impressive testing and documenting 😮‍💨

I have some questions concerning the need for 404 and duplicated error messages, as well as some nitpicking conserning naming 😅

Also I wonder if we should give the testfiles in the OptionsControllerTests more specific name like GetOptionsTests and CreateOptionsTests etc.

backend/src/Designer/Controllers/OptionsController.cs Outdated Show resolved Hide resolved
backend/src/Designer/Controllers/OptionsController.cs Outdated Show resolved Hide resolved
backend/src/Designer/Controllers/OptionsController.cs Outdated Show resolved Hide resolved
backend/src/Designer/Controllers/OptionsController.cs Outdated Show resolved Hide resolved
backend/src/Designer/Controllers/OptionsController.cs Outdated Show resolved Hide resolved
@ErlingHauan ErlingHauan requested a review from standeren July 8, 2024 10:28
Copy link
Contributor

@standeren standeren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work!! 👏

@ErlingHauan ErlingHauan merged commit e069007 into main Jul 11, 2024
10 checks passed
@ErlingHauan ErlingHauan deleted the codelist-endpoints branch July 11, 2024 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality/testing Tests that are missing, needs to be created or could be improved. solution/studio/designer Issues related to the Altinn Studio Designer solution.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Endpoint for adding, updating and deleting codelist in Studio (app-context)
2 participants