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.

623 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";

/** Locks a workspace row for a lifecycle change and returns what it needs. */
export async function lockWorkspaceRow(database: DbOrTx, workspaceId: string) {
  const [workspace] = await database
    .select()
    .from(schema.workspaceTable)
    .where(eq(schema.workspaceTable.id, workspaceId))
    .for("update");
  if (!workspace) {
    throw new HTTPException(404, { message: "Workspace not found" });
  }
  return workspace;
}