diff --git a/lib/prisma/add-share.ts b/lib/prisma/add-share.ts
new file mode 100644
index 0000000..821c110
--- /dev/null
+++ b/lib/prisma/add-share.ts
@@ -0,0 +1,16 @@
+"use server";
+import { Post, PostShare } from "@prisma/client";
+import postgres from "../postgres";
+
+export const addShare = async (postId: PostShare["postId"]) => {
+ if (!postId) return;
+ try {
+ await postgres.postShare.create({
+ data: {
+ postId,
+ },
+ });
+ } catch (error) {
+ console.log(error);
+ }
+};
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 19a6e3a..3dc770d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -104,16 +104,12 @@
"zod": "^3.22.2"
},
"devDependencies": {
- "@tailwindcss/typography": "^0.5.10",
- "@types/formidable": "^3.4.3",
- "@types/pg": "^8.10.7",
- "@types/uuid": "^9.0.4",
- "dns": "file:./app/mock/dns"
+ "@tailwindcss/typography": "^0.5.10"
}
},
"app/mock/dns": {
"version": "3.1.0",
- "dev": true
+ "extraneous": true
},
"node_modules/@aashutoshrathi/word-wrap": {
"version": "1.2.6",
@@ -2856,15 +2852,6 @@
"@types/send": "*"
}
},
- "node_modules/@types/formidable": {
- "version": "3.4.4",
- "resolved": "https://registry.npmjs.org/@types/formidable/-/formidable-3.4.4.tgz",
- "integrity": "sha512-0yRhMir7fdWIGfiCoYcqF6fQ2NXpb/0WwWQzg6n+K4IEIeqDVDDiDZfgfLJpi1Tbj8nvVKOAcyLVKAT3f0ZTiw==",
- "dev": true,
- "dependencies": {
- "@types/node": "*"
- }
- },
"node_modules/@types/hast": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.7.tgz",
@@ -2938,17 +2925,6 @@
"resolved": "https://registry.npmjs.org/@types/nprogress/-/nprogress-0.2.2.tgz",
"integrity": "sha512-2wLrSJXLztGmr7wXwM0hA/wuIOY9DznVdd+ZFofHOiXcj9JnVt+2ZeLRJ7v5ZVlmheSkUOSg3Q3O4Ce7yji79A=="
},
- "node_modules/@types/pg": {
- "version": "8.10.7",
- "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.7.tgz",
- "integrity": "sha512-ksJqHipwYaSEHz9e1fr6H6erjoEdNNaOxwyJgPx9bNeaqOW3iWBQgVHfpwiSAoqGzchfc+ZyRLwEfeCcyYD3uQ==",
- "dev": true,
- "dependencies": {
- "@types/node": "*",
- "pg-protocol": "*",
- "pg-types": "^4.0.1"
- }
- },
"node_modules/@types/prop-types": {
"version": "15.7.9",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.9.tgz",
@@ -3027,12 +3003,6 @@
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.9.tgz",
"integrity": "sha512-zC0iXxAv1C1ERURduJueYzkzZ2zaGyc+P2c95hgkikHPr3z8EdUZOlgEQ5X0DRmwDZn+hekycQnoeiiRVrmilQ=="
},
- "node_modules/@types/uuid": {
- "version": "9.0.6",
- "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.6.tgz",
- "integrity": "sha512-BT2Krtx4xaO6iwzwMFUYvWBWkV2pr37zD68Vmp1CDV196MzczBRxuEpD6Pr395HAgebC/co7hOphs53r8V7jew==",
- "dev": true
- },
"node_modules/@typescript-eslint/parser": {
"version": "6.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.8.0.tgz",
@@ -4644,10 +4614,6 @@
"redux": "^4.2.0"
}
},
- "node_modules/dns": {
- "resolved": "app/mock/dns",
- "link": true
- },
"node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@@ -9015,12 +8981,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/obuf": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz",
- "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==",
- "dev": true
- },
"node_modules/oidc-token-hash": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz",
@@ -9314,15 +9274,6 @@
"node": ">=4.0.0"
}
},
- "node_modules/pg-numeric": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz",
- "integrity": "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==",
- "dev": true,
- "engines": {
- "node": ">=4"
- }
- },
"node_modules/pg-pool": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.1.tgz",
@@ -9336,24 +9287,6 @@
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.0.tgz",
"integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q=="
},
- "node_modules/pg-types": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-4.0.1.tgz",
- "integrity": "sha512-hRCSDuLII9/LE3smys1hRHcu5QGcLs9ggT7I/TCs0IE+2Eesxi9+9RWAAwZ0yaGjxoWICF/YHLOEjydGujoJ+g==",
- "dev": true,
- "dependencies": {
- "pg-int8": "1.0.1",
- "pg-numeric": "1.0.2",
- "postgres-array": "~3.0.1",
- "postgres-bytea": "~3.0.0",
- "postgres-date": "~2.0.1",
- "postgres-interval": "^3.0.0",
- "postgres-range": "^1.1.1"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/pg/node_modules/pg-types": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
@@ -9581,51 +9514,6 @@
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="
},
- "node_modules/postgres-array": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz",
- "integrity": "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==",
- "dev": true,
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/postgres-bytea": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz",
- "integrity": "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==",
- "dev": true,
- "dependencies": {
- "obuf": "~1.1.2"
- },
- "engines": {
- "node": ">= 6"
- }
- },
- "node_modules/postgres-date": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-2.0.1.tgz",
- "integrity": "sha512-YtMKdsDt5Ojv1wQRvUhnyDJNSr2dGIC96mQVKz7xufp07nfuFONzdaowrMHjlAzY6GDLd4f+LUHHAAM1h4MdUw==",
- "dev": true,
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/postgres-interval": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz",
- "integrity": "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==",
- "dev": true,
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/postgres-range": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.3.tgz",
- "integrity": "sha512-VdlZoocy5lCP0c/t66xAfclglEapXPCIVhqqJRncYpvbCgImF0w67aPKfbqUMr72tO2k5q0TdTZwCLjPTI6C9g==",
- "dev": true
- },
"node_modules/preact": {
"version": "10.18.1",
"resolved": "https://registry.npmjs.org/preact/-/preact-10.18.1.tgz",