-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
140 additions
and
8 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
packages/services/adoption/prisma/migrations/20240423194911_init/migration.sql
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,51 @@ | ||
-- CreateEnum | ||
CREATE TYPE "PetGender" AS ENUM ('MALE', 'FEMALE'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "PetCategory" AS ENUM ('DOG', 'CAT', 'BIRD'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "PetSize" AS ENUM ('SMALL', 'MEDIUM', 'LARGE', 'EX_LARGE'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "PetColor" AS ENUM ('WHITE', 'BLACK', 'BROWN', 'GRAY'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "PetBreed" AS ENUM ('HUSKY', 'BEAGLE', 'DOGOT', 'LABRADO', 'POMERANIAN'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Pet" ( | ||
"id" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"breed" "PetBreed" NOT NULL DEFAULT 'HUSKY', | ||
"age" DOUBLE PRECISION NOT NULL DEFAULT 2, | ||
"color" "PetColor" NOT NULL DEFAULT 'BLACK', | ||
"size" "PetSize" NOT NULL DEFAULT 'MEDIUM', | ||
"description" TEXT NOT NULL, | ||
"image" TEXT, | ||
"category" "PetCategory" NOT NULL DEFAULT 'DOG', | ||
"gender" "PetGender" NOT NULL DEFAULT 'MALE', | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "Pet_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "PetAdoption" ( | ||
"id" TEXT NOT NULL, | ||
"petId" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"description" TEXT, | ||
"status" TEXT, | ||
"size" "PetSize" NOT NULL DEFAULT 'MEDIUM', | ||
"color" "PetColor" NOT NULL DEFAULT 'BLACK', | ||
"breed" "PetBreed" NOT NULL DEFAULT 'HUSKY', | ||
"age" DOUBLE PRECISION NOT NULL DEFAULT 2, | ||
"category" "PetCategory" NOT NULL DEFAULT 'DOG', | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "PetAdoption_pkey" PRIMARY KEY ("id") | ||
); |
3 changes: 3 additions & 0 deletions
3
packages/services/adoption/prisma/migrations/migration_lock.toml
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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
40 changes: 40 additions & 0 deletions
40
packages/services/auth/prisma/migrations/20240423201305_init/migration.sql
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,40 @@ | ||
-- CreateEnum | ||
CREATE TYPE "Role" AS ENUM ('USER', 'ADMIN'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "AccountStatus" AS ENUM ('PENDING', 'ACTIVE', 'INACTIVE', 'SUSPENDED'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "LoginAttempt" AS ENUM ('SUCCESS', 'FAILED'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "AuthUser" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"password" TEXT NOT NULL, | ||
"role" "Role" NOT NULL DEFAULT 'USER', | ||
"verified" BOOLEAN NOT NULL DEFAULT false, | ||
"status" "AccountStatus" NOT NULL DEFAULT 'PENDING', | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "AuthUser_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "LoginHistory" ( | ||
"id" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"ip" TEXT, | ||
"userAgent" TEXT, | ||
"attempt" "LoginAttempt" NOT NULL DEFAULT 'SUCCESS', | ||
|
||
CONSTRAINT "LoginHistory_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "AuthUser_email_key" ON "AuthUser"("email"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "LoginHistory" ADD CONSTRAINT "LoginHistory_userId_fkey" FOREIGN KEY ("userId") REFERENCES "AuthUser"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
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
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
25 changes: 25 additions & 0 deletions
25
packages/services/user/prisma/migrations/20240423194747_init/migration.sql
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,25 @@ | ||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL, | ||
"authUserId" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"phoneNumber" TEXT, | ||
"address" TEXT NOT NULL DEFAULT 'Gazipur, Dhaka', | ||
"city" TEXT NOT NULL DEFAULT 'Dhaka', | ||
"state" TEXT NOT NULL DEFAULT 'Dhaka', | ||
"country" TEXT NOT NULL DEFAULT 'Bangladesh', | ||
"postalCode" TEXT NOT NULL DEFAULT '1000', | ||
"isActive" BOOLEAN NOT NULL DEFAULT true, | ||
"isDeleted" BOOLEAN NOT NULL DEFAULT false, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_authUserId_key" ON "User"("authUserId"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "User_authUserId_idx" ON "User"("authUserId"); |
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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
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,6 @@ | ||
import { Request, Response, NextFunction } from "express"; | ||
import { UserCreateSchema } from "@/utils/schemas"; | ||
import prisma from "@/utils/prisma"; | ||
|
||
|
||
|
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