feat(db): phase 4 group 5 — dashboard/reports/settings/notifications/users routes to Drizzle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 17:13:51 +08:00
co-authored by Claude Sonnet 4.6
parent 853675118d
commit c2db693d9f
7 changed files with 273 additions and 151 deletions
+20
View File
@@ -0,0 +1,20 @@
import { NextResponse } from 'next/server'
import { asAdmin } from '@/lib/db/with-user'
import { users } from '@/lib/db/schema'
import { eq, asc } from 'drizzle-orm'
export const dynamic = 'force-dynamic'
export async function GET() {
try {
const result = await asAdmin(db =>
db.select({ id: users.id, name: users.name, department: users.department, active: users.active })
.from(users)
.where(eq(users.active, true))
.orderBy(asc(users.name))
)
return NextResponse.json(result)
} catch {
return NextResponse.json([])
}
}