Update frontend

This commit is contained in:
Sergey Shkurov
2023-04-29 04:40:46 +02:00
parent 73fa5b1373
commit 25d0921aed
3 changed files with 5 additions and 2 deletions

View File

@@ -56,7 +56,6 @@ public class PatternController {
@PostMapping @PostMapping
public PatternDto addPattern(@RequestBody PatternCreateDto dto) { public PatternDto addPattern(@RequestBody PatternCreateDto dto) {
return service.create(dto); return service.create(dto);
} }
@PostMapping("/{id}") @PostMapping("/{id}")

View File

@@ -90,6 +90,10 @@ public class ServicesService {
@Transactional @Transactional
public ServiceDto create(ServiceCreateDto dto) { public ServiceDto create(ServiceCreateDto dto) {
if (repository.existsById(dto.getPort())) {
throw new IllegalArgumentException("Service already exists");
}
CtfService service = fromDto(dto); CtfService service = fromDto(dto);
log.info("Added service '{}' at port {}", service.getName(), service.getPort()); log.info("Added service '{}' at port {}", service.getName(), service.getPort());