Lychee icon indicating copy to clipboard operation
Lychee copied to clipboard

Add flow backend

Open ildyria opened this issue 6 months ago • 1 comments

This pull request introduces a new feature called "Flow," which provides a way to query, display, and interact with albums in a dynamic and configurable manner. The changes include the creation of new classes, enums, and resources, as well as modifications to existing models and configurations to support the Flow feature.

New Feature: Flow

Core Functionality

  • Added the Flow class in app/Actions/Albums/Flow.php to handle querying albums based on various configurations, such as NSFW filtering, sub-album inclusion, and ordering by publication or creation date. This class also defines the logic for building album queries.

  • Introduced the FlowController in app/Http/Controllers/Gallery/FlowController.php to handle HTTP requests related to Flow, including initialization and paginated album results.

  • Created the FlowRequest class in app/Http/Requests/Flow/FlowRequest.php to handle request authorization based on Flow settings and user authentication.

Supporting Resources

  • Added FlowItemResource, FlowResource, and InitResource in app/Http/Resources/Flow/ to structure the data returned by Flow-related endpoints, including album details, pagination, and initialization settings. [1] [2] [3]

  • Updated ModulesRightsResource to include a flag indicating if the Flow module is enabled. [1] [2]

Enum and Exception Additions

  • Introduced FlowStrategy and CoverFitType enums to define Flow-specific strategies (e.g., AUTO, OPT_IN) and cover image fitting options (COVER, FIT). [1] [2]

  • Added InvalidAlbumException to handle cases where an invalid album type is provided in Flow operations.

Model Updates

  • Updated the Album and BaseAlbumImpl models to include new attributes (is_recursive_nsfw, published_at) and support Flow-related queries. [1] [2] [3] [4]

Configuration and Middleware

  • Extended ConfigIntegrity to include new Flow-specific configuration keys, such as flow_strategy, flow_include_sub_albums, and flow_min_max_enabled.

  • Updated RouteCacheManager to exclude Flow-related routes from caching or apply specific caching configurations.

These changes collectively provide a robust framework for implementing the Flow feature, enabling dynamic and configurable album browsing and interaction.

ildyria avatar Jun 13 '25 11:06 ildyria

Codecov Report

Attention: Patch coverage is 95.69892% with 8 lines in your changes missing coverage. Please review.

Project coverage is 90.11%. Comparing base (9084815) to head (d38bf01). Report is 7 commits behind head on master.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 13 '25 11:06 codecov[bot]