Add get deployment by id endpoint
This commit is contained in:
@@ -3,6 +3,7 @@ package com.litoralregas.openvpn.deployment;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/deployments")
|
||||
@@ -21,4 +22,12 @@ public class DeploymentController {
|
||||
.map(DeploymentResponse::from)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public DeploymentResponse getById(@PathVariable UUID id) {
|
||||
Deployment deployment = repository.findById(id)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Deployment not found: " + id));
|
||||
|
||||
return DeploymentResponse.from(deployment);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user