Make a list/carousel of images from a document->document reference->list of image urls

Database & APIs

Hello,

I'm building a social network, which has a data scheme named "post". Each post has an id (post_id), and a list of users who liked the post. Each user has a profile image. So in total, the references look like this:

post -> list<user> -> profile_image

Given a post, how can I create a carousel of images from its users?
In other words, how can I display the profile image of each user that belongs to a specific post?

Also, I tried checking the docs but couldn't find much information about how document references work in the settings of widgets and queries. For example, I know there's a convenient way to create a subcollection of "post" and present all the images of the subcollections in a carousel. But this isn't perfect for me, because not all users create posts. Is it also possible to do it with the document references "post" pointing to instead of sub-collections?

What have you tried so far?

I tried creating query type "doc from reference" and also "query collections", and add collection "post" and from "post" add "user" and then add "image_url" but it doesn't let me add the image url. So instead I added "user" query collections, and tried using a filter to take only the users that belong to a specific post.

At first, I had the "post" point to a list of users (list of document references), and to filter for a specific user I tried to check if he was in the post's users list. But "user" doesn't contain "self-reference" so I don't see how to check if a specific "user" is in the list.
Finally, the least favored option I am trying to do is to add another list of integers called "user id" (uid) to each post, which will represent the users. Then, since each user has an id, I'm checking to see if it's in the post's list. But now I'm encountering a different problem - it asks me to "limit" the list. Instead of checking if a uid is in the entire list, it asks me to choose values from the list (at specific indexes, etc.) see screenshots below.
If possible though, I would rather know how I can use the document references instead of a list of user ids, because it feels more right.

Did you check FlutterFlow's Documentation for this topic?
Yes
1
1 reply