class LegacyDetectorController {

    @GetMapping(path = "/findByCreatedBy", produces = "application/json")
    @ResponseStatus(HttpStatus.OK)
    public List<DetectorDocument> findByCreatedBy(@RequestParam String user) {
        List<DetectorDocument> detectors = detectorRepo.findByCreatedBy(user);
        if (detectors == null || detectors.isEmpty()) {
            // TODO: This should be RecordNotFoundException
            throw new IllegalArgumentException("Invalid user: " + user);
        }
        return detectors;
    }

}