Database tables for tennis court booking system

2.8k views Asked by At

I'm trying to find the best implementation of class diagram and database structure for football court management. The system have three actors:

  1. Super Admin : manage everything with all privileged (web back-office)
  2. Court Owner : can create a Football Club that may have more than one stadium (web back-office)
  3. Player: who can review a club and book an available stadium (mobile)

My problems are :

  1. Since the three actors have the same properties, I don't need the "extend" relation between "user" and "owner", "player", "admin", but also I can't only have the class "user" because not all users can submit a review and only the owner can add a club... so how to manage the privilege of different users who have the same properties ? and do I need the User group table that can help me to know the group of each user ("owner", "admin", "player") ? (I see that Joomla and Wordpress use a user group table)

  2. The Club can have many stadiums (courts) in the majority of cases they are identical so should In my solution bellow is it correct to have two classes "club" and "stadium" and put the common information (city , latitude, longitude) inside the class "club" ?

  3. Take in consideration that player can book a stadium of a club and the club have another available stadiums that can be booked is my solution bellow correct ?

Please I need your guidance and suggestion of the best implementation for a football clubs management where:

  1. There is three actors ("player", "admin", "club owner")
  2. Each actor have different privileged (only owner can create a club, only player can book and review...)
  3. Avery Club can have many stadiums and player can book one of them or many, and we need to keep track of the availability of other stadiums of the same club.

    Here is what I have tried:

    Class diagram sport club management

Edit link : https://creately.com/diagram/iaqn8ddo/T1IfqHRrhGcHYPihjOwMIQSwM%3D

View Link : http://creately.com/diagram/example/iaqn8ddo/Copy%2Bof%2BTakwira

1

There are 1 answers

4
qwerty_so On BEST ANSWER

Does not look too bad.

  1. You already have classes for the actors. So that's done.
  2. The "privileges" can be modeled by assigning the specialized classes the according methods. That is: Owner has a createClub() method and Player has book() etc.
  3. You need a Booking class that keeps track of the bookings made by Player

One observation: the composition from Stadium (you have a typo in the name) to SportsClub does not seem to make sense. A club is not composed of stadiums. In best case it's composed of members. Replace it with an association and use ownedStadium as role.