use of com.faendir.zachtronics.bot.inf.model.IfPuzzle in project zachtronics-leaderboard-bot by F43nd1r.
the class IfController method getRecord.
@GetMapping(path = "/puzzle/{puzzleId}/category/{categoryId}/record", produces = MediaType.APPLICATION_JSON_VALUE)
public IfRecordDTO getRecord(@PathVariable String puzzleId, @PathVariable String categoryId) {
IfPuzzle puzzle = findPuzzle(puzzleId);
IfCategory category = findCategory(categoryId);
IfRecord record = repository.find(puzzle, category);
if (record != null)
return IfRecordDTO.fromCategoryRecord(new CategoryRecord<>(record, EnumSet.of(category)));
else
return null;
}
use of com.faendir.zachtronics.bot.inf.model.IfPuzzle in project zachtronics-leaderboard-bot by F43nd1r.
the class IfShowCommand method findPuzzleAndCategory.
@NotNull
@Override
public Pair<IfPuzzle, IfCategory> findPuzzleAndCategory(@NotNull ShowData parameters) {
IfPuzzle puzzle = parameters.puzzle;
IfCategory category = parameters.category;
if (!parameters.puzzle.getSupportedCategories().contains(category))
throw new IllegalArgumentException("Category " + category.getDisplayName() + " does not support " + puzzle.getDisplayName());
return new Pair<>(puzzle, category);
}
Aggregations