-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add early_access_invitees table (#143)
* feat: add early_access_invitees table schema * feat: add getEarlyAccessInviteeByEmail repo * feat: add user when early access invitee exists
- Loading branch information
1 parent
97d6518
commit 319505d
Showing
7 changed files
with
447 additions
and
4 deletions.
There are no files selected for viewing
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,9 @@ | ||
import { db } from '@/(server)/_shared/database/database'; | ||
|
||
export const getEarlyAccessInviteeByEmail = async (email: string) => { | ||
return db.query.earlyAccessInvitees.findFirst({ | ||
where(fields, operators) { | ||
return operators.eq(fields.email, email); | ||
}, | ||
}); | ||
}; |
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,15 @@ | ||
import { serial, text, pgTable, timestamp } from 'drizzle-orm/pg-core'; | ||
import { type InferSelectModel, sql } from 'drizzle-orm'; | ||
|
||
export const earlyAccessInvitees = pgTable('early_access_invitees', { | ||
id: serial('id').primaryKey(), | ||
email: text('email').notNull().unique(), | ||
name: text('name').notNull(), | ||
whitelistFeature: text('whitelist_feature') | ||
.array() | ||
.notNull() | ||
.default(sql`array[]::text[]`), | ||
createdAt: timestamp('created_at').notNull().defaultNow(), | ||
}); | ||
|
||
export type EarlyAccessInvitee = InferSelectModel<typeof earlyAccessInvitees>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CREATE TABLE IF NOT EXISTS "early_access_invitees" ( | ||
"id" serial PRIMARY KEY NOT NULL, | ||
"email" text NOT NULL, | ||
"name" text NOT NULL, | ||
"whitelist_feature" text[] DEFAULT array[]::text[] NOT NULL, | ||
"created_at" timestamp DEFAULT now() NOT NULL, | ||
CONSTRAINT "early_access_invitees_email_unique" UNIQUE("email") | ||
); |
Oops, something went wrong.