DB schema changed

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2022-01-29 18:42:26 +01:00
parent 271e033a5a
commit 8272237d50
5 changed files with 11 additions and 11 deletions

View file

@ -12,12 +12,12 @@ CREATE TABLE "Item" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL, "title" TEXT NOT NULL,
"url" TEXT, "url" TEXT,
"image" TEXT, "imageSrc" TEXT,
"description" TEXT NOT NULL, "description" TEXT NOT NULL,
"comment" TEXT, "comment" TEXT,
"bought" BOOLEAN NOT NULL DEFAULT false, "bought" BOOLEAN NOT NULL DEFAULT false,
"wishlistId" TEXT, "wishlistId" TEXT NOT NULL,
CONSTRAINT "Item_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE SET NULL ON UPDATE CASCADE CONSTRAINT "Item_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
); );
-- CreateIndex -- CreateIndex

View file

@ -11,10 +11,10 @@ datasource db {
} }
model Wishlist { model Wishlist {
id String @id @default(uuid()) id String @id @default(uuid())
title String title String
imageSrc String imageSrc String
slugUrlText String @unique slugUrlText String @unique
description String? description String?
items Item[] items Item[]
} }
@ -23,10 +23,10 @@ model Item {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
title String title String
url String? url String?
image String? imageSrc String?
description String description String
comment String? comment String?
bought Boolean @default(false) bought Boolean @default(false)
wishlist Wishlist? @relation(fields: [wishlistId], references: [id]) wishlist Wishlist @relation(fields: [wishlistId], references: [id])
wishlistId String? wishlistId String
} }

View file

@ -51,7 +51,7 @@ export const getBySlugUrl = <RouteOptions>{
id: { type: 'number' }, id: { type: 'number' },
title: { type: 'string' }, title: { type: 'string' },
url: { type: 'string' }, url: { type: 'string' },
image: { type: 'string' }, imageSrc: { type: 'string' },
description: { type: 'string' }, description: { type: 'string' },
comment: { type: 'string' }, comment: { type: 'string' },
bought: { type: 'boolean' }, bought: { type: 'boolean' },

View file

@ -2,7 +2,7 @@ export interface WishlistItem {
id: string id: string
title: string title: string
url: string url: string
image: string imageSrc: string
description: string description: string
comment: string comment: string
bought: boolean bought: boolean

View file

@ -46,7 +46,7 @@ const bought = async (item: WishlistItemType): Promise<void> => {
:key="index" :key="index"
:title="item.title" :title="item.title"
:url="item.url" :url="item.url"
:image="item.image" :image="item.imageSrc"
:description="item.description" :description="item.description"
:comment="item.comment" :comment="item.comment"
@bought="bought(item)" @bought="bought(item)"