fix(03): IN-04 type resolveUserId param as Hono Context instead of any
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
import { randomUUID } from 'node:crypto'
|
import { randomUUID } from 'node:crypto'
|
||||||
import { Hono } from 'hono'
|
import { Hono } from 'hono'
|
||||||
|
import type { Context } from 'hono'
|
||||||
import { zValidator } from '@hono/zod-validator'
|
import { zValidator } from '@hono/zod-validator'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { and, or, eq, desc } from 'drizzle-orm'
|
import { and, or, eq, desc } from 'drizzle-orm'
|
||||||
@@ -55,8 +56,10 @@ const MAX_WINDOW_DAYS = 90
|
|||||||
// Identity is keyed on oidc_iss + oidc_sub (D-10), never email.
|
// Identity is keyed on oidc_iss + oidc_sub (D-10), never email.
|
||||||
// 3. Callers emit 401 when resolveUserId returns null.
|
// 3. Callers emit 401 when resolveUserId returns null.
|
||||||
//
|
//
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// IN-04: typed as Hono's Context instead of `any`. c.get('user') resolves through the
|
||||||
async function resolveUserId(c: any): Promise<number | null> {
|
// ContextVariableMap augmentation in auth/devBypass.ts (typed as the DEV_USER shape),
|
||||||
|
// and getAuth(c) accepts a Context — so no `any` / eslint-disable is needed here.
|
||||||
|
async function resolveUserId(c: Context): Promise<number | null> {
|
||||||
const devUser = c.get('user') as { id: number } | undefined
|
const devUser = c.get('user') as { id: number } | undefined
|
||||||
if (devUser) return devUser.id
|
if (devUser) return devUser.id
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user