Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

596 B
Raw Blame
import { eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import { schema } from "../database";
import type { DbOrTx } from "../project-access/db-or-tx";

/** The user an admin action is about, or a 404. */
export async function findAdminTargetUser(database: DbOrTx, userId: string) {
  const [user] = await database
    .select({ id: schema.userTable.id, email: schema.userTable.email })
    .from(schema.userTable)
    .where(eq(schema.userTable.id, userId))
    .limit(1);
  if (!user) throw new HTTPException(404, { message: "User not found" });
  return user;
}