This commit is contained in:
2026-05-12 07:54:32 +03:00
parent 0faa8b9d2d
commit d49449c30c
187 changed files with 4826 additions and 5884 deletions

View File

@@ -0,0 +1,21 @@
import { BadRequestException } from "@nestjs/common"
export function normalizeProjectSlug(value: string) {
const normalized = value.trim().toLowerCase()
if (!/^[a-z0-9][a-z0-9_-]{2,63}$/.test(normalized)) {
throw new BadRequestException("project slug must be 3-64 chars and contain lowercase letters, digits, _ or -")
}
return normalized
}
export function createProjectSlug(name: string) {
const slug = name
.trim()
.toLowerCase()
.replaceAll(/[^a-z0-9_-]+/g, "-")
.replaceAll(/^-+|-+$/g, "")
return normalizeProjectSlug(slug || "project")
}