Add business registration requests with approval flow, SMS notifications, and owner businesses endpoint.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
export function slugifyTitle(value: string): string {
|
||||
return value
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '-')
|
||||
.replace(/[^a-z0-9-]/g, '')
|
||||
.replace(/-+/g, '-')
|
||||
.replace(/^-|-$/g, '');
|
||||
}
|
||||
|
||||
export async function uniqueBusinessSlug(
|
||||
title: string,
|
||||
exists: (slug: string) => Promise<boolean>,
|
||||
): Promise<string> {
|
||||
let base = slugifyTitle(title);
|
||||
if (!base) {
|
||||
base = 'business';
|
||||
}
|
||||
let slug = base;
|
||||
let suffix = 0;
|
||||
while (await exists(slug)) {
|
||||
suffix += 1;
|
||||
slug = `${base}-${suffix}`;
|
||||
}
|
||||
return slug;
|
||||
}
|
||||
Reference in New Issue
Block a user