-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: custom domains created on Vercel if you include vercel API keys
- Loading branch information
1 parent
bcea03b
commit c8ca4fe
Showing
12 changed files
with
492 additions
and
74 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
apps/app/src/actions/organization/check-subdomain-availability.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// check-subdomain-availability.ts | ||
|
||
"use server"; | ||
|
||
import { db } from "@bubba/db"; | ||
import { authActionClient } from "../safe-action"; | ||
import { subdomainAvailabilitySchema } from "../schema"; | ||
import type { ActionResponse } from "../types"; | ||
|
||
export const checkSubdomainAvailability = authActionClient | ||
.schema(subdomainAvailabilitySchema) | ||
.metadata({ | ||
name: "check-subdomain-availability", | ||
}) | ||
.action(async ({ parsedInput }): Promise<ActionResponse> => { | ||
const { subdomain } = parsedInput; | ||
|
||
try { | ||
const subdomainExists = await db.organization.findFirst({ | ||
where: { | ||
subdomain: { | ||
equals: subdomain, | ||
mode: 'insensitive' | ||
}, | ||
}, | ||
select: { id: true } | ||
}); | ||
|
||
return { | ||
success: true, | ||
data: !subdomainExists | ||
}; | ||
} catch (error) { | ||
console.error('Prisma error:', error); | ||
return { | ||
success: false, | ||
error: "Failed to check subdomain availability" | ||
}; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.