🚧 Backend implementation for timeline page #3251
Draft
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.
This pull request introduces a comprehensive implementation of a new "Timeline" feature for photo albums, including backend logic, API endpoints, and supporting structures. The changes span multiple files and focus on enabling granular timeline views, handling requests, and providing configuration options. Below is a summary of the most important changes grouped by theme:
Timeline Feature Implementation
app/Actions/Photo/Timeline.php
: Added a newTimeline
class that provides methods to query photos by timeline granularity, count photos younger than a given date or photo, and retrieve distinct timeline dates. This class integrates with configurations and policies to apply filters and sorting.app/Http/Controllers/Gallery/TimelineController.php
: Introduced a new controller to handle timeline-related API requests, including fetching photos, initializing the timeline, and retrieving timeline dates.app/Http/Requests/Timeline/IdOrDatedTimelineRequest.php
andapp/Http/Requests/Timeline/GetTimelineRequest.php
: Added request validation classes to handle timeline-specific parameters such as photo IDs and dates, ensuring proper authorization and validation. [1] [2]Timeline Granularity and Formatting
app/Enum/TimelinePhotoGranularity.php
andapp/Enum/TimelineAlbumGranularity.php
: Extended enums to include aformat()
method for returning ISO date formats based on granularity (e.g., year, month, day, hour). These changes support the dynamic formatting of timeline data. [1] [2]app/Exceptions/Internal/TimelineGranularityException.php
: Added a custom exception to handle invalid timeline granularities, ensuring robust error handling for unsupported configurations.Configuration and Initialization
app/Http/Resources/GalleryConfigs/InitConfig.php
: Updated the initialization resource to include timeline-specific configurations, such as the default homepage and whether the timeline page is enabled. [1] [2]app/Http/Resources/Timeline/InitResource.php
: Added a new resource to initialize the timeline view, providing layout configurations and user rights.Utility and Middleware Updates
app/Http/Resources/Models/Utils/TimelineData.php
: Enhanced the utility class to include methods for generating timeline data from dates and photos, supporting multiple granularities.app/Http/Middleware/ConfigIntegrity.php
: Added new configuration keys for timeline quick access date formats, ensuring integrity checks for these settings.Minor Enhancements
app/Contracts/Http/Requests/RequestAttribute.php
: Added a new constantDATE_ATTRIBUTE
to standardize the handling of date attributes in requests.app/Http/Controllers/VueController.php
: Introduced a new methodviewNoArgs()
for rendering the Vue app without arguments, likely for timeline-related views.