Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public interface CertificationRepository extends CrudRepository<Certification, U

Optional<Certification> getByName(String name);

@Query("""
@Query(value = """
SELECT * FROM certification
WHERE is_active = TRUE OR :includeDeactivated = TRUE
ORDER BY name""")
ORDER BY name""", nativeQuery = true)
List<Certification> findAllOrderByNameAsc(boolean includeDeactivated);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,39 @@ public interface EarnedCertificationRepository extends CrudRepository<EarnedCert

List<EarnedCertification> findByCertificationId(@NotNull UUID certificationId);

@Query("""
@Query(value = """
SELECT earned.*
FROM earned_certification AS earned
LEFT JOIN certification AS cert USING(certification_id)
WHERE cert.is_active = TRUE OR :includeDeactivated = TRUE
ORDER BY earned.earned_date DESC, earned.description""")
ORDER BY earned.earned_date DESC, earned.description""", nativeQuery = true)
List<EarnedCertification> findAllOrderByEarnedDateDesc(boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT earned.*
FROM earned_certification AS earned
LEFT JOIN certification AS cert USING(certification_id)
WHERE earned.certification_id = :certificationId
AND (cert.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY earned.earned_date DESC, earned.description""")
ORDER BY earned.earned_date DESC, earned.description""", nativeQuery = true)
List<EarnedCertification> findByCertificationIdOrderByEarnedDateDesc(@NotNull UUID certificationId, boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT earned.*
FROM earned_certification AS earned
LEFT JOIN certification AS cert USING(certification_id)
WHERE earned.member_id = :memberId
AND (cert.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY earned.earned_date DESC, earned.description""")
ORDER BY earned.earned_date DESC, earned.description""", nativeQuery = true)
List<EarnedCertification> findByMemberIdOrderByEarnedDateDesc(@NotNull UUID memberId, boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT earned.*
FROM earned_certification AS earned
LEFT JOIN certification AS cert USING(certification_id)
WHERE earned.certification_id = :certificationId
AND earned.member_id = :memberId
AND (cert.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY earned.earned_date DESC, earned.description""")
ORDER BY earned.earned_date DESC, earned.description""", nativeQuery = true)
List<EarnedCertification> findByMemberIdAndCertificationIdOrderByEarnedDateDesc(@NotNull UUID memberId, @NotNull UUID certificationId, boolean includeDeactivated);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface VolunteeringEventRepository extends CrudRepository<VolunteeringEvent, UUID> {

@Query("""
@Query(value = """
SELECT event.*
FROM volunteering_event AS event
JOIN volunteering_relationship AS rel USING(relationship_id)
JOIN volunteering_organization AS org USING(organization_id)
WHERE rel.member_id::uuid = :memberId
AND (rel.is_active = TRUE OR :includeDeactivated = TRUE)
AND (org.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY event.event_date, org.name, event.hours DESC""")
ORDER BY event.event_date, org.name, event.hours DESC""", nativeQuery = true)
List<VolunteeringEvent> findByMemberId(@NotNull UUID memberId, boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT event.*
FROM volunteering_event AS event
JOIN volunteering_relationship AS rel USING(relationship_id)
JOIN volunteering_organization AS org USING(organization_id)
WHERE org.organization_id::uuid = :organizationId
AND (rel.is_active = TRUE OR :includeDeactivated = TRUE)
AND (org.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY event.event_date, org.name, event.hours DESC""")
ORDER BY event.event_date, org.name, event.hours DESC""", nativeQuery = true)
List<VolunteeringEvent> findByOrganizationId(@NotNull UUID organizationId, boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT event.*
FROM volunteering_event AS event
JOIN volunteering_relationship AS rel USING(relationship_id)
Expand All @@ -43,16 +43,16 @@ JOIN volunteering_organization AS org USING(organization_id)
AND org.organization_id::uuid = :organizationId
AND (rel.is_active = TRUE OR :includeDeactivated = TRUE)
AND (org.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY event.event_date, org.name, event.hours DESC""")
ORDER BY event.event_date, org.name, event.hours DESC""", nativeQuery = true)
List<VolunteeringEvent> findByMemberIdAndOrganizationId(@NotNull UUID memberId, @NotNull UUID organizationId, boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT event.*
FROM volunteering_event AS event
JOIN volunteering_relationship AS rel USING(relationship_id)
JOIN volunteering_organization AS org USING(organization_id)
WHERE (rel.is_active = TRUE OR :includeDeactivated = TRUE)
AND (org.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY event.event_date, org.name, event.hours DESC""")
ORDER BY event.event_date, org.name, event.hours DESC""", nativeQuery = true)
List<VolunteeringEvent> findAll(boolean includeDeactivated);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public interface VolunteeringOrganizationRepository extends CrudRepository<Volun

Optional<VolunteeringOrganization> getByName(String name);

@Query("""
SELECT org.*
FROM volunteering_organization AS org
WHERE org.is_active = TRUE OR :includeDeactivated = TRUE
ORDER BY org.name""")
@Query(value = """
SELECT org.*
FROM volunteering_organization AS org
WHERE org.is_active = TRUE OR :includeDeactivated = TRUE
ORDER BY org.name""", nativeQuery = true)
List<VolunteeringOrganization> findAll(boolean includeDeactivated);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,51 @@
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface VolunteeringRelationshipRepository extends CrudRepository<VolunteeringRelationship, UUID> {

@Query("""
@Query(value = """
SELECT rel.*
FROM volunteering_relationship AS rel
JOIN volunteering_organization AS org USING(organization_id)
WHERE rel.organization_id = :organizationId
AND rel.member_id = :memberId
AND (rel.is_active = TRUE OR :includeDeactivated = TRUE)
AND (org.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY rel.start_date, org.name""")
ORDER BY rel.start_date, org.name""", nativeQuery = true)
List<VolunteeringRelationship> findByMemberIdAndOrganizationId(UUID memberId, UUID organizationId, boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT rel.*
FROM volunteering_relationship AS rel
JOIN volunteering_organization AS org USING(organization_id)
WHERE rel.member_id = :memberId
AND (rel.is_active = TRUE OR :includeDeactivated = TRUE)
AND (org.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY rel.start_date, org.name""")
ORDER BY rel.start_date, org.name""", nativeQuery = true)
List<VolunteeringRelationship> findByMemberId(UUID memberId, boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT rel.*
FROM volunteering_relationship AS rel
JOIN volunteering_organization AS org USING(organization_id)
WHERE rel.organization_id = :organizationId
AND (rel.is_active = TRUE OR :includeDeactivated = TRUE)
AND (org.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY rel.start_date, org.name""")
ORDER BY rel.start_date, org.name""", nativeQuery = true)
List<VolunteeringRelationship> findByOrganizationId(UUID organizationId, boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT rel.*
FROM volunteering_relationship AS rel
JOIN volunteering_organization AS org USING(organization_id)
WHERE (rel.is_active = TRUE OR :includeDeactivated = TRUE)
AND (org.is_active = TRUE OR :includeDeactivated = TRUE)
ORDER BY rel.start_date, org.name""")
ORDER BY rel.start_date, org.name""", nativeQuery = true)
List<VolunteeringRelationship> findAll(boolean includeDeactivated);

@Query("""
@Query(value = """
SELECT rel.*
FROM volunteering_event AS event
JOIN volunteering_relationship AS rel USING(relationship_id)
WHERE event.event_id::uuid = :eventId""")
WHERE event.event_id::uuid = :eventId""", nativeQuery = true)
Optional<VolunteeringRelationship> getRelationshipForEvent(@Nullable UUID eventId);

Optional<VolunteeringRelationship> findById(@Nullable UUID eventId);
Expand Down