refactor: streamline visit lifecycle and service architecture - #39
Merged
Merged
Conversation
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
This refactor consolidates the visit lifecycle, time handling, authorization,
repository queries, and service-level entity access patterns introduced
throughout the recent backend changes.
Changes
Time and visit lifecycle
TimeUtilas the centralized UTC time utility.Dashboard and repository
VisitRepository.active visitor, overdue visitor, and recently checked-out queries.
Overdue processing
OverdueVisitJobto useTimeUtil.without unnecessary per-site iteration.
CHECKED_INtoOVERDUE.Authorization
AuthorizationServiceas the single source of truth for access scope.GlobalandSiteaccess scopes.assertions already covered the required behavior.
rather than deriving target sites from
requestedBy.site.Visit services
findAccessibleVisit().viewing and checking out visits.
Visitor profiles
Reports
VisitSpecificationfiltering.Sites, users, and zones
findById/ResourceNotFoundExceptionlogic.BaseEntityServiceabstraction for reusableentity lookup/delete behavior, without forcing it into services where
specialized authorization or deletion logic is required.
Design principles
The refactor reinforces several architectural boundaries:
TimeUtilowns application-level UTC time calculations.AuthorizationServiceowns access-scope decisions.as an arbitrary scheduler state.
Notes
No new BaseEntityService dependency was forced into the domain services.
The abstraction is available for future services where it provides clear
value without obscuring domain-specific behavior.