refactor(oauth): OAuth server tables through repositories

OauthClientsRepository/OauthTokensRepository/OauthConsentsRepository
replace OauthService's raw SQL (OA1-OA33). revokeChain's recursive CTE
and the oauth_clients join (its FK actually targets client_id, not the
row id the generated relation assumes) go through em.getKysely();
OA19's chain revoke is one nativeUpdate($in); OA12's consent grant is
em.upsert on the (client, user) unique key. revokeAllForUser built now
for Task 5. Every row-out read is disableIdentityMap: true; inserts go
through em.insert.
This commit is contained in:
jubnl
2026-09-22 21:18:08 +02:00
parent 44cf31c958
commit d82395d0ae
13 changed files with 1985 additions and 137 deletions
+10
View File
@@ -813,6 +813,16 @@ describe('OAuth sessions', () => {
.set('Cookie', authCookie(admin.id));
expect(res.status).toBe(404);
});
it('ADMIN-026B — DELETE /admin/oauth-sessions/abc (non-numeric id) returns the legacy 404, not a 500 (Plan 3b Task 4 controller addendum, per Task 2 review F1)', async () => {
const { user: admin } = createAdmin(testDb);
const res = await request(app)
.delete('/api/admin/oauth-sessions/abc')
.set('Cookie', authCookie(admin.id));
expect(res.status).toBe(404);
expect(res.body).toEqual({ error: 'Session not found' });
});
});
// ─────────────────────────────────────────────────────────────────────────────