stash
stash copied to clipboard
feat: add rating and sort by rating feature to tags
Description
Added full rating support for tags, bringing them in line with other entities like scenes, performers, and studios. Related #6564, closes the longstanding #1400
Changes
Database
Added a rating100 column to the tags table via a new migration, storing ratings on a 0–100 scale consistent with the rest of the application.
Backend
- Updated the
TagandTagPartialmodel structs to include theRating100field - Added
rating100to the SQL filter handler intag_filter.go, enabling tags to be queried by rating - Added
rating100to the GraphQLTagFilterTypeschema - Regenerated GraphQL types via
go generate
Frontend
- Added
FindTagDocumenttotagMutationImpactedQueriesto ensure the tag detail page refetches after a rating change
Related Issue
Closes #1400
Testing
- Add any rating to any tag. It can be done after clicking Edit button on specific tag page as well.
- It gets rating.
- Rated tags can be sorted and filtered.
- Rating column can be seen if switched to list view for tags.
Checklist
- [x] I have read and understood the Contributing document.
- [x] I have read and understood the AI Usage Policy document.
- [ ] I have made corresponding changes to the documentation (if applicable).
AI Usage Disclosure
- [x] I have used AI tools to assist with this pull request, and I have disclosed the tools and how I used them below. SWE 1.6 pro used for draft. Tests are written by AI.
Additional Context
TagPartial Struct
TagPartial is used by UpdatePartial to perform partial updates — only fields explicitly set are written to the database. The Rating100 field was missing from this struct, which would have prevented rating-only updates from persisting correctly without touching other tag fields.
Needs import/export support.