Relationships - multisided app

Hey guys, I am stuck with a project of mine because I cannot figure relationships out the way I need it.

In my app I have 2 types of users with 2 different logins. each login sends them to a different homescreen and functions, based on what profile they are (users or company).

What I am trying to accomplish is: Users can go on their homepage, see an item that they like and apply to get it, and so they have to fill in a form and request it. Once they have filled in the form, this goes on a collection called “requests” and they have to wait for any company to make a quotation on that item.

Once the request is sent, on the other side of the app, the company logs in and has a dashboard in which it sees the requests made by the users for the different items (listed on a custom list that shows all requests from the “requests” collection").
The company can click on each request, see the details of it (which the users has provided by filling in the form) and decide wether to accept it and quote it, or deny it. If the company decides to accept it, they would have fill in a new form on their side to make a quotation for that specific item to that specific user that requested it.
Once the company fills in the form and clicks send, it goes on a new collection called “quotations”.

Back to the user side, he/she should be able to go to his own dashboard and check if any company accepted his request and see the quotation that they have made for him, and if he likes it, he can accept it and go to the payment.

Now, my issues stands in this last paragraph: I need to display the requests on the company side, and that is done: i simply show every request on the collection on the company’s dashboard, since any company can quote any item requested (the item is some kind of consultancy), BUT I also need to show the specific quotations on the user’s side, only those which belong to him, I cannot show the quotations of “user A” to “user B” or any user, it has to be a personal dashboard.
It is basically a back and forth user-company, but I am unable to create relationships correctly so that if user A opens his dashboard, he sees his own quotations based on what the company responded.

My collections are: Users (few info and a true/false for if it is a user or a company, based on what button they click to register or log in) , Items ( with the info regarding items) , Requests (which gets populated through the form from when the user requests the item) and Quotations (which gets populated by the quotations made by the companies as a response to specific items requested by users).

How do I connect the dots to make everything work? i hope I made myself clear, and hope you can help me!
Thanks a lot in advance,


Hi @lorenzolodigiani,

You need to add the relation “quotation” - “user” into the Quotations collection (call it, say, user-buyer). A quotation could belong to one user, but user can have many quotations.
As a result, for a user you can display a list of quotations filtered by logged-in user (and this user will se only his/her quotations, but from different companies).
And for a company you can display a list of quotations filtered by logged-in user-company (different field - say, user-seller). Then a company will see all quotations belonging to it.

Hope this helps

Hi @Victor, thank you so much for your answer.

I tried something else and it seems to be working so far: Basically whenever the user fills in the form to request the item, it creates a new record on the “requests” collection which now has, let’s say, 10 fields that needs to be filled in; however when filling in the requests form, the user fills in only 5 of those fields, and the others are not shown; plus, when clicking “send”, I added an automatic true/false field saying “requests sent?” that gets automatically triggered as True.

on the company side, they receive the request and the info shown is what the user stated in the request form; if they want to make a quotation to that request, they click “make a quotation” and a form appears. That form is now simply updating the request, (not creating a new record on a different collection) and the fields that are shown are the remaining fields that where hidden fo the user’s side, plus an automatic true/false asking “quotation made?”.
Once they send the form, I created a dashboard for the user with a filter “Logged in user- requests” and custom filter "which is “quotation made? is true”, so that they only see a their request and its quotation made by the company.

By doing this, i don’t have to create a new collection, rather I only have one for requests and it gets updated by each party with their own fields.

Hoping that you understood my very messy explanation, do you think it makes sense and that it could work on the long run?

Hi @lorenzolodigiani,

This is a good solution. If you have only 5 extra fields to convert Request to Quotation - no need for extra collection as I think.
The only potential downside in the long run which I can see - you will not be able to create several quotations for a single request (or combine several requests into one quotation). But as I understand this is not an issue for you :slight_smile:

Best regards, Victor.

Shoot! I indeed need to have several quotations for the same request, from different companies.
Basically for every request, companies would have to “compete”, and the user should have the chance to see different quotations and choose the one that fits best with his needs… :cold_sweat:

didn’t think of that, I might have to go for the relationships path afterall :sweat_smile:

Hi @lorenzolodigiani,

Then you can create a 1:many relationship request<-> quotations. And may be you don’t need user in quotation - you can get the user info from linked request.

Best regards,

hi @Victor, i think I solved it as you said! thank you very much, You’ve been very helpful! :slight_smile:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.