data browser wip

This commit is contained in:
2026-10-24 02:42:31 +00:00
parent c8205e474e
commit 941a9f16e1
22 changed files with 2141 additions and 6 deletions

View File

@@ -28,10 +28,13 @@ export async function uniqueSlug(title: string): Promise<string> {
return slug;
}
/** /lists/db is the database browser, so no list may use that slug. */
export const RESERVED_LIST_SLUGS = new Set(['db']);
export async function uniqueListSlug(name: string): Promise<string> {
const base = slugify(name, 'list');
let slug = base;
let suffix = 2;
let slug = RESERVED_LIST_SLUGS.has(base) ? `${base}-2` : base;
let suffix = RESERVED_LIST_SLUGS.has(base) ? 3 : 2;
while (
(await db.select({ id: metaTables.id }).from(metaTables).where(eq(metaTables.slug, slug)))
.length > 0