feat: set workspace url when creating a new workspace (#172)
* feat: add migration to remove not null constraint from referenceId on subscriptions * feat(cloud): write worspace slug availability checks to db * feat: add migration to add cascade set null to referenceId on subscription * feat: update workspace and subscripton schema * feat: add createWorkspaceSlugCheck repo func * feat: set workspace url on creation * chore: update translations * refactor: various tweaks and fixes * feat: add pro bolt to pricing notice * feat: toggle pro subscription * fix: hide pro subscription notice for self hosters * feat: add pro upgrade message on members page * feat: hide pro upgrade notice on small viewports * feat: update workspace url placeholder
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
import type { dbClient } from "@kan/db/client";
|
||||
import { slugs } from "@kan/db/schema";
|
||||
import { slugChecks, slugs } from "@kan/db/schema";
|
||||
|
||||
export const getWorkspaceSlug = (db: dbClient, slug: string) => {
|
||||
return db.query.slugs.findFirst({
|
||||
@@ -12,3 +12,20 @@ export const getWorkspaceSlug = (db: dbClient, slug: string) => {
|
||||
where: eq(slugs.slug, slug),
|
||||
});
|
||||
};
|
||||
|
||||
export const createWorkspaceSlugCheck = (
|
||||
db: dbClient,
|
||||
input: {
|
||||
slug: string;
|
||||
userId: string;
|
||||
available: boolean;
|
||||
reserved: boolean;
|
||||
},
|
||||
) => {
|
||||
return db.insert(slugChecks).values({
|
||||
slug: input.slug,
|
||||
available: input.available,
|
||||
reserved: input.reserved,
|
||||
createdBy: input.userId,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user