Skip to content

Commit

Permalink
Add get participants request mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
BilledTrain380 committed Aug 30, 2018
1 parent eb1faf4 commit 9136dbb
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ class ParticipantController(
const val PARTICIPANT: String = "/participant/{participant_id}"
}

@GetMapping("/participants", produces = [MediaType.APPLICATION_JSON_VALUE])
fun getParticipants(@RequestParam("group", required = false) groupName: String?): List<RestParticipant> {

if (groupName == null) {
return participantManager.getParticipants().map { it.toRest() }
}

val group = groupManager.getGroup(groupName)

if (group.isPresent.not()) return listOf()

return this.participantManager.getParticipants(group.get())
.map { it.toRest() }
}

@GetMapping(PARTICIPANT, produces = [MediaType.APPLICATION_JSON_VALUE])
fun getParticipant(@PathVariable("participant_id") id: Int): RestParticipant {

Expand Down

0 comments on commit 9136dbb

Please sign in to comment.