Skip to content

Add "Date Added" sort option to the library#779

Open
dny238 wants to merge 1 commit into
Listenarrs:canaryfrom
dny238:feature/sort-by-date-downloaded
Open

Add "Date Added" sort option to the library#779
dny238 wants to merge 1 commit into
Listenarrs:canaryfrom
dny238:feature/sort-by-date-downloaded

Conversation

@dny238

@dny238 dny238 commented Jul 23, 2026

Copy link
Copy Markdown

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

  • Backend (no schema change): new IAudiobookFileRepository.GetEarliestCreatedAtByAudiobookIdAsyncMin(CreatedAt) grouped by audiobook, mirroring the existing GetCountsByAudiobookIdAsync. Surfaced as LibraryAudiobookListItem.DateDownloaded in the slim /library payload. Reuses the existing AudiobookFile.CreatedAt, so no migration.
  • Frontend: new Date Added sort option + comparator in AudiobooksView. Audiobooks with no tracked file yet (e.g. wanted books) have no date and always sort last, in both ascending and descending order.
  • Test: extends 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 Audiobook has no dedicated timestamp today. If you'd prefer a canonical Added column on Audiobook (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-tsc type-check — clean
  • vitest run AudiobooksView.spec.ts — 11/11 pass (incl. the new date-added test)

🤖 Generated with Claude Code

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]>
@dny238
dny238 requested a review from a team July 23, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant