INFRA-4022-1 | Dhruv | Add condition for Kubernetes to consider vertical while checking duplicate

This commit is contained in:
Dhruv Joshi
2024-11-27 19:13:18 +05:30
committed by GitHub
parent c8e31502b5
commit 2ef2b05ac1

View File

@@ -13,7 +13,7 @@ public interface JitRequestsRepository extends JpaRepository<JitRequest, Long> {
@Query(value = "SELECT * FROM jit_requests WHERE requested_for_id = :requestedForId "
+ "AND resource_type = :resourceType AND environment = :env "
+ "AND resource_action = :resourceAction "
+ "AND (resource_type NOT IN ('AWS','GOCD') OR vertical = :vertical) "
+ "AND (resource_type NOT IN ('AWS','GOCD','KUBERNETES') OR vertical = :vertical) "
+ "AND team_id = :teamId "
+ "AND ( (aws_resource_type is NULL AND :awsResourceType is NULL) OR aws_resource_type = CAST(:awsResourceType AS VARCHAR)) "
+ "AND :grantAt BETWEEN grant_at AND grant_at + interval '1 hour' * grant_window "