-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from priyanshuverma-dev/feat-authentication
fix #34: Implement Login and Signup Functionality Updated
- Loading branch information
Showing
39 changed files
with
5,420 additions
and
335 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 |
---|---|---|
|
@@ -27,6 +27,7 @@ yarn-error.log* | |
|
||
# local env files | ||
.env*.local | ||
.env | ||
|
||
# vercel | ||
.vercel | ||
|
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,12 @@ | ||
|
||
import { defineConfig } from "drizzle-kit"; | ||
|
||
export default defineConfig({ | ||
schema: "./src/lib/schema.ts", | ||
out: "./drizzle", | ||
dialect: 'postgresql', | ||
|
||
dbCredentials: { | ||
url: process.env.DATABASE_URL as string, | ||
}, | ||
}); |
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,49 @@ | ||
CREATE TABLE IF NOT EXISTS "account" ( | ||
"userId" text NOT NULL, | ||
"type" text NOT NULL, | ||
"provider" text NOT NULL, | ||
"providerAccountId" text NOT NULL, | ||
"refresh_token" text, | ||
"access_token" text, | ||
"expires_at" integer, | ||
"token_type" text, | ||
"scope" text, | ||
"id_token" text, | ||
"session_state" text, | ||
CONSTRAINT "account_provider_providerAccountId_pk" PRIMARY KEY("provider","providerAccountId") | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "session" ( | ||
"sessionToken" text PRIMARY KEY NOT NULL, | ||
"userId" text NOT NULL, | ||
"expires" timestamp NOT NULL | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "user" ( | ||
"id" text PRIMARY KEY NOT NULL, | ||
"name" text, | ||
"email" text, | ||
"password" text, | ||
"emailVerified" timestamp, | ||
"image" text, | ||
CONSTRAINT "user_email_unique" UNIQUE("email") | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "verificationToken" ( | ||
"identifier" text NOT NULL, | ||
"token" text NOT NULL, | ||
"expires" timestamp NOT NULL, | ||
CONSTRAINT "verificationToken_identifier_token_pk" PRIMARY KEY("identifier","token") | ||
); | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "account" ADD CONSTRAINT "account_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "session" ADD CONSTRAINT "session_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; |
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,2 @@ | ||
ALTER TABLE "user" ADD COLUMN "username" text;--> statement-breakpoint | ||
ALTER TABLE "user" ADD CONSTRAINT "user_username_unique" UNIQUE("username"); |
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 @@ | ||
ALTER TABLE "user" ADD COLUMN "alerts" boolean; |
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,14 @@ | ||
CREATE TABLE IF NOT EXISTS "otp" ( | ||
"userId" text NOT NULL, | ||
"otp" text NOT NULL, | ||
"createdAt" timestamp NOT NULL, | ||
"expiresAt" timestamp NOT NULL, | ||
"isUsed" boolean DEFAULT false NOT NULL, | ||
CONSTRAINT "otp_userId_createdAt_pk" PRIMARY KEY("userId","createdAt") | ||
); | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "otp" ADD CONSTRAINT "otp_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; |
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,246 @@ | ||
{ | ||
"id": "30e5f37c-93a1-4cb6-9868-2083acd3ed37", | ||
"prevId": "00000000-0000-0000-0000-000000000000", | ||
"version": "7", | ||
"dialect": "postgresql", | ||
"tables": { | ||
"public.account": { | ||
"name": "account", | ||
"schema": "", | ||
"columns": { | ||
"userId": { | ||
"name": "userId", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"type": { | ||
"name": "type", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"provider": { | ||
"name": "provider", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"providerAccountId": { | ||
"name": "providerAccountId", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"refresh_token": { | ||
"name": "refresh_token", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"access_token": { | ||
"name": "access_token", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"expires_at": { | ||
"name": "expires_at", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"token_type": { | ||
"name": "token_type", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"scope": { | ||
"name": "scope", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"id_token": { | ||
"name": "id_token", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"session_state": { | ||
"name": "session_state", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": { | ||
"account_userId_user_id_fk": { | ||
"name": "account_userId_user_id_fk", | ||
"tableFrom": "account", | ||
"tableTo": "user", | ||
"columnsFrom": [ | ||
"userId" | ||
], | ||
"columnsTo": [ | ||
"id" | ||
], | ||
"onDelete": "cascade", | ||
"onUpdate": "no action" | ||
} | ||
}, | ||
"compositePrimaryKeys": { | ||
"account_provider_providerAccountId_pk": { | ||
"name": "account_provider_providerAccountId_pk", | ||
"columns": [ | ||
"provider", | ||
"providerAccountId" | ||
] | ||
} | ||
}, | ||
"uniqueConstraints": {} | ||
}, | ||
"public.session": { | ||
"name": "session", | ||
"schema": "", | ||
"columns": { | ||
"sessionToken": { | ||
"name": "sessionToken", | ||
"type": "text", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"userId": { | ||
"name": "userId", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"expires": { | ||
"name": "expires", | ||
"type": "timestamp", | ||
"primaryKey": false, | ||
"notNull": true | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": { | ||
"session_userId_user_id_fk": { | ||
"name": "session_userId_user_id_fk", | ||
"tableFrom": "session", | ||
"tableTo": "user", | ||
"columnsFrom": [ | ||
"userId" | ||
], | ||
"columnsTo": [ | ||
"id" | ||
], | ||
"onDelete": "cascade", | ||
"onUpdate": "no action" | ||
} | ||
}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": {} | ||
}, | ||
"public.user": { | ||
"name": "user", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "text", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"name": { | ||
"name": "name", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"email": { | ||
"name": "email", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"password": { | ||
"name": "password", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"emailVerified": { | ||
"name": "emailVerified", | ||
"type": "timestamp", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"image": { | ||
"name": "image", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": { | ||
"user_email_unique": { | ||
"name": "user_email_unique", | ||
"nullsNotDistinct": false, | ||
"columns": [ | ||
"email" | ||
] | ||
} | ||
} | ||
}, | ||
"public.verificationToken": { | ||
"name": "verificationToken", | ||
"schema": "", | ||
"columns": { | ||
"identifier": { | ||
"name": "identifier", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"token": { | ||
"name": "token", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"expires": { | ||
"name": "expires", | ||
"type": "timestamp", | ||
"primaryKey": false, | ||
"notNull": true | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": { | ||
"verificationToken_identifier_token_pk": { | ||
"name": "verificationToken_identifier_token_pk", | ||
"columns": [ | ||
"identifier", | ||
"token" | ||
] | ||
} | ||
}, | ||
"uniqueConstraints": {} | ||
} | ||
}, | ||
"enums": {}, | ||
"schemas": {}, | ||
"sequences": {}, | ||
"_meta": { | ||
"columns": {}, | ||
"schemas": {}, | ||
"tables": {} | ||
} | ||
} |
Oops, something went wrong.