Something went wrong. Try again.
spool is a community-first, lightweight discussion forum, issue tracker, and announcement hub for your project.
Something went wrong. Try again.
123456789101112131415161718192021import { eq, max } from "drizzle-orm";import { db } from "./index.js";import { issues } from "./schema.js";
// Next per-spool issue number. The unique index on (spool_id, number) is the// safety net if two inserts ever race.export async function nextIssueNumber(spoolId: number): Promise<number> { const [row] = await db .select({ max: max(issues.number) }) .from(issues) .where(eq(issues.spoolId, spoolId)); return (row?.max ?? 0) + 1;}
export function slugify(name: string): string { return name .toLowerCase() .replace(/[^a-z0-9]+/g, "-") .replace(/^-|-$/g, "");}