Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ public class ProblemController {
private final SqlServiceClient sqlServiceClient;
private final MatchService matchService;

@GetMapping("/by-match/{matchId}")
public ResponseEntity<ProblemInfoDTO> getProblemByMatch(@PathVariable UUID matchId) {
Match match = matchService.getMatchById(matchId);
if (match == null || match.getProblem() == null) {
return ResponseEntity.notFound().build();
}
Problem problem = match.getProblem();

ProblemInfoDTO dto = new ProblemInfoDTO();
dto.setId(problem.getId());
dto.setName(problem.getName());
dto.setExternalId(problem.getExternalId());
dto.setType(problem.getType().name());
dto.setLevel(problem.getLevel() != null ? problem.getLevel().name() : "EASY");

return ResponseEntity.ok(dto);
}

@PostMapping("/algo")
public ResponseEntity<Problem> createAlgoProblem(
@RequestBody CreateAlgoProblemRequest request) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.codzilla.backend.judge.problem;

import lombok.Data;

@Data
public class ProblemInfoDTO {
private Long id;
private String name;
private Long externalId;
private String type;
private String level;
}
Loading