From 9898c7ba7202da029eb6c46ca4d2d1881b8a201a Mon Sep 17 00:00:00 2001 From: "DESKTOP-9FO96TP\\hehexd" <davidjakszta@outlook.de> Date: Fri, 12 May 2023 14:23:56 +0200 Subject: [PATCH] messages Page --- app/messages/page.tsx | 17 ++++++++++ package-lock.json | 30 ++++++++++++++++-- package.json | 1 + prisma/dev.db | Bin 0 -> 20480 bytes .../migration.sql | 10 ++++++ prisma/migrations/migration_lock.toml | 3 ++ 6 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 app/messages/page.tsx create mode 100644 prisma/dev.db create mode 100644 prisma/migrations/20230512042440_first_migration_message_schema/migration.sql create mode 100644 prisma/migrations/migration_lock.toml diff --git a/app/messages/page.tsx b/app/messages/page.tsx new file mode 100644 index 0000000..72cb1aa --- /dev/null +++ b/app/messages/page.tsx @@ -0,0 +1,17 @@ +import { PrismaClient } from "@prisma/client" + +const prisma = new PrismaClient() + +export default async function MessageList() { + + const messages = await prisma.message.findMany() + + return ( + <div> + Message List Page + {messages.map((msg) => ( + <li key = "msg.id"> author: {msg.author} message: {msg.content} </li> + ))} + </div> + ) +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 39dc538..71b380c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@mui/material": "^5.12.3", + "@prisma/client": "^4.13.0", "@types/node": "20.1.0", "@types/react": "18.2.6", "@types/react-dom": "18.2.4", @@ -990,13 +991,38 @@ "url": "https://opencollective.com/popperjs" } }, + "node_modules/@prisma/client": { + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.13.0.tgz", + "integrity": "sha512-YaiiICcRB2hatxsbnfB66uWXjcRw3jsZdlAVxmx0cFcTc/Ad/sKdHCcWSnqyDX47vAewkjRFwiLwrOUjswVvmA==", + "hasInstallScript": true, + "dependencies": { + "@prisma/engines-version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a" + }, + "engines": { + "node": ">=14.17" + }, + "peerDependencies": { + "prisma": "*" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + } + } + }, "node_modules/@prisma/engines": { "version": "4.13.0", "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.13.0.tgz", "integrity": "sha512-HrniowHRZXHuGT9XRgoXEaP2gJLXM5RMoItaY2PkjvuZ+iHc0Zjbm/302MB8YsPdWozAPHHn+jpFEcEn71OgPw==", - "dev": true, + "devOptional": true, "hasInstallScript": true }, + "node_modules/@prisma/engines-version": { + "version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a.tgz", + "integrity": "sha512-fsQlbkhPJf08JOzKoyoD9atdUijuGBekwoOPZC3YOygXEml1MTtgXVpnUNchQlRSY82OQ6pSGQ9PxUe4arcSLQ==" + }, "node_modules/@rushstack/eslint-patch": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.2.0.tgz", @@ -3950,7 +3976,7 @@ "version": "4.13.0", "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.13.0.tgz", "integrity": "sha512-L9mqjnSmvWIRCYJ9mQkwCtj4+JDYYTdhoyo8hlsHNDXaZLh/b4hR0IoKIBbTKxZuyHQzLopb/+0Rvb69uGV7uA==", - "dev": true, + "devOptional": true, "hasInstallScript": true, "dependencies": { "@prisma/engines": "4.13.0" diff --git a/package.json b/package.json index ccbfedb..d31f10a 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@mui/material": "^5.12.3", + "@prisma/client": "^4.13.0", "@types/node": "20.1.0", "@types/react": "18.2.6", "@types/react-dom": "18.2.4", diff --git a/prisma/dev.db b/prisma/dev.db new file mode 100644 index 0000000000000000000000000000000000000000..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1Rwwb2tWV=?@geP+EzZI$YiAFZ=C2^zFzwwexm>TUO}DL_T*pH{^{)Y_y6yd q+`IR7c<2}c5P$##AOHafKmY;|fB*y_0D*sB-~%<irzZcBk@^ECc5`$9 literal 0 HcmV?d00001 diff --git a/prisma/migrations/20230512042440_first_migration_message_schema/migration.sql b/prisma/migrations/20230512042440_first_migration_message_schema/migration.sql new file mode 100644 index 0000000..226e0e7 --- /dev/null +++ b/prisma/migrations/20230512042440_first_migration_message_schema/migration.sql @@ -0,0 +1,10 @@ +-- CreateTable +CREATE TABLE "Message" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "author" TEXT NOT NULL, + "gameId" TEXT NOT NULL, + "title" TEXT NOT NULL, + "content" TEXT NOT NULL, + "sentAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME +); diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..e5e5c47 --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "sqlite" \ No newline at end of file -- GitLab