Merge branch 'release/v1.0.0'

This commit is contained in:
Benny Samir Hierl 2022-02-20 15:59:31 +01:00
commit 74c2f29cf5
6 changed files with 27 additions and 6 deletions

BIN
.github/assets/demo-bookmark.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

4
package-lock.json generated
View file

@ -1,11 +1,11 @@
{ {
"name": "wishlist", "name": "wishlist",
"version": "1.0.0", "version": "1.0.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "1.0.0", "version": "1.0.2",
"dependencies": { "dependencies": {
"@prisma/client": "^3.9.2", "@prisma/client": "^3.9.2",
"@tailwindcss/line-clamp": "^0.3.1", "@tailwindcss/line-clamp": "^0.3.1",

View file

@ -1,5 +1,5 @@
{ {
"version": "1.0.0", "version": "1.0.2",
"scripts": { "scripts": {
"dev": "concurrently --kill-others \"npm run dev:frontend\" \"npm run dev:backend\"", "dev": "concurrently --kill-others \"npm run dev:frontend\" \"npm run dev:backend\"",
"demo": "npm run build && prisma migrate deploy && prisma migrate reset -f && node dist/api/server.js", "demo": "npm run build && prisma migrate deploy && prisma migrate reset -f && node dist/api/server.js",

View file

@ -0,0 +1,17 @@
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Item" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL,
"url" TEXT NOT NULL DEFAULT '',
"imageSrc" TEXT NOT NULL DEFAULT '',
"description" TEXT NOT NULL,
"bought" BOOLEAN NOT NULL DEFAULT false,
"wishlistId" TEXT NOT NULL,
CONSTRAINT "Item_wishlistId_fkey" FOREIGN KEY ("wishlistId") REFERENCES "Wishlist" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_Item" ("bought", "description", "id", "imageSrc", "title", "url", "wishlistId") SELECT "bought", "description", "id", "imageSrc", "title", "url", "wishlistId" FROM "Item";
DROP TABLE "Item";
ALTER TABLE "new_Item" RENAME TO "Item";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View file

@ -27,6 +27,6 @@ model Item {
imageSrc String @default("") imageSrc String @default("")
description String description String
bought Boolean @default(false) bought Boolean @default(false)
wishlist Wishlist @relation(fields: [wishlistId], references: [id]) wishlist Wishlist @relation(fields: [wishlistId], references: [id], onDelete: Cascade)
wishlistId String wishlistId String
} }

View file

@ -41,7 +41,9 @@ const updateWishlist = async (updatedData: Wishlist): Promise<void> => {
} }
const deleteWishlist = async (): Promise<void> => { const deleteWishlist = async (): Promise<void> => {
const { error } = await useFetch(`/wishlist/${state!.value!.id}`).delete() const { error } = await useFetch(`/wishlist/${state!.value!.id}`)
.delete()
.json()
if (error.value) { if (error.value) {
throw error.value throw error.value
} }
@ -92,7 +94,9 @@ const updateItem = async (
const itemBought = async (item: WishlistItem): Promise<void> => { const itemBought = async (item: WishlistItem): Promise<void> => {
const { error } = await useFetch( const { error } = await useFetch(
`/wishlist/${item.wishlistId}/item/${item.id}/bought` `/wishlist/${item.wishlistId}/item/${item.id}/bought`
).post() )
.post()
.json()
if (error.value) { if (error.value) {
throw error.value throw error.value
} }