mirror of
https://github.com/Chewbaccalakis/rfid-database.git
synced 2026-09-10 00:11:56 -07:00
Implement RFID tag dump PWA with REST API, auth, and CI
Add Next.js app with SQLite/Drizzle storage for sites and LF/HF tag dumps, multi-user Auth.js (credentials + optional OIDC), personal API tokens in Settings, versioned /api/v1 for UI and future CLI use, MCT/Proxmark/JSON import-export, PWA offline shell, Vitest tests, and GitHub Actions CI.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { NextRequest } from "next/server";
|
||||
import { requireApiUser, jsonError, jsonOk } from "@/lib/api/auth-guard";
|
||||
import { getDb } from "@/db/client";
|
||||
import { users } from "@/db/schema";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { isOidcConfigured } from "@/lib/auth/auth";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const userOrRes = await requireApiUser(request);
|
||||
if (userOrRes instanceof Response) return userOrRes;
|
||||
|
||||
const db = getDb();
|
||||
const row = db.select().from(users).where(eq(users.id, userOrRes.id)).get();
|
||||
if (!row) return jsonError(404, "NOT_FOUND", "User not found");
|
||||
|
||||
return jsonOk({
|
||||
id: row.id,
|
||||
email: row.email,
|
||||
name: row.name,
|
||||
createdAt: row.createdAt.toISOString(),
|
||||
oidcAvailable: isOidcConfigured(),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user