Add deployments by router endpoint
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user