mirror of
https://github.com/ThisIsBenny/wishlist-app.git
synced 2025-06-07 05:57:41 +00:00
DB schema changed
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
271e033a5a
commit
8272237d50
5 changed files with 11 additions and 11 deletions
|
@ -12,12 +12,12 @@ CREATE TABLE "Item" (
|
|||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"title" TEXT NOT NULL,
|
||||
"url" TEXT,
|
||||
"image" TEXT,
|
||||
"imageSrc" TEXT,
|
||||
"description" TEXT NOT NULL,
|
||||
"comment" TEXT,
|
||||
"bought" BOOLEAN NOT NULL DEFAULT false,
|
||||
"wishlistId" TEXT,
|
||||
CONSTRAINT "Item_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
"wishlistId" TEXT NOT NULL,
|
||||
CONSTRAINT "Item_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
|
@ -11,10 +11,10 @@ datasource db {
|
|||
}
|
||||
|
||||
model Wishlist {
|
||||
id String @id @default(uuid())
|
||||
id String @id @default(uuid())
|
||||
title String
|
||||
imageSrc String
|
||||
slugUrlText String @unique
|
||||
slugUrlText String @unique
|
||||
description String?
|
||||
items Item[]
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ model Item {
|
|||
id Int @id @default(autoincrement())
|
||||
title String
|
||||
url String?
|
||||
image String?
|
||||
imageSrc String?
|
||||
description String
|
||||
comment String?
|
||||
bought Boolean @default(false)
|
||||
wishlist Wishlist? @relation(fields: [wishlistId], references: [id])
|
||||
wishlistId String?
|
||||
wishlist Wishlist @relation(fields: [wishlistId], references: [id])
|
||||
wishlistId String
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ export const getBySlugUrl = <RouteOptions>{
|
|||
id: { type: 'number' },
|
||||
title: { type: 'string' },
|
||||
url: { type: 'string' },
|
||||
image: { type: 'string' },
|
||||
imageSrc: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
comment: { type: 'string' },
|
||||
bought: { type: 'boolean' },
|
||||
|
|
|
@ -2,7 +2,7 @@ export interface WishlistItem {
|
|||
id: string
|
||||
title: string
|
||||
url: string
|
||||
image: string
|
||||
imageSrc: string
|
||||
description: string
|
||||
comment: string
|
||||
bought: boolean
|
||||
|
|
|
@ -46,7 +46,7 @@ const bought = async (item: WishlistItemType): Promise<void> => {
|
|||
:key="index"
|
||||
:title="item.title"
|
||||
:url="item.url"
|
||||
:image="item.image"
|
||||
:image="item.imageSrc"
|
||||
:description="item.description"
|
||||
:comment="item.comment"
|
||||
@bought="bought(item)"
|
||||
|
|
Loading…
Add table
Reference in a new issue