Add deployments by router endpoint

This commit is contained in:
litoral05
2026-05-05 10:56:11 +01:00
parent 83c406df8d
commit c952eb2eaa
2 changed files with 11 additions and 0 deletions
@@ -30,4 +30,12 @@ public class DeploymentController {
return DeploymentResponse.from(deployment); return DeploymentResponse.from(deployment);
} }
@GetMapping("/router/{routerId}")
public List<DeploymentResponse> getByRouterId(@PathVariable UUID routerId) {
return repository.findByRouterId(routerId)
.stream()
.map(DeploymentResponse::from)
.toList();
}
} }
@@ -2,7 +2,10 @@ package com.litoralregas.openvpn.deployment;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.UUID; import java.util.UUID;
public interface DeploymentRepository extends JpaRepository<Deployment, UUID> { public interface DeploymentRepository extends JpaRepository<Deployment, UUID> {
List<Deployment> findByRouterId(UUID routerId);
} }