Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDATT2105 Backend Quiz
Manage
Activity
Members
Labels
Plan
Issues
22
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2105-2024-full-stack
IDATT2105 Backend Quiz
Merge requests
!17
Create endpoint for retrieving all tags. With test. All tests OK
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Create endpoint for retrieving all tags. With test. All tests OK
Make_endpoint_for_retrieving_all_tags
into
main
Overview
0
Commits
1
Pipelines
0
Changes
6
Merged
Håkon Fredrik Fjellanger
requested to merge
Make_endpoint_for_retrieving_all_tags
into
main
9 months ago
Overview
0
Commits
1
Pipelines
0
Changes
6
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
fef84661
1 commit,
9 months ago
6 files
+
125
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
src/main/java/ntnu/idatt2105/quizbackend/controller/TagController.java
+
18
−
0
Options
package
ntnu.idatt2105.quizbackend.controller
;
import
lombok.AllArgsConstructor
;
import
ntnu.idatt2105.quizbackend.dto.TagCollectionDTO
;
import
ntnu.idatt2105.quizbackend.dto.TagDTO
;
import
ntnu.idatt2105.quizbackend.entity.Tag
;
import
ntnu.idatt2105.quizbackend.service.TagService
;
@@ -71,6 +72,23 @@ public class TagController {
return
tagDTOs
;
}
/**
* Method for retrieving all tags
* @return a list of TagDTOs belonging to the given question_id
*/
@GetMapping
(
"/api/tag"
)
public
TagCollectionDTO
getAllTags
()
{
List
<
Tag
>
tags
=
tagService
.
getAllTags
();
TagCollectionDTO
tagDTOs
=
new
TagCollectionDTO
(
new
ArrayList
<>());
for
(
Tag
tag
:
tags
)
tagDTOs
.
getTags
().
add
(
mapToDTO
(
tag
));
return
tagDTOs
;
}
/**
* Method for mapping a Tag entity to a TagDTO
*
Loading