feat: alert on low remaining contract days - #200
Open
yoandiny wants to merge 29 commits into
Open
Conversation
…ookup (#55) Provide a dedicated query and service method so banner, remaining-days, and daily-execution guards can share one definition of a worker's active contract.
* feat(event): add LowRemainingDaysAlertRequested event model carrying workerCode and remainingDays * feat(service): add LowRemainingDaysAlertRequestedService to send async alert email to accountants when a worker has few days remaining on their contract * chore: format code
* fix: auto-initialize spring session jdbc schema on startup * feat: add contract and remaining days attributes to calendar controller * feat: display contract and remaining days state on calendar * feat: add findActiveContractByWorker for per-worker active contract lookup (#55) Provide a dedicated query and service method so banner, remaining-days, and daily-execution guards can share one definition of a worker's active contract. * feat: add getRemainingDaysOnActiveContractOrZero on ContractService (#56) Compute remaining contract days from the active contract and worked days so banner and alert flows can share one source of truth. * fix: drop LowRemainingDaysAlertService from calendar until it lands on base Keep remaining-days UI attributes via ContractService; the alert service is not on low-remaining-days-alert yet. --------- Co-authored-by: yoandiny <63061998+yoandiny@users.noreply.github.com> Co-authored-by: yoandiny <yoandiny14@gmail.com>
- Create LowRemainingDaysAlertService with threshold check + event trigger + toast message - Integrate into DailyExecutionController after daily execution save - Fix locale bug in ContractService.executedDays (use Locale.US) - Add LOW_REMAINING_DAYS_THRESHOLD env var to test config - Add integration tests: below threshold, above threshold, no contract
Delete the temporary worker and contracts after each LowRemainingDaysAlertServiceIT run so WorkerServiceIT keeps a stable year-2026 dataset.
Feat/low remaining alert service
* feat: default date to today on daily-execution + unit tests on active contract/remaining days * feat: default date to today on daily-execution + unit tests on active contract/remaining days * test: add integration test for ContractService using TestContainers
* fix: reject punch-in when contract is inactive * fix(test) : add active contract fixture to IT tests * fix(test): add active contract fixture to CalendarServiceIT * chore: format code * fix(test): use fixed past dates for contract fixtures to avoid polluting year-based queries
* fix: restore calendar toast/DaysFormatter and treat zero days as no usable contract Add missing template assets that caused 500s, and show the inactive-contract banner instead of a J-0 warning when remaining days are exhausted. * fix: reject pointage with Loza error when worker has no usable contract Throw instead of toast-redirect so ErrorHandler shows Loza Oops when there is no active contract or remaining days are exhausted. * format code
Remove spring.session.jdbc.initialize-schema=always introduced in #59 so the file matches its upstream state again.
…#67) List the env vars required for accountant emails and the low remaining days alert threshold for local runs.
SalomiaZK
reviewed
Jul 28, 2026
* refactor: simplify low remaining alert wiring Reduce review noise by removing duplicate alert-message construction and small helper indirections without touching upstream-owned tests. * fix: remove unused import in alert requested service Align the review-cleanup branch with CI formatting by dropping the unused InternetAddress import.
* refactor: simplify low remaining alert wiring Reduce review noise by removing duplicate alert-message construction and small helper indirections without touching upstream-owned tests. * fix: remove unused import in alert requested service Align the review-cleanup branch with CI formatting by dropping the unused InternetAddress import. * fix: align pointage and calendar flow with review feedback Keep the low-days warning on redirect via flash attributes, add a repository guard for missing active contracts, and remove the calendar-side low-days warning rendering.
SalomiaZK
reviewed
Jul 28, 2026
yoandiny
force-pushed
the
low-remaining-days-alert
branch
2 times, most recently
from
July 28, 2026 15:42
b11ac8b to
757b63e
Compare
Move alert message display off POST flash attributes onto the calendar Model, and keep email sending on pointage only.
* test: move alert IT fixtures to Flyway migration Replace runtime worker/contract saves in LowRemainingDaysAlertServiceIT with stable V101_4 test data. * format code * test: keep alert fixtures out of WorkerServiceIT year 2026 Use 2027 entrance dates so low-remaining alert contracts are not returned by findByYearBetween(2026, 2027).
* refactor: replace long with double in remaining days handling * fix: format the project
* refactor: rename checkRemainingDays alert method to verify Align naming with review feedback by renaming checkRemainingDaysAndBuildAlertMessage to verifyRemainingDaysAndBuildAlertMessage. * style: apply google-java-format on alert service IT
Move save and low-remaining email trigger behind a single service method called from the controller.
* Show low remaining days warning banner on daily-execution GET. * Mirror calendar contract banners on daily-execution GET.
* Unify contract warning into one banner with conditional color. * Format DailyExecutionController for google-java-format. * Drop hasUsableContract; set banner color from message in the template.
SalomiaZK
reviewed
Jul 28, 2026
yoandiny
commented
Jul 29, 2026
yoandiny
commented
Jul 29, 2026
yoandiny
commented
Jul 29, 2026
yoandiny
commented
Jul 29, 2026
yoandiny
commented
Jul 29, 2026
yoandiny
commented
Jul 29, 2026
yoandiny
commented
Jul 29, 2026
yoandiny
commented
Jul 29, 2026
SalomiaZK
approved these changes
Jul 29, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add contract expiry alert system, display remaining contract days warning, and improve daily check-in UX.
Changes
Contract alert
Daily check-in UX
- Automatically pre-fill the current date in the daily execution submission field