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:
@@ -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([])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user