feat: implement user profile, order history, and address book with checkout integration

This commit is contained in:
Your Name committed 2026-06-07 18:48:56 +07:00
1 parent bae945b9d4
commit 0c3c450e1f
9 files changed
+1109 -32

No files matched your search

@@ -0,0 +1,20 @@
-- CreateTable
CREATE TABLE "CustomerAddress" (
"id" SERIAL NOT NULL,
"customerId" INTEGER NOT NULL,
"recipientName" TEXT NOT NULL,
"phone" TEXT NOT NULL,
"addressLine" TEXT NOT NULL,
"subdistrict" TEXT NOT NULL,
"district" TEXT NOT NULL,
"province" TEXT NOT NULL,
"zipcode" TEXT NOT NULL,
"isDefault" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "CustomerAddress_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "CustomerAddress" ADD CONSTRAINT "CustomerAddress_customerId_fkey" FOREIGN KEY ("customerId") REFERENCES "Customer"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+22 -5
View File
@@ -76,17 +76,34 @@ model User {
}
model Customer {
id Int @id @default(autoincrement())
lineUserId String @unique
id Int @id @default(autoincrement())
lineUserId String @unique
displayName String?
pictureUrl String?
email String?
phone String?
points Int @default(0)
points Int @default(0)
orders Order[]
reviews Review[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
addresses CustomerAddress[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model CustomerAddress {
id Int @id @default(autoincrement())
customerId Int
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
recipientName String
phone String
addressLine String // บ้านเลขที่ หมู่บ้าน ถนน ซอย
subdistrict String // แขวง/ตำบล
district String // เขต/อำเภอ
province String // จังหวัด
zipcode String // รหัสไปรษณีย์
isDefault Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Hero {