Becoming a No-coder - Part 6 (Creating Login) - AppGyver and Xano

Hi Steve,
Bravo and thanks for sharing more tuto about Xano!

I’ve been working on the DB schema related to the messaging system. Here are my findings so far. My concern/hesitation is about the authorID column, would that work?
image

My first thought is around the User and Consultant having separate tables. This would mean that there will be overlapping/duplicate IDs between the User table and the Consultant table. The id column for each table starts at 1 and increments for each new entry, so you will have users and consultants with the same id. I mention that since you have the authorID column and won’t know which user is the author if both the user and the consultant have the same ID from their table (user = 5; consultant = 5).

You can avoid that by having one user table and have a column that identifies the type or a column that is a boolean and is labeled “consultant”. Either way should work. That will guarantee that you don’t have the same id between a user and a consultant because they will be in the same table and can’t have duplicate IDs.

Also, your table model makes the assumption that there can only be one user and one consultant in a Thread. I am not saying that is wrong, I just want to make sure that is your intent.

I have included the tables that I use for my in-app messaging, in case that helps you consider your design. Let me know if you have any additional questions based on this.

Thanks for your speedy reply.

I thought that I a DB generating random IDs made out of 12 numerical+alphabetical characters would be best practice. Is the ID increment system really safe.

Also, I’m not understanding the purpose of the Message_Participant table.

If I merge user and consultant as you suggest, then I feel I’d be fine with this table result (where user 1 is a user and user 2 is a consultant in that example), which is useful for users checking their message board:
image

You can use the Utility Function that generates a GUID and use that in your user and consultant tables to give them guaranteed unique values. You would still have the autogenerated id from Xano, you could just not use it.

I am using the message participant table as a way to allow more than 2 people to be involved in a chat. By abstracting the users associated with a message to a separate table I can have as many people as I want involved. Also, I have a flag/boolean for the person who sent the message. By default, that means the others are the receivers of that message.

So, I group the messages by a conversation and attach the messages to the people in the chat. I don’t know if it is the best way(or the only way) but it is working pretty well for my use case. For me, I am modelling after a standard messaging app where you can have 2 or more people in the chat.

1 Like

Hi Steve,
I’m getting closer thanks to you and the help of a visual DB design tool.
Now, I’m actually wondering how the boolean data type works in terms of table relationships. Some of the users are consultants, which they will tell with boolean Yes(1) or No(0). But how does that setup translate into relationship between the two tables? What setting may I be missing here?

image

I am not sure that the is_consultant boolean in the user table does much for you. You appear to have the relationship between consultant and user represented by the user_id column in the consultant table.

I think I made a prior reference about using a boolean for user/consultant if you were to have the users and consultants represented by one table.

Have you been able to build out any of the structure that you have defined? It would be great to see your screens and/or apis! I am excited to see how you are progressing…

hi! thank you for the simple yet amazing tutorial :slight_smile:

i’d like to ask whether if you know how to use google/ facebook oauth from xano to use in appgyver for signup/login purposes?