From 2e747b3c730a8fef9926c3fe6192da2fa79705d8 Mon Sep 17 00:00:00 2001 From: NaviTheCoderboi <102732282+NaviTheCoderboi@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:26:38 +0530 Subject: [PATCH] :heavy_plus_sign: - added svelte-sonner and setup prisma client --- package.json | 7 +- pnpm-lock.yaml | 128 ++++++++++++++++++++++++++++ prisma/schema.prisma | 37 ++++---- src/lib/components/Boxbg.svelte | 2 - src/lib/utils/prisma.ts | 13 +++ src/routes/auth/signup/+page.svelte | 4 - 6 files changed, 166 insertions(+), 25 deletions(-) create mode 100644 src/lib/utils/prisma.ts diff --git a/package.json b/package.json index 692b5e9..57be226 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@sveltejs/kit": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0", "@types/eslint": "^8.56.0", + "@types/ws": "^8.5.10", "@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/parser": "^7.0.0", "eslint": "^8.56.0", @@ -37,6 +38,8 @@ "type": "module", "dependencies": { "@internationalized/date": "^3.5.2", + "@neondatabase/serverless": "^0.9.0", + "@prisma/adapter-neon": "^5.11.0", "@prisma/client": "5.11.0", "autoprefixer": "^10.4.18", "jsonwebtoken": "^9.0.2", @@ -44,6 +47,8 @@ "postcss": "^8.4.35", "svelte-ripple-action": "^1.0.6", "sweetalert2": "^11.10.7", - "tailwindcss": "^3.4.1" + "tailwindcss": "^3.4.1", + "valibot": "^0.30.0", + "ws": "^8.16.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d59b6ee..77bc137 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,12 @@ dependencies: '@internationalized/date': specifier: ^3.5.2 version: 3.5.2 + '@neondatabase/serverless': + specifier: ^0.9.0 + version: 0.9.0 + '@prisma/adapter-neon': + specifier: ^5.11.0 + version: 5.11.0(@neondatabase/serverless@0.9.0) '@prisma/client': specifier: 5.11.0 version: 5.11.0(prisma@5.11.0) @@ -32,6 +38,12 @@ dependencies: tailwindcss: specifier: ^3.4.1 version: 3.4.1 + valibot: + specifier: ^0.30.0 + version: 0.30.0 + ws: + specifier: ^8.16.0 + version: 8.16.0 devDependencies: '@melt-ui/pp': @@ -52,6 +64,9 @@ devDependencies: '@types/eslint': specifier: ^8.56.0 version: 8.56.5 + '@types/ws': + specifier: ^8.5.10 + version: 8.5.10 '@typescript-eslint/eslint-plugin': specifier: ^7.0.0 version: 7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)(typescript@5.4.2) @@ -461,6 +476,12 @@ packages: svelte: 4.2.12 dev: true + /@neondatabase/serverless@0.9.0: + resolution: {integrity: sha512-mmJnUAzlzvxNSZuuhI6kgJjH+JgFdBMYUWxihtq/nj0Tjt+Y5UU3W+SvRFoucnd5NObYkuLYQzk+zV5DGFKGJg==} + dependencies: + '@types/pg': 8.6.6 + dev: false + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -490,6 +511,16 @@ packages: resolution: {integrity: sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==} dev: true + /@prisma/adapter-neon@5.11.0(@neondatabase/serverless@0.9.0): + resolution: {integrity: sha512-AcWMpyRrHk5yEqHELui3RrFAz3OtvZlyjxWAvnU6NJ6hfEUsLWoL7jM7rZXKQLLqmTeowXexmo1L6vCqaWSURw==} + peerDependencies: + '@neondatabase/serverless': ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 + dependencies: + '@neondatabase/serverless': 0.9.0 + '@prisma/driver-adapter-utils': 5.11.0 + postgres-array: 3.0.2 + dev: false + /@prisma/client@5.11.0(prisma@5.11.0): resolution: {integrity: sha512-SWshvS5FDXvgJKM/a0y9nDC1rqd7KG0Q6ZVzd+U7ZXK5soe73DJxJJgbNBt2GNXOa+ysWB4suTpdK5zfFPhwiw==} engines: {node: '>=16.13'} @@ -506,6 +537,12 @@ packages: /@prisma/debug@5.11.0: resolution: {integrity: sha512-N6yYr3AbQqaiUg+OgjkdPp3KPW1vMTAgtKX6+BiB/qB2i1TjLYCrweKcUjzOoRM5BriA4idrkTej9A9QqTfl3A==} + /@prisma/driver-adapter-utils@5.11.0: + resolution: {integrity: sha512-C2Qa/HZXZNwDBZCHJxlV4eibqXakbOBLd+mUeNCxSfaM8yi8Qi8zToN8Kb3M60Kr1ymr+tzzw/wVqYIfIfUiXw==} + dependencies: + '@prisma/debug': 5.11.0 + dev: false + /@prisma/engines-version@5.11.0-15.efd2449663b3d73d637ea1fd226bafbcf45b3102: resolution: {integrity: sha512-WXCuyoymvrS4zLz4wQagSsc3/nE6CHy8znyiMv8RKazKymOMd5o9FP5RGwGHAtgoxd+aB/BWqxuP/Ckfu7/3MA==} @@ -729,6 +766,19 @@ packages: resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: true + /@types/node@20.11.30: + resolution: {integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==} + dependencies: + undici-types: 5.26.5 + + /@types/pg@8.6.6: + resolution: {integrity: sha512-O2xNmXebtwVekJDD+02udOncjVcMZQuTEQEMpKJ0ZRf5E7/9JJX3izhKUcUifBkyKpljyUM6BTgy2trmviKlpw==} + dependencies: + '@types/node': 20.11.30 + pg-protocol: 1.6.0 + pg-types: 2.2.0 + dev: false + /@types/pug@2.0.10: resolution: {integrity: sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==} dev: true @@ -737,6 +787,12 @@ packages: resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} dev: true + /@types/ws@8.5.10: + resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} + dependencies: + '@types/node': 20.11.30 + dev: true + /@typescript-eslint/eslint-plugin@7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)(typescript@5.4.2): resolution: {integrity: sha512-mdekAHOqS9UjlmyF/LSs6AIEvfceV749GFxoBAjwAv0nkevfKHWQFDMcBZWUiIC5ft6ePWivXoS36aKQ0Cy3sw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1972,6 +2028,26 @@ packages: estree-walker: 3.0.3 is-reference: 3.0.2 + /pg-int8@1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + dev: false + + /pg-protocol@1.6.0: + resolution: {integrity: sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==} + dev: false + + /pg-types@2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.0 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + dev: false + /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} @@ -2092,6 +2168,33 @@ packages: picocolors: 1.0.0 source-map-js: 1.0.2 + /postgres-array@2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + dev: false + + /postgres-array@3.0.2: + resolution: {integrity: sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==} + engines: {node: '>=12'} + dev: false + + /postgres-bytea@1.0.0: + resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==} + engines: {node: '>=0.10.0'} + dev: false + + /postgres-date@1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + dev: false + + /postgres-interval@1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + dependencies: + xtend: 4.0.2 + dev: false + /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -2580,6 +2683,9 @@ packages: hasBin: true dev: true + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + /update-browserslist-db@1.0.13(browserslist@4.23.0): resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true @@ -2600,6 +2706,10 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + /valibot@0.30.0: + resolution: {integrity: sha512-5POBdbSkM+3nvJ6ZlyQHsggisfRtyT4tVTo1EIIShs6qCdXJnyWU5TJ68vr8iTg5zpOLjXLRiBqNx+9zwZz/rA==} + dev: false + /vite@5.1.6: resolution: {integrity: sha512-yYIAZs9nVfRJ/AiOLCA91zzhjsHUgMjB+EigzFb6W2XTLO8JixBCKCjvhKZaye+NKYHCrkv3Oh50dH9EdLU2RA==} engines: {node: ^18.0.0 || >=20.0.0} @@ -2675,6 +2785,24 @@ packages: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} dev: true + /ws@8.16.0: + resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + + /xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + dev: false + /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 5beee74..bdd4c8b 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -5,29 +5,30 @@ // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" + previewFeatures = ["driverAdapters"] } datasource db { - provider = "postgresql" - url = env("DATABASE_URL") + provider = "postgresql" + url = env("DATABASE_URL") + directUrl = env("DIRECT_URL") } - -model User{ - id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid - name String - email String @unique - DOB DateTime - languages Languages - avatarImg String? +model User { + id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid + name String + email String @unique + DOB DateTime + languages Languages + avatarImg String? followersId String[] - followers User[] @relation("Followers") - following User[] @relation("Followers") - gender Gender - OAuth Boolean - created DateTime @default(now()) - updated DateTime @default(now()) + followers User[] @relation("Followers") + following User[] @relation("Followers") + gender Gender + OAuth Boolean + created DateTime @default(now()) + updated DateTime @default(now()) } enum Gender { @@ -36,7 +37,7 @@ enum Gender { Other } -enum Languages{ +enum Languages { JS PYTHON PHP diff --git a/src/lib/components/Boxbg.svelte b/src/lib/components/Boxbg.svelte index 9bb6ac2..af8ea4b 100644 --- a/src/lib/components/Boxbg.svelte +++ b/src/lib/components/Boxbg.svelte @@ -1,13 +1,11 @@