In a login system, will all tables be connected with the user table?

Asked

Viewed 173 times

-3

I am creating a system for barbershop and would like to make a login system for each user, where the user would register his trade, employees, etc.

In my database I have the barber and customer table, between these two tables is the scoring table, which connects the two. To create a login system I will have to create a table named user.

Well, does this table have to be connected with all other tables? Because a user’s information can only be seen by this user.

  • If a table can only be seen by the user himself then yes, it has to have a reference to which user it belongs. The question is: will both barber and client be users? If so, how do you plan to associate them?

  • the barber table will have the information concerning the barber, the same way the client, the table marking will have the key connecting barber and client, containing the scheduled time, the day etc... The user is the one who will have the permission to access the program and do the management. Will this user table also have to be associated with all the others? Remember, only the user will enter the system, the person who wants to cut hair not.

  • So user, barber and customer are independent things? How will you define which user belongs to the relationship? The one who register?

  • exactly, the one who registers. The user is the one who registers, he q will be responsible for registering the barbers and customers.

  • That question didn’t make much sense to me. By default nothing is connected to anything, unless you make a query that calls two interconnected tables.

1 answer

-1

That depends on what you want, I imagine three situations:

  • Customers can schedule schedules, being the responsibility of the application to check if that time is valid and available. In this case there was no user table, the access data would be in the client table. The list of who will cut the client’s hair will be on the dial table, the customer will be who is connected and the choice of barber can be the customer or a random detre available

  • The barbers are responsible for scheduling the times, in this case the validation of the times is important but not essential as in the previous option, also it is not necessary a user table, the access data would be in the barber table. The list of who will cut the hair of the customer will be in the table marking, the customer will be selected and the barber will be the one who is logged in or else the barber will be able to choose some other colleague, if it is busy at the moment

  • Those who register the data are not customers, nor (at least not necessarily) a barber (maybe a receptionist) or you just want to have a single user so the system is not open. In this case when marking a cut, the user will choose the barber and the customer:

    • But it is not necessary any relationship between the user table and the others, maybe it is useful to save who marked what, in this case may even have a relationship between users and tags

    • If you have more than one type of employee, for example, barbers and receptionists, maybe you should have a single table (employee) instead of two (user and barber), this being with a function column, position or something like that


If it is a system where there will be users who will register the data of their trades, it is necessary that the barber tables and customers are related to users, but the same need not be related to markings (although it facilitates some searches), if fetching a user’s markings can be done through the barbers table

This is because a user cannot read, register, change or delete data from other users. Imagine having 100 clients on your system, and suddenly switching to 0 or having 1000 more with exactly the same data polluting the screen and making reports have wrong data

  • the barber and client table does not represent the user. These tables are only used to store information of each one. The user table I say is who will operate. Let me give you an example: the guy picks up the pc, opens the program, creates an account, registers the customers who visit his barbershop, registers the barbers who work there. Only one person will operate, the user is the user table and my question is: I need to associate this user table with the other tables?

  • So understand: user 1: cliente1 as 15h, cliente2 as 21h, cliente3 as 22h || user 2: cliente1 13h cliente2 12h cliente3 14h. The user one has marked clients and when he logs in, he does not want to see in his agenda customers of another user.

  • Ata, the system is not for a specific barbershop, but for anyone, each of them having their own data, this was not clear to me. I edited the answer

  • So there is no other way, the user table will have to be related to barber and customer?

  • Yes, after all that customer and that barber is from each user

  • I thought about doing this, I asked why I thought I would have another more efficient way. Thanks friend for the answer

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.