-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VKT(Backend): Provide unused free enrollment slots to frontend
- Loading branch information
Showing
7 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
backend/vkt/src/main/java/fi/oph/vkt/api/dto/PublicFreeEnrollmentDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package fi.oph.vkt.api.dto; | ||
|
||
import lombok.NonNull; | ||
|
||
public record PublicFreeEnrollmentDetails( | ||
@NonNull int freeTextualSkillExamsLeft, | ||
@NonNull int freeOralSkillExamsLeft | ||
) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 20 additions & 1 deletion
21
backend/vkt/src/main/java/fi/oph/vkt/repository/FreeEnrollmentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
package fi.oph.vkt.repository; | ||
|
||
import fi.oph.vkt.model.FreeEnrollment; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface FreeEnrollmentRepository extends BaseRepository<FreeEnrollment> {} | ||
public interface FreeEnrollmentRepository extends BaseRepository<FreeEnrollment> { | ||
@Query( | ||
"SELECT count(f)" + | ||
" FROM FreeEnrollment f" + | ||
" JOIN f.enrollment e" + | ||
" WHERE f.person.id = ?1" + | ||
" AND e.textualSkill = true" | ||
) | ||
int findUsedTextualSkillFreeEnrollmentsForPerson(final long personId); | ||
|
||
@Query( | ||
"SELECT count(f)" + | ||
" FROM FreeEnrollment f" + | ||
" JOIN f.enrollment e" + | ||
" WHERE f.person.id = ?1" + | ||
" AND e.oralSkill = true" | ||
) | ||
int findUsedOralSkillFreeEnrollmentsForPerson(final long personId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters