data browser wip
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user