Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LabraCORE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Labrador
LabraCORE
Merge requests
!61
Resolve "StudentGroup endpoint: getGroupsPerPerson"
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Resolve "StudentGroup endpoint: getGroupsPerPerson"
54-studentgroup-endpoint-getgroupsperperson
into
development
Overview
0
Commits
1
Pipelines
4
Changes
4
Merged
Resolve "StudentGroup endpoint: getGroupsPerPerson"
Chris Lemaire
requested to merge
54-studentgroup-endpoint-getgroupsperperson
into
development
May 20, 2020
Overview
0
Commits
1
Pipelines
4
Changes
4
Closes
#54 (closed)
Edited
May 20, 2020
by
Chris Lemaire
0
0
Merge request reports
Compare
development
development (base)
and
latest version
latest version
8c80d70f
1 commit,
May 20, 2020
4 files
+
169
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
src/main/java/nl/tudelft/labracore/controller/StudentGroupController.java
+
43
−
0
View file @ 8c80d70f
Edit in single-file editor
Open in Web IDE
Show full file
@@ -31,6 +31,7 @@ import nl.tudelft.labracore.dto.view.structured.summary.RoleSummaryDTO;
import
nl.tudelft.labracore.repository.StudentGroupRepository
;
import
nl.tudelft.labracore.service.RoleService
;
import
nl.tudelft.labracore.service.StudentGroupService
;
import
nl.tudelft.librador.dto.view.View
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
@@ -250,4 +251,46 @@ public class StudentGroupController {
return
sgs
.
getRoleOfMember
(
personId
,
id
);
}
/**
* Gets all groups for a given person.
*
* @param personId The id of the person to lookup.
* @return The list of groups the given person is in.
*/
@GetMapping
(
"/by-person/{personId}"
)
@PreAuthorize
(
"hasAuthority('STUDENT_GROUP_READ')"
)
public
List
<
StudentGroupSummaryDTO
>
getGroupsForPerson
(
@PathVariable
Long
personId
)
{
return
View
.
convertList
(
sgr
.
findAllByPersonIn
(
personId
),
StudentGroupSummaryDTO
.
class
);
}
/**
* Gets all groups for a given person within the given course.
*
* @param personId The id of the person to lookup.
* @param courseId The id of the course to lookup.
* @return The list of groups in the given course the given person is in.
*/
@GetMapping
(
"/by-person-and-course/{personId}/{courseId}"
)
@PreAuthorize
(
"hasAuthority('STUDENT_GROUP_READ')"
)
public
List
<
StudentGroupSummaryDTO
>
getGroupsForPersonAndCourse
(
@PathVariable
Long
personId
,
@PathVariable
Long
courseId
)
{
return
View
.
convertList
(
sgr
.
findAllByCourseAndPersonIn
(
personId
,
courseId
),
StudentGroupSummaryDTO
.
class
);
}
/**
* Gets all groups for a given person within the given module.
*
* @param personId The id of the person to lookup.
* @param moduleId The id of the module to lookup.
* @return The list of groups in the given module the given person is in.
*/
@GetMapping
(
"/by-person-and-module/{personId}/{moduleId}"
)
@PreAuthorize
(
"hasAuthority('STUDENT_GROUP_READ')"
)
public
List
<
StudentGroupSummaryDTO
>
getGroupsForPersonAndModule
(
@PathVariable
Long
personId
,
@PathVariable
Long
moduleId
)
{
return
View
.
convertList
(
sgr
.
findAllByModuleAndPersonIn
(
personId
,
moduleId
),
StudentGroupSummaryDTO
.
class
);
}
}
Loading