Structuring app with multiple relationships

Hi there,

I’m working on my first Adalo app, I took the time to read the resources and watch the tutorial videos and best practices.
However, I have a little trouble knowing how to go about doing the next project the right way because I’m afraid of starting off on the wrong foot in the management of my database with my different relationships. It’s been bothering me a bit for a while and I’m too new to Adalo to already have the right reflexes.

My idea is to create a system of projects containing a number of events with different participants:

Each USER can create a PROJECT.
When he creates a PROJECT, he becomes its “Owner” and he is the only one capable of deleting this project.
In each PROJECT, USERS can be added and assigned either the “Manager” role or the “Guest” role.
If a project participant is “Manager”, they will be able to edit project information and members.
The owner of a project is automatically “Manager”.
If a user is “Guest” they will only have read information access.
“Managers” can create EVENTS in each PROJECT and assign USERS for each EVENT from the list of PROJECT member USERS.
There can be several “Managers” and several “Guests” per project but only one “Owner”.

Each of the projects are independent of each other, which means that my user JOHN can create one or more projects in which he is Manager and be part of other projects in which he is Guest.

Here is if one of you has some tips for me to go in the right structuring way.

Thanks a lot !

Hi @binary ,

Welcome!

Projects collection would need relationship to users as creator, and another relationship field to users as well, as members.

In the users collection, add a number field as role, to identify which one is manager or owner or guest or any other roles.

Check the original Chat template that can be accessed when you want to add new app.

Conversations collection is similar to your projects collection here.

1 Like

Hi @Yongki

Many thanks for your quick return !
Unfortunately I’m afraid it’s a little more complicated than that because my USERS can have different roles depending on the PROJECTS.
To make it more understandable, here is an example:

We see here that Jimmy is “Guest” on PROJECT Alpha but is “Owner” and “Manager” on PROJECT Beta at the same time.

For the “Owner” role, a One-to-Many relationship between my PROJECTS and my USERS seems fine to me. A USER can have multiple PROJECTS but each PROJECT only has one “Owner”.

Where it gets complicated is for the “Manager” and “Guest” roles, I have a little more difficulty seeing how to establish my relationships in order to assign each USER a different member role per PROJECT.

I looked at the Chat Template and what I would need is that within “Members” I have two subcategories “Manager” and “Guests”.

Maybe I’m thinking wrong, I don’t know. I don’t have Adalo’s logic yet to do what I want :nerd_face:

Hello @binary,

Just adding some information beside for the great reply by Yongki!

Made some videos : Projects and Events - Part 1.mp4 on Vimeo , Projects and Events - Part 2.mp4 on Vimeo

The app that used in the videos : Projects and Events

Thank you

1 Like

Instead of using M-to-M between projects and users, you can have 1-to-M (lets call this project roles) and will get benefit adding extra fields, such as roles, it can be text or numbers.

But when user open the project, there should be nested list to get the role that they are supposed to be in the above mentioned 1-to-M collection (project roles)

1 Like

Hello @Yongki , @dilon_perera

Already a huge thank you to both of you for your help and the precious time you have devoted to your answers. Thank you very much for the videos it helped me enormously to understand the logic of adalo.
Small question to be sure to have understood everything but we agree that it is not possible to add two conditions for the display of a custom list?

Let me explain :
I would like to display a list of users who are members of the same projects as the logged in user, which would give if I understood correctly:
“Current User > Projects (Guests)” Contains “LoggedIn User” AND “Current User > Projects (Managers)” Contains “LoggedIn User”

Unfortunately, I tried to apply the following filter to my USER list:
“Current User > Projects (Guests)” Contains …… but I can’t select “LoggedIn User”.

There’s something I don’t understand…

Thank you once again!

Your welcome :+1:

You can add many filters as AND or OR or both!

You should select Current User > Projects ( Guests ) > Guests > Contains > Logged in user!

1 Like

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