Skip to content

Commit

Permalink
feat(core): Filter by v2 and group template versions (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisjimenez committed Dec 20, 2019
1 parent f9509cc commit e5aaab7
Showing 1 changed file with 10 additions and 1 deletion.
Expand Up @@ -68,13 +68,22 @@ public class V2PipelineTemplateController {

@Autowired ObjectMapper objectMapper;

// TODO(jacobkiefer): Add fiat authz
// TODO(louisjimenez): Deprecated. Will be replaced with /versions endpoint starting with 1.19.
@RequestMapping(value = "", method = RequestMethod.GET)
List<PipelineTemplate> list(
@RequestParam(required = false, value = "scopes") List<String> scopes) {
return (List<PipelineTemplate>) getPipelineTemplateDAO().getPipelineTemplatesByScope(scopes);
}

// TODO(jacobkiefer): Add fiat authz
@RequestMapping(value = "versions", method = RequestMethod.GET)
Map<String, List<PipelineTemplate>> listVersions(
@RequestParam(required = false, value = "scopes") List<String> scopes) {
return getPipelineTemplateDAO().getPipelineTemplatesByScope(scopes).stream()
.filter(pt -> pt.getOrDefault("schema", "").equals("v2"))
.collect(Collectors.groupingBy(PipelineTemplate::undecoratedId));
}

@RequestMapping(value = "", method = RequestMethod.POST)
void save(
@RequestParam(value = "tag", required = false) String tag,
Expand Down

0 comments on commit e5aaab7

Please sign in to comment.