Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

chore: remove waitlist table (#769)

bautistaaaf7abbca6a613
diff --git a/apps/web/src/app/[locale]/(email)/unsubscribe/_actions.ts b/apps/web/src/app/[locale]/(email)/unsubscribe/_actions.ts
deleted file mode 100644
index be5badc8..00000000
--- a/apps/web/src/app/[locale]/(email)/unsubscribe/_actions.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-'use server';
-
-import { prisma } from '@repo/db';
-
-export async function removeFromWaitlist(email: string) {
- // lul we didnt put a unique constraint on the email column
- // we enforce it on the client at least and this table is being deleted anyways
- return prisma.waitlist.deleteMany({
- where: {
- email,
- },
- });
-}
diff --git a/apps/web/src/app/[locale]/(email)/unsubscribe/page.tsx b/apps/web/src/app/[locale]/(email)/unsubscribe/page.tsx
deleted file mode 100644
index 6da01d1f..00000000
--- a/apps/web/src/app/[locale]/(email)/unsubscribe/page.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-'use client';
-
-import { zodResolver } from '@hookform/resolvers/zod';
-import { Button } from '@repo/ui/components/button';
-import { DialogFooter } from '@repo/ui/components/dialog';
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from '@repo/ui/components/form';
-import { Input } from '@repo/ui/components/input';
-import { useToast } from '@repo/ui/components/use-toast';
-import { useForm } from 'react-hook-form';
-import { z } from 'zod';
-import { removeFromWaitlist } from './_actions';
-
-const formSchema = z.object({
- email: z.string().email(),
-});
-
-export type FormSchema = z.infer<typeof formSchema>;
-export default function UnsubscribePage(props: { searchParams: { email?: string } }) {
- const { toast } = useToast();
-
- const form = useForm<FormSchema>({
- resolver: zodResolver(formSchema),
- defaultValues: {
- email: props.searchParams.email ?? '',
- },
- });
-
- async function onSubmit(data: FormSchema) {
- try {
- await removeFromWaitlist(data.email);
- toast({
- title: 'Successfully Unsubscribed',
- });
- } catch (e) {
- toast({
- variant: 'destructive',
- title: 'Something went wrong',
- });
- }
- }
-
- return (
- <div className="container">
- <h1 className="text-3xl font-bold">Unsubscribe</h1>
- <div className="max-w-md">
- <Form {...form}>
- <form onSubmit={form.handleSubmit(onSubmit)}>
- <FormField
- control={form.control}
- name="email"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Email:</FormLabel>
- <FormControl>
- <Input
- className="rounded-xl bg-neutral-200 dark:bg-neutral-800"
- placeholder="Enter a Track Title"
- {...field}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <DialogFooter className="py-3">
- <Button type="submit">Save</Button>
- </DialogFooter>
- </form>
- </Form>
- </div>
- </div>
- );
-}
diff --git a/apps/web/src/app/[locale]/(email)/waitlist/_components/create.action.ts b/apps/web/src/app/[locale]/(email)/waitlist/_components/create.action.ts
index 19d1b249..90000729 100644
--- a/apps/web/src/app/[locale]/(email)/waitlist/_components/create.action.ts
+++ b/apps/web/src/app/[locale]/(email)/waitlist/_components/create.action.ts
@@ -1,9 +1,7 @@
'use server';
-import { prisma } from '@repo/db';
-import { Resend } from 'resend';
import { UserSignupEmail } from '@repo/emails/emails/index';
-import type { WaitlistFormSchema } from './waitlist-form';
+import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
const baseUrl =
@@ -29,28 +27,3 @@ export const sendUserSignupEmail = async (to: string) => {
to,
};
};
-
-export async function uploadWaitlistEntry(data: WaitlistFormSchema) {
- const isUser = data.intention === 'user';
- const isBuilder = data.intention === 'builder';
-
- const existingEntry = await prisma.waitlist.findFirst({
- where: {
- email: data.email,
- },
- });
-
- if (existingEntry) {
- return 'duplicate';
- }
-
- await prisma.waitlist.create({
- data: {
- name: data.name,
- email: data.email,
- intention: isUser ? 'USER' : isBuilder ? 'BUILDER' : 'BOTH',
- },
- });
-
- await sendUserSignupEmail(data.email);
-}
diff --git a/packages/db/schema.prisma b/packages/db/schema.prisma
index d179ea5c..3ad12ca3 100644
--- a/packages/db/schema.prisma
+++ b/packages/db/schema.prisma
@@ -359,19 +359,6 @@ model Comment {
@@index([userId])
}
-enum WaitlistIntention {
- BUILDER // interested in building challenges for the community
- USER // interested in solving challenges
- BOTH
-}
-
-model Waitlist {
- id Int @id @default(autoincrement())
- name String
- email String
- intention WaitlistIntention
-}
-
model ImageUpload {
/// the id of the db row
id String @id @default(uuid())