iOfficeAI / iOfficeAI/AionCore
feat(teams): persist pin state and manual sort order for teams
- Dominant language
- Rust
- Stars
- 105
- Forks
- 169
- Avg merge
- 5h 58m
- Merged PRs (30d)
- 84
Description
## Background
In the AionUi sidebar, conversations already support pinning with full backend persistence:
- `conversations` table has `pinned INTEGER NOT NULL DEFAULT 0` and `pinned_at INTEGER` columns
- Manual drag order is persisted as a numeric `sortOrder` inside the conversation's `extra` JSON field via `PATCH /api/conversations/:id` with `merge_extra: true`
Teams have none of this. The current team "pin" in the sidebar is a frontend-only hack (a localStorage id array), which means:
- Pin state and order are lost when switching devices or clearing local data
- Pinned teams cannot be interleaved and drag-sorted together with pinned conversations in the unified pinned section (planned AionUi feature)
## Request
Bring teams to parity with conversations for pinning:
1. **Schema** — add to the `teams` table:
- `pinned INTEGER NOT NULL DEFAULT 0`
- `pinned_at INTEGER` (nullable)
- `sort_order REAL` (nullable; frontend computes gap-based fractional values, backend only stores)
2. **API**
- `PATCH /api/teams/:id` (or extend the existing team update endpoint) accepts `pinned`, `pinned_at`, `sort_order`
- `GET /api/teams?user_id=...` and `GET /api/teams/:id` include these fields in the response
3. **Migration** — existing rows default to unpinned; no backfill needed (frontend will offer a one-time migration of the localStorage pin list)
## Notes
- The sort scale is shared with conversations' `extra.sortOrder` so pinned teams and pinned conversations can be ordered on one axis in the sidebar. The backend does not need any cross-entity logic — it just stores the numbers.
- No behavior change expected for existing team endpoints beyond the added fields.
## Frontend counterpart
AionUi will move pinned teams into the sidebar's unified pinned section with dnd-kit drag sorting, reading/writing these new fields instead of localStorage.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.