Beneficiary must be able to Delete Company

This commit is contained in:
nisha
2024-10-16 14:22:31 +05:30
parent edd9c1cb1a
commit 8e73074a88
13 changed files with 85 additions and 20 deletions

View File

@@ -38,6 +38,7 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'DRAFT'")
Long countDraftApplications();
List<ApplicationEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
}

View File

@@ -19,5 +19,6 @@ public interface FaqRepository extends JpaRepository<FaqEntity, Long> {
List<FaqEntity> findByCallIdAndIsDeletedFalse(Long callId);
Optional<FaqEntity> findByIdAndCallIdAndIsDeletedFalse(Long id, Long callId);
List<FaqEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
}

View File

@@ -12,11 +12,13 @@ import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
public interface UserWithCompanyRepository extends JpaRepository<UserWithCompanyEntity, Long> {
void deleteByCompanyId(Long companyId);
void deleteByCompanyIdAndIsDeletedFalse(Long companyId);
@Query("SELECT uwc.companyId FROM UserWithCompanyEntity uwc WHERE uwc.userId = :userId")
List<Long> findCompanyIdByUserId(@Param("userId") Long userId);
@Query("SELECT u.companyId FROM UserWithCompanyEntity u WHERE u.userId = :userId AND u.isDeleted = false")
List<Long> findActiveCompanyIdsByUserId(@Param("userId") Long userId);
Optional<UserWithCompanyEntity> findByUserIdAndCompanyId(Long userId, Long companyId);
Optional<UserWithCompanyEntity> findByUserIdAndCompanyIdAndIsDeletedFalse(Long userId, Long companyId);
}