Merge branch 'ui-v2' of github.com:Mintplex-Labs/vector-admin into v2-workspace-document

This commit is contained in:
timothycarambat
2023-12-21 11:04:58 -08:00
+7 -3
View File
@@ -16,17 +16,21 @@ const Organization = {
organization: null,
message: "No Organization name provided.",
};
var slug = slugify(orgName, { lower: true });
// If the new name contains bad characters
// replace them with spaces and continue creation.
const newOrgName = orgName.replace(/[:\.,<>@]/g, ' ');
var slug = slugify(newOrgName, { lower: true });
const existingBySlug = await this.get({ slug });
if (!!existingBySlug) {
const slugSeed = Math.floor(10000000 + Math.random() * 90000000);
slug = slugify(`${orgName}-${slugSeed}`, { lower: true });
slug = slugify(`${newOrgName}-${slugSeed}`, { lower: true });
}
const organization = await prisma.organizations.create({
data: {
name: orgName,
name: newOrgName,
slug,
uuid: this.makeKey(),
},