add repositories.imported_at with migration and backfill strategy
track import time separately from GitHub created_at during repository ingestion
default API repository ordering to imported_at DESC
add UI sort controls (mobile + desktop) and shared sorting utility for the repository table
add unit tests for repository sorting behavior
Rationale
created_at currently reflects GitHub repository creation time, which does not represent when a repository was imported into this app. This PR introduces a dedicated import timestamp and uses it to support "recently imported first" sorting.
Migration Notes
Adds imported_at column to repositories with default unixepoch()
Backfills imported_at from earliest matching mirror_jobs.timestamp (by repository_id when available), falling back to repositories.created_at
Adds index idx_repositories_user_imported_at (user_id, imported_at)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/226
Author: @arunavo4
Created: 3/15/2026
Status: ✅ Merged
Merged: 3/15/2026
Merged by: @arunavo4
Base:
main← Head:codex/issue-225-imported-sort📝 Commits (2)
62b4196repositories: add importedAt sortingc3ecc64repositories: use tanstack table for repo list📊 Changes
20 files changed (+2370 additions, -40 deletions)
View changed files
📝
bun.lock(+5 -0)➕
drizzle/0009_nervous_tyger_tiger.sql(+24 -0)➕
drizzle/meta/0009_snapshot.json(+2022 -0)📝
drizzle/meta/_journal.json(+7 -0)📝
package.json(+1 -0)📝
src/components/repositories/Repository.tsx(+59 -0)📝
src/components/repositories/RepositoryTable.tsx(+127 -39)📝
src/hooks/useFilterParams.ts(+1 -0)📝
src/lib/db/schema.ts(+5 -0)📝
src/lib/github.ts(+3 -0)📝
src/lib/repo-utils.test.ts(+1 -0)📝
src/lib/repo-utils.ts(+1 -0)➕
src/lib/repository-sorting.test.ts(+68 -0)➕
src/lib/repository-sorting.ts(+40 -0)📝
src/pages/api/github/repositories.ts(+1 -1)📝
src/pages/api/sync/index.ts(+1 -0)📝
src/pages/api/sync/organization.ts(+1 -0)📝
src/pages/api/sync/repository.ts(+1 -0)📝
src/types/Repository.ts(+1 -0)📝
src/types/filter.ts(+1 -0)📄 Description
Summary
repositories.imported_atwith migration and backfill strategycreated_atduring repository ingestionimported_at DESCRationale
created_atcurrently reflects GitHub repository creation time, which does not represent when a repository was imported into this app. This PR introduces a dedicated import timestamp and uses it to support "recently imported first" sorting.Migration Notes
imported_atcolumn torepositorieswith defaultunixepoch()imported_atfrom earliest matchingmirror_jobs.timestamp(byrepository_idwhen available), falling back torepositories.created_atidx_repositories_user_imported_at(user_id,imported_at)Testing
bun test src/lib/repository-sorting.test.tsbun test src/lib/repo-utils.test.tsbun test src/lib/gitea-starred-repos.test.tsbun run buildbun run init-dbbun run manage-db checkCloses #225
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.