feat: add addAccountByToken tRPC mutation with upsert logic and tests

Adds a new mutation that accepts an email + raw OAuth token and upserts
the account — creating it if it doesn't exist, updating credentials if
it does. Covers all four scenarios with unit tests (new, existing,
empty-email, empty-token validation).
This commit is contained in:
Lukas May
2026-03-06 10:58:02 +01:00
parent f3042abe04
commit 9c4131c814
3 changed files with 94 additions and 0 deletions

View File

@@ -190,6 +190,7 @@ Each procedure uses `require*Repository(ctx)` helpers that throw `TRPCError(INTE
| updateAccountAuth | mutation | Update credentials |
| markAccountExhausted | mutation | Set exhaustion timer |
| listProviderNames | query | Available provider names |
| addAccountByToken | mutation | Upsert account from OAuth token; returns `{ upserted, account }` |
### Proposals
| Procedure | Type | Description |