Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- We only need a single user table, not a separate table for public and corporate users
- ### users
- - email
- - passwords
- - type (CorporateUser, PublicUser)
- You will end up with the following classes:
- ```
- class User < ApplicationRecord
- end
- class CorporateUser < User
- has_one :user_company_profile
- end
- class PublicUser < User
- end
- ```
- ### user_avatars
- - avatar_file_name
- - avatar_file_size
- - created_at
- - updated_at
- ### user_company_profile
- - user_id
- - role
- - company_id
- - employee_id
- ### user_profiles
- - last_name
- - first_name
- - middle_name
- - birthdate
- - gender
- - nationality
- ### user_phone_numbers
- - mobile_number
- - office_number
- - home_number
- ### user_addresses
- - country
- - state
- - city
- - street
- 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.
- To make things clear let's have 2 clearer tables:
- - road_vehicles
- - water_vehicles
- then we only need one type for both water and road vehicles:
- - vehicle_makes
- - vehicle_types
- - vehicle_seats
- - vehicle_models
- - vehicle_manufacturer
- - vehicle_routes
- - vehicle_trips
- * id
- * type (RoadVehicle, WaterVehicle)
- * vehicle_id
- * route_id
- * driver_id
- * conductor_id
- ```
- class VehicleTrip ..
- end
- class LandTrip < VehicleTrip
- validates :driver, :conductor, presence: true
- end
- class WaterTrip < VehicleTrip
- ## driver and conductor not needed here
- end
- ```
- * 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?
- Do we need to capture this information?
Add Comment
Please, Sign In to add comment