Skip to content

Refactor tag system#3424

Closed
ildyria wants to merge 3 commits intomasterfrom
tags/create-tables
Closed

Refactor tag system#3424
ildyria wants to merge 3 commits intomasterfrom
tags/create-tables

Conversation

@ildyria
Copy link
Copy Markdown
Member

@ildyria ildyria commented Jun 8, 2025

This pull request introduces significant changes to the handling of tags in the application. It replaces the previous string-based tag system with a relational model using a new Tag entity. This change affects multiple parts of the codebase, including models, controllers, resources, and database interactions. The key improvements include better tag management, relational mapping between photos and tags, and enhanced query capabilities.

Tag System Overhaul:

  1. Introduction of the Tag Model:

    • A new Tag model (app/Models/Tag.php) has been added to represent tags as entities in the database. It includes methods for relational mapping with photos and a utility method Tag::from() to fetch or create tags dynamically.
  2. Relational Mapping Between Photos and Tags:

    • The Photo model now includes a tags() method to define a BelongsToMany relationship with the Tag model, replacing the previous array-based tag handling.
  3. Refactoring of Tag Album:

    • The TagAlbum model now uses the TagArrayCast class to handle tags as Tag objects instead of strings.

Controller and Resource Updates:

  1. Tag Management in Controllers:

    • Controllers such as PhotoController and AlbumController now handle tags using the Tag model, including syncing tags with photos and dynamically creating tags if they don't exist. [1] [2]
  2. Resource Representation:

    • Tags are now represented as their name in API resources like PhotoResource and TagAlbumResource. This ensures API responses are more user-friendly and consistent. [1] [2]

Query and Search Enhancements:

  1. Improved Query Handling:

    • Queries now include tags as a relation, allowing for more efficient data retrieval and filtering. This applies to various parts of the application, such as PhotoSearch and FrameController. [1] [2]
  2. Custom Query Builder for Tags:

    • A specialized TagBuilder class has been introduced to extend query capabilities for the Tag model.

These changes collectively enhance the application's ability to manage and query tags, improving both backend efficiency and frontend usability.

@ildyria ildyria requested a review from a team as a code owner June 8, 2025 14:43
@ildyria ildyria added the Review: medium Medium review expected: not many files, some attention to details required. label Jun 8, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 8, 2025

Codecov Report

❌ Patch coverage is 96.51163% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.82%. Comparing base (8dd4b28) to head (de216e2).
⚠️ Report is 4 commits behind head on master.

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

@ildyria ildyria force-pushed the tags/create-tables branch 2 times, most recently from 3787ac9 to 14350e1 Compare June 23, 2025 17:08
@ildyria ildyria moved this to In Progress in Lychee development Jun 24, 2025
@ildyria ildyria force-pushed the tags/create-tables branch 2 times, most recently from 68cb315 to a22faff Compare June 27, 2025 22:26
@ildyria ildyria force-pushed the tags/create-tables branch from ff68597 to fab7484 Compare July 29, 2025 17:49
@ildyria ildyria added the alpha-ready Branch is available in alpha label Aug 3, 2025
@ildyria ildyria force-pushed the tags/create-tables branch from de216e2 to e5c67c8 Compare August 6, 2025 15:28
@ildyria
Copy link
Copy Markdown
Member Author

ildyria commented Aug 14, 2025

See #3616

@ildyria ildyria closed this Aug 14, 2025
@ildyria ildyria deleted the tags/create-tables branch August 14, 2025 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alpha-ready Branch is available in alpha Review: medium Medium review expected: not many files, some attention to details required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant