Desc:
- Tambah field database
- Tambah aset image
No issue
This commit is contained in:
2023-10-03 17:49:19 +08:00
parent 907b52e9d4
commit dcef949e51
4 changed files with 70 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
-- CreateTable
CREATE TABLE "Profile" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"alamat" TEXT NOT NULL,
"jenisKelamin" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" TEXT,
"imagesId" TEXT,
CONSTRAINT "Profile_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Images" (
"id" TEXT NOT NULL,
"url" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Images_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Profile_email_key" ON "Profile"("email");
-- CreateIndex
CREATE UNIQUE INDEX "Profile_userId_key" ON "Profile"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "Profile_imagesId_key" ON "Profile"("imagesId");
-- AddForeignKey
ALTER TABLE "Profile" ADD CONSTRAINT "Profile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Profile" ADD CONSTRAINT "Profile_imagesId_fkey" FOREIGN KEY ("imagesId") REFERENCES "Images"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@@ -20,6 +20,7 @@ model User {
MasterUserRole MasterUserRole @relation(fields: [masterUserRoleId], references: [id]) MasterUserRole MasterUserRole @relation(fields: [masterUserRoleId], references: [id])
masterUserRoleId String @default("1") masterUserRoleId String @default("1")
UserSession UserSession? UserSession UserSession?
Profile Profile?
} }
model MasterUserRole { model MasterUserRole {
@@ -41,3 +42,27 @@ model UserSession {
User User @relation(fields: [userId], references: [id]) User User @relation(fields: [userId], references: [id])
userId String @unique userId String @unique
} }
model Profile {
id String @id @default(cuid())
name String
email String @unique
alamat String
jenisKelamin String
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
User User? @relation(fields: [userId], references: [id])
userId String? @unique
ImageProfile Images? @relation(fields: [imagesId], references: [id])
imagesId String? @unique
}
model Images {
id String @id @default(cuid())
url String
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
Profile Profile?
}

BIN
public/aset/avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -6,4 +6,7 @@ export const ApiHipmi = {
validasi: "/api/auth/validasi", validasi: "/api/auth/validasi",
register: "/api/auth/register", register: "/api/auth/register",
logout: "/api/auth/logout", logout: "/api/auth/logout",
//Profile
create_profile: "/api/profile/create"
}; };