[PR #226] [MERGED] feat: add importedAt-based repository sorting #1094

Closed
opened 2026-04-19 13:39:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 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: mainHead: codex/issue-225-imported-sort


📝 Commits (2)

  • 62b4196 repositories: add importedAt sorting
  • c3ecc64 repositories: 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

  • 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)

Testing

  • bun test src/lib/repository-sorting.test.ts
  • bun test src/lib/repo-utils.test.ts
  • bun test src/lib/gitea-starred-repos.test.ts
  • bun run build
  • bun run init-db
  • bun run manage-db check

Closes #225


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RayLabsHQ/gitea-mirror/pull/226 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 3/15/2026 **Status:** ✅ Merged **Merged:** 3/15/2026 **Merged by:** [@arunavo4](https://github.com/arunavo4) **Base:** `main` ← **Head:** `codex/issue-225-imported-sort` --- ### 📝 Commits (2) - [`62b4196`](https://github.com/RayLabsHQ/gitea-mirror/commit/62b41962af0d08af91ba45855ffe29ecf3919d5f) repositories: add importedAt sorting - [`c3ecc64`](https://github.com/RayLabsHQ/gitea-mirror/commit/c3ecc642fb4358381bda700d8075d84e97895169) repositories: use tanstack table for repo list ### 📊 Changes **20 files changed** (+2370 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description ## Summary - 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`) ## Testing - `bun test src/lib/repository-sorting.test.ts` - `bun test src/lib/repo-utils.test.ts` - `bun test src/lib/gitea-starred-repos.test.ts` - `bun run build` - `bun run init-db` - `bun run manage-db check` Closes #225 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 13:39:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#1094