Skip to content

Commit

Permalink
Merge pull request #140 from moinulmoin/move-to-lucia
Browse files Browse the repository at this point in the history
Move to lucia-auth
  • Loading branch information
moinulmoin authored Dec 8, 2023
2 parents 99a162a + 20b88c2 commit 484e6f9
Show file tree
Hide file tree
Showing 31 changed files with 360 additions and 472 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ui/
ui/
*.d.ts
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
],
"@typescript-eslint/no-unused-vars": [
"error",
"warn",
{
"argsIgnorePattern": "^_"
}
Expand Down
10 changes: 10 additions & 0 deletions auth.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// <reference types="lucia" />
declare namespace Lucia {
type Auth = import("./src/lib/auth").Auth;
type DatabaseUserAttributes = {
name: string;
email: string;
picture: string;
};
type DatabaseSessionAttributes = {};
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"dependencies": {
"@ducanh2912/next-pwa": "^9.7.1",
"@hookform/resolvers": "^3.3.2",
"@next-auth/prisma-adapter": "^1.0.7",
"@lucia-auth/adapter-prisma": "^3.0.2",
"@lucia-auth/oauth": "^3.5.0",
"@prisma/client": "^5.4.2",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-avatar": "^1.0.4",
Expand All @@ -28,10 +29,10 @@
"@react-email/components": "^0.0.7",
"@uploadthing/react": "^5.6.2",
"date-fns": "^2.30.0",
"lucia": "^2.7.4",
"lucide-react": "^0.286.0",
"nanoid": "^5.0.1",
"next": "14.0.2",
"next-auth": "^4.24.5",
"next-themes": "^0.2.1",
"nodemailer": "^6.9.6",
"postcss": "8.4.31",
Expand Down
127 changes: 32 additions & 95 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
-- CreateTable
CREATE TABLE "Account" (
CREATE TABLE "Session" (
"id" TEXT NOT NULL,
"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_pkey" PRIMARY KEY ("id")
"user_id" TEXT NOT NULL,
"active_expires" BIGINT NOT NULL,
"idle_expires" BIGINT NOT NULL,

CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Session" (
CREATE TABLE "Key" (
"id" TEXT NOT NULL,
"sessionToken" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
"hashed_password" TEXT,
"user_id" TEXT NOT NULL,

CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
CONSTRAINT "Key_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"name" TEXT,
"email" TEXT,
"emailVerified" TIMESTAMP(3),
"image" TEXT,
"shortBio" TEXT,
"picture" TEXT,
"stripe_customer_id" TEXT,
"stripe_subscription_id" TEXT,
"stripe_price_id" TEXT,
Expand Down Expand Up @@ -61,16 +50,19 @@ CREATE TABLE "Project" (
);

-- CreateIndex
CREATE INDEX "Account_userId_idx" ON "Account"("userId");
CREATE UNIQUE INDEX "Session_id_key" ON "Session"("id");

-- CreateIndex
CREATE INDEX "Session_user_id_idx" ON "Session"("user_id");

-- CreateIndex
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");
CREATE UNIQUE INDEX "Key_id_key" ON "Key"("id");

-- CreateIndex
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
CREATE INDEX "Key_user_id_idx" ON "Key"("user_id");

-- CreateIndex
CREATE INDEX "Session_userId_idx" ON "Session"("userId");
CREATE UNIQUE INDEX "User_id_key" ON "User"("id");

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
Expand All @@ -88,10 +80,10 @@ CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");

-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "Session" ADD CONSTRAINT "Session_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "Key" ADD CONSTRAINT "Key_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Project" ADD CONSTRAINT "Project_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
8 changes: 8 additions & 0 deletions prisma/migrations/20231208111448_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the `VerificationToken` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
DROP TABLE "VerificationToken";
Loading

1 comment on commit 484e6f9

@vercel
Copy link

@vercel vercel bot commented on 484e6f9 Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.