IKHSAN
EN Read in EnglishID

homeio

Publik

Fork dari doctor-io/homeio

Branch
main
Commit terakhir
958d74616 Oktober 2026

route.ts

Buka raw
import { NextResponse } from "next/server";
import {
  createRequestId,
  logServerAction,
  withServerTiming,
} from "@/lib/server/logging/logger";
import { hasAnyUsers } from "@/lib/server/modules/auth/repository";

export const runtime = "nodejs";

export async function GET() {
  const requestId = createRequestId();

  try {
    const hasUsers = await withServerTiming(
      {
        layer: "api",
        action: "auth.status",
        requestId,
      },
      () => hasAnyUsers(),
    );

    return NextResponse.json({
      data: {
        hasUsers,
      },
    });
  } catch (error) {
    logServerAction({
      level: "error",
      layer: "api",
      action: "auth.status",
      status: "error",
      requestId,
      error,
    });

    return NextResponse.json(
      {
        error: "Failed to read auth status",
      },
      { status: 500 },
    );
  }
}
byte
882
baris
47
Jenis
ts
Commit terakhir
16 Oktober 2026