- Reply id: {post.id} Replied at: {post.createdAt}
- {
- event.preventDefault();
- document.getElementById(`bottom`).scrollIntoView(true);
- setReplying(post.id);
- }} to={`#bottom`}
- >Reply
-
-
+
+
Reply id: {post.id} Replied at: {post.createdAt}
+
{
+ event.preventDefault();
+ document.getElementById(`bottom`).scrollIntoView(true);
+ setReplying(post.id);
+ }} to={`#bottom`}
+ >Reply
+
+
+ {post?.replies?.map(reply =>
+ -
+ {
+ event.preventDefault();
+ document.getElementById(`${reply.id}`).scrollIntoView(true);
+ }} className="text-ctp-teal hover:text-ctp-sky hover:underline" to={`#${reply.id}`}>{reply.id}
+
+ )}
+
+
{post.replyingTo ? {
event.preventDefault();
document.getElementById(`${post.replyingTo}`).scrollIntoView(true);
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 5d93733..22afcc8 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -29,6 +29,8 @@ model Post {
comment String
imageName String?
replyingTo Int?
+ Reply Post? @relation("d", fields: [replyingTo], references: [id])
+ replies Post[] @relation("d")
post Thread @relation(fields: [postId], references: [id])
postId Int