From d1fb6d355e975c1d1d63085d30600af6e8fbf671 Mon Sep 17 00:00:00 2001 From: Martin Domajnko <35891136+martines3000@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:05:26 +0100 Subject: [PATCH] feat: migrate planetscale to supabase (#572) --- .changeset/twenty-turtles-approve.md | 5 + packages/dapp/.env.example | 4 +- packages/dapp/package.json | 3 - packages/dapp/prisma/schema.prisma | 15 - .../page.tsx | 8 +- packages/dapp/src/app/[locale]/app/layout.tsx | 4 +- .../src/app/api/encrypted-session/route.ts | 118 ++++++ .../src/app/api/qr-code-session/[id]/route.ts | 151 ------- .../src/components/AppBottomBar/index.tsx | 2 +- .../ConnectionModal/CreateConnectionModal.tsx | 90 ++++- .../ChooseDeviceView.tsx | 0 .../ConnectDeviceView.tsx | 110 ++--- .../CredentialView.tsx | 10 +- .../ScanQRCodeView.tsx | 65 ++- .../StartFlowView/CredentialOfferView.tsx | 8 +- .../StartFlowView/OIDCAuthView.tsx | 8 +- .../StartFlowView/PolygonAuthView.tsx | 8 +- .../StartFlowView/index.tsx | 10 +- .../index.tsx | 72 ++-- .../EncryptedSessionProvider/index.tsx | 202 ++++++++++ .../dapp/src/components/MenuPopover/index.tsx | 2 +- .../QRCodeSessionProvider/index.tsx | 193 --------- packages/dapp/src/messages/en.json | 12 +- .../dapp/src/stores/encryptedSessionStore.ts | 67 ++++ packages/dapp/src/stores/index.ts | 2 +- packages/dapp/src/stores/sessionStore.ts | 56 --- packages/dapp/src/utils/prisma.ts | 9 - .../dapp/src/utils/supabase/database.types.ts | 32 ++ pnpm-lock.yaml | 377 +++++++++++++----- 29 files changed, 960 insertions(+), 683 deletions(-) create mode 100644 .changeset/twenty-turtles-approve.md delete mode 100644 packages/dapp/prisma/schema.prisma rename packages/dapp/src/app/[locale]/app/(public)/{qr-code-session => encrypted-session}/page.tsx (63%) create mode 100644 packages/dapp/src/app/api/encrypted-session/route.ts delete mode 100644 packages/dapp/src/app/api/qr-code-session/[id]/route.ts rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/ChooseDeviceView.tsx (100%) rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/ConnectDeviceView.tsx (65%) rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/CredentialView.tsx (95%) rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/ScanQRCodeView.tsx (79%) rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/StartFlowView/CredentialOfferView.tsx (95%) rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/StartFlowView/OIDCAuthView.tsx (94%) rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/StartFlowView/PolygonAuthView.tsx (94%) rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/StartFlowView/index.tsx (86%) rename packages/dapp/src/components/{QRSessionDisplay => EncryptedSessionDisplay}/index.tsx (85%) create mode 100644 packages/dapp/src/components/EncryptedSessionProvider/index.tsx delete mode 100644 packages/dapp/src/components/QRCodeSessionProvider/index.tsx create mode 100644 packages/dapp/src/stores/encryptedSessionStore.ts delete mode 100644 packages/dapp/src/stores/sessionStore.ts delete mode 100644 packages/dapp/src/utils/prisma.ts diff --git a/.changeset/twenty-turtles-approve.md b/.changeset/twenty-turtles-approve.md new file mode 100644 index 000000000..c29b518f3 --- /dev/null +++ b/.changeset/twenty-turtles-approve.md @@ -0,0 +1,5 @@ +--- +'@blockchain-lab-um/dapp': minor +--- + +Migrate Planetscale to Supabase diff --git a/packages/dapp/.env.example b/packages/dapp/.env.example index 3ec79d0fc..75576437f 100644 --- a/packages/dapp/.env.example +++ b/packages/dapp/.env.example @@ -10,9 +10,7 @@ SEPOLIA_RPC_URL= IPFS_GATEWAY= POLYGON_RPC_URL= POLYGON_MUMBAI_RPC_URL= - -# Prisma -DATABASE_URL= += # Masca version NEXT_PUBLIC_MASCA_VERSION=v1.1.0 diff --git a/packages/dapp/package.json b/packages/dapp/package.json index c5976e96b..5f4b20c1e 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -11,7 +11,6 @@ "dev": "cross-env next dev", "dev:local": "cross-env USE_LOCAL='true' next dev", "docker:build": "docker build . -t blockchain-lab-um/dapp:latest", - "postinstall": "pnpm prisma generate --schema=./prisma/schema.prisma", "lint": "pnpm lint:next && pnpm lint:tsc && pnpm lint:prettier && pnpm lint:stylelint", "lint:fix": "next lint . --fix && prettier . --write", "lint:next": "next lint", @@ -28,7 +27,6 @@ "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", "@nextui-org/react": "^2.2.9", - "@prisma/client": "^5.7.0", "@radix-ui/react-toast": "^1.1.5", "@react-oauth/google": "^0.11.1", "@supabase/supabase-js": "^2.38.5", @@ -65,7 +63,6 @@ "next-sitemap": "^4.2.3", "next-themes": "^0.2.1", "pino-pretty": "^10.3.1", - "prisma": "^5.7.0", "qrcode.react": "^3.1.0", "qs": "^6.11.2", "react": "18.2.0", diff --git a/packages/dapp/prisma/schema.prisma b/packages/dapp/prisma/schema.prisma deleted file mode 100644 index e2ad86a3e..000000000 --- a/packages/dapp/prisma/schema.prisma +++ /dev/null @@ -1,15 +0,0 @@ -generator client { - provider = "prisma-client-js" -} - -datasource db { - provider = "mysql" - url = env("DATABASE_URL") - relationMode = "prisma" -} - -model sessions { - id String @id @default(uuid()) - data String? @db.VarChar(512) - iv String? @db.VarChar(128) -} diff --git a/packages/dapp/src/app/[locale]/app/(public)/qr-code-session/page.tsx b/packages/dapp/src/app/[locale]/app/(public)/encrypted-session/page.tsx similarity index 63% rename from packages/dapp/src/app/[locale]/app/(public)/qr-code-session/page.tsx rename to packages/dapp/src/app/[locale]/app/(public)/encrypted-session/page.tsx index a32019760..4a42a6042 100644 --- a/packages/dapp/src/app/[locale]/app/(public)/qr-code-session/page.tsx +++ b/packages/dapp/src/app/[locale]/app/(public)/encrypted-session/page.tsx @@ -1,17 +1,17 @@ import { Metadata } from 'next'; -import QRCodeSessionDisplay from '@/components/QRSessionDisplay'; +import EncryptedSessionDisplay from '@/components/EncryptedSessionDisplay'; export const metadata: Metadata = { - title: 'QR Code Session', - description: 'QR Code Session for Masca.', + title: 'Encrypted Session', + description: 'Encrypted Session for Masca.', }; export default function Page() { return (