UPDATE! It’s fixed… Not sure how. But I tried deleting the indexes and added it to roles again and that did it! Will be releasing a blog about creating a serverless website with a comment system on my new website! Thanks for any future help I might get:D
Hi! I am trying to make a comment system with the ability to reply to comments. I have come pretty far but I am stuck and have no idea why this does not work. Could someone please give me some guidance? Thanks!
Query(
Lambda(
"article",
Let(
{
comments: Map(
Paginate(Match(Index("comments_by_article"), Var("article"))),
Lambda(
"comment",
Let(
{
commentRef: Select("ref", Get(Var("comment"))),
comment: Get(Var("comment")),
name: Select(["data", "name"], Var("comment")),
body: Select(["data", "body"], Var("comment")),
replies: Map(
Paginate(Match(Index("replies_by_comment"), Var("commentRef"))),
Lambda("reply", Get(Var("reply")))
)
},
{ ref: Var("commentRef"), name: Var("name"), body: Var("body"), replies: Var("replies") }
)
)
)
},
Var("comments")
)
)
)
This is the result of calling the function:
Call(Function("GetCommentsWithReplies"), "framework-of-the-future")
{
data: [
{
ref: Ref(Collection("Comments"), "304543435045470785"),
name: "Name",
body: "body",
replies: {
data: []
}
},
{
ref: Ref(Collection("Comments"), "304545450038395457"),
name: "Name",
body: "body",
replies: {
data: []
}
}
]
}
If I am not totally blind… I have made sure that all the refs exists and are correct.
Thanks again!