feat: Change auth flow

This commit is contained in:
SauravDhakal
2026-04-11 07:57:28 +05:45
parent ab8b2ef353
commit aa8deadf1f
21 changed files with 442 additions and 123 deletions

View File

@@ -0,0 +1,35 @@
/*
Warnings:
- You are about to drop the column `firstName` on the `user` table. All the data in the column will be lost.
- You are about to drop the column `lastName` on the `user` table. All the data in the column will be lost.
- You are about to drop the column `middleName` on the `user` table. All the data in the column will be lost.
- You are about to drop the column `profilePicture` on the `user` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "user" DROP COLUMN "firstName",
DROP COLUMN "lastName",
DROP COLUMN "middleName",
DROP COLUMN "profilePicture";
-- CreateTable
CREATE TABLE "UserAdditionalInformation" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"firstName" TEXT NOT NULL,
"middleName" TEXT,
"lastName" TEXT NOT NULL,
"profilePicture" TEXT,
"address" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "UserAdditionalInformation_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "UserAdditionalInformation_userId_key" ON "UserAdditionalInformation"("userId");
-- AddForeignKey
ALTER TABLE "UserAdditionalInformation" ADD CONSTRAINT "UserAdditionalInformation_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -0,0 +1,20 @@
/*
Warnings:
- You are about to drop the column `isVerified` on the `user` table. All the data in the column will be lost.
- You are about to drop the column `generatedOn` on the `user_otp` table. All the data in the column will be lost.
- Added the required column `expiresAt` to the `user_otp` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "USER_ACCOUNT_STATUS" AS ENUM ('pending', 'active', 'suspended', 'deleted');
-- AlterTable
ALTER TABLE "user" DROP COLUMN "isVerified",
ADD COLUMN "status" "USER_ACCOUNT_STATUS" NOT NULL DEFAULT 'pending',
ALTER COLUMN "password" DROP NOT NULL;
-- AlterTable
ALTER TABLE "user_otp" DROP COLUMN "generatedOn",
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "expiresAt" TIMESTAMP(3) NOT NULL;