Add "Date Added" sort option to the library#779
Open
dny238 wants to merge 1 commit into
Open
Conversation
Adds a "Date Added" option to the Audiobooks (books) sort dropdown, sorting by when each audiobook's earliest file was imported. - Backend: new IAudiobookFileRepository.GetEarliestCreatedAtByAudiobookIdAsync (Min(CreatedAt) grouped by audiobook, mirroring GetCountsByAudiobookIdAsync) surfaced as LibraryAudiobookListItem.DateDownloaded in the slim /library payload. No schema change — reuses the existing AudiobookFile.CreatedAt. - Frontend: new "Date Added" sort option and comparator. Audiobooks with no tracked file yet (e.g. wanted books) have no date and always sort last, regardless of ascending/descending. - Test: AudiobooksView spec covers ascending/descending order and fileless-last. Note: this uses file-import date as the "added" timestamp. If a canonical "date added to the library" is preferred, that would need an Added column on Audiobook + migration — happy to take it that direction instead. Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Implements #778
What
Adds a "Date Added" option to the Audiobooks (books) sort dropdown, sorting by when each audiobook's earliest file was imported.
How
IAudiobookFileRepository.GetEarliestCreatedAtByAudiobookIdAsync—Min(CreatedAt)grouped by audiobook, mirroring the existingGetCountsByAudiobookIdAsync. Surfaced asLibraryAudiobookListItem.DateDownloadedin the slim/librarypayload. Reuses the existingAudiobookFile.CreatedAt, so no migration.Date Addedsort option + comparator inAudiobooksView. Audiobooks with no tracked file yet (e.g. wanted books) have no date and always sort last, in both ascending and descending order.AudiobooksView.spec.ts— asserts ascending/descending order and fileless-last placement, and that the option is exposed in the books grouping.Design note / open question
This treats file-import date as the "added" date, since
Audiobookhas no dedicated timestamp today. If you'd prefer a canonicalAddedcolumn onAudiobook(Sonarr/Radarr-style, set on add + backfilled) so wanted books also get a date, I'm happy to take it that direction instead — just wanted to keep this PR minimal and migration-free. See #778.Testing
dotnet build— clean (0 warnings)vue-tsctype-check — cleanvitest run AudiobooksView.spec.ts— 11/11 pass (incl. the new date-added test)🤖 Generated with Claude Code