Guest User

Untitled

a guest
Jun 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. We only need a single user table, not a separate table for public and corporate users
  2.  
  3. ### users
  4. - email
  5. - passwords
  6. - type (CorporateUser, PublicUser)
  7.  
  8. You will end up with the following classes:
  9. ```
  10. class User < ApplicationRecord
  11. end
  12.  
  13. class CorporateUser < User
  14. has_one :user_company_profile
  15. end
  16.  
  17. class PublicUser < User
  18. end
  19. ```
  20.  
  21. ### user_avatars
  22. - avatar_file_name
  23. - avatar_file_size
  24. - created_at
  25. - updated_at
  26.  
  27. ### user_company_profile
  28. - user_id
  29. - role
  30. - company_id
  31. - employee_id
  32.  
  33. ### user_profiles
  34. - last_name
  35. - first_name
  36. - middle_name
  37. - birthdate
  38. - gender
  39. - nationality
  40.  
  41. ### user_phone_numbers
  42. - mobile_number
  43. - office_number
  44. - home_number
  45.  
  46. ### user_addresses
  47. - country
  48. - state
  49. - city
  50. - street
  51.  
  52. By definition a vehicle is a machine that would transport a cargo from point a - b, so by definition a vessel is also a vehicle.
  53. To make things clear let's have 2 clearer tables:
  54. - road_vehicles
  55. - water_vehicles
  56.  
  57. then we only need one type for both water and road vehicles:
  58.  
  59. - vehicle_makes
  60. - vehicle_types
  61. - vehicle_seats
  62. - vehicle_models
  63. - vehicle_manufacturer
  64. - vehicle_routes
  65. - vehicle_trips
  66. * id
  67. * type (RoadVehicle, WaterVehicle)
  68. * vehicle_id
  69. * route_id
  70. * driver_id
  71. * conductor_id
  72.  
  73. ```
  74. class VehicleTrip ..
  75. end
  76.  
  77. class LandTrip < VehicleTrip
  78. validates :driver, :conductor, presence: true
  79. end
  80.  
  81. class WaterTrip < VehicleTrip
  82. ## driver and conductor not needed here
  83. end
  84. ```
  85.  
  86. * For the routes design, let's say the starting route is Leyte, then the boat would stop at Bohol to fetch more passengers, then it goes to cebu. What should be the route definition here? Should we define two routes? Leyte-Bohol, Bohol-Cebu? or this is defined as a single route?
  87. Do we need to capture this information?
Add Comment
Please, Sign In to add comment