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,