Project is using CMake as a building tool. You can download CMake from here.
Run following command to build the project:
cmake --build --target PSS_HomeWork5_NoskovN
Project has three main modules:
- Gateway - includes
AdminGateway, PassengerGateway, DriverGateway
. - System - includes main
System class (backend of the program)
. - User - includes classes
Admin, Driver and Passenger
.
System.h
contains 'System' class, which is responsible for database interaction and management of user's classes
*Gateway
classes contain the methods for passing values and queries from users to the System
Admin.h, Passenger.h, Driver.h
are the classes which contain info about the user - password, login, name, history and etc.
Methods in passenger gateway:
LogIn()
- login passengerorderHistory()
- get order history of usercreateOrder()
- create and add order to available ordersacceptRide()
- accept or decline the conditions (price) of ordergetCoordinates()
- output the relative position during the ridelookForPayment()
- list the payment methodsaddPayment()
- add the payment method to the list of payment methodsaddPinnedAddress
- save the address to the pinned addresseslookForPinnedAddresses
- list the pinned addresses
Fields in Passenger gateway:
System system
- main system to connect and send queries
Methods in DriverGateway:
LogIn()
- login driverlookForOrders()
- check the available ordersacceptOrder()
- take one of the available ordersendOrder()
- finishes the ride and closes current orderaddCar()
- adds another car to the driver
Fields in DriverGateway:
System system
- main system to connect and send queries
blockPassenger()
- blocks user from placing any ordersunBlockPassenger()
- unblocks userblockDriver()
- blocks from checking new orders and accepting ordersunBlockDriver()
- unblocks drivervalidateCar()
- validate new car from queuelookForCarsInQueue()
- lists cars to be validated by adminlookForAllPassengers()
- lists all passengerslookForAllActiveOrders()
- lists all orderslookForAllDrivers
- lists all drivers
Fields in DriverGateway:
System system
- main system to connect and send queries
Class Passenger
has following fields:
isBlocked
- status of user (blocked/not blocked)id
- unique identifier of the passengerlogin
- login of the passengerpassword
- password of passenger.rating
- rating of the passenger (from 1 to 5)name
- name of passenger.paymentMethods
- vector containing payment methodsorderHistory
- vector of previous orderspinnedAdresses
- vector of pinned addressesactiveOrder
- current active orderproposedOrder
- order offered by system to be accepted/declinedpropose
- status of the proposed orderactive
- status of user (in a ride or not)
Class Driver
has following unique fields:
cars
- vector of driver's carschosenCar
- car currently in useproposedOrders
- available orders from passengers
Other fields are the same as in Passenger
class.
Has only three fields - id, login and password
Class car contains info about the car, such as model, number, color, type, and etc.
Class order contains info about the person who placed this order, time, number, and etc.
Project is based on the relationship between 4 entities:
- System - backend implementation
- User - user imitation
- Gateway - protective module, responsible for safe interaction between System and Users
- Database - data storage
User ←→ Gateway ←→ System ←→ Database
Implemented using 5 txt files:
- Passengers.txt - stores all data connected to passengers
- Drivers.txt - stores all data connected to drivers
- Admins.txt - stores all data connected to admins
- Orders.txt - stores all the orders which are currently wasn't accepted by drivers yet
- CarQueue.txt - cars not yet validated by admins
In ascending order:
Ecomomy → Comfort → ComfortPlus → Business
Type | Free Water | Park in front of intrance |
---|---|---|
Ecomomy | - | - |
Comfort | + | - |
ComfortPlus | + | - |
Business | - | + |
Main contains the tests and samples of usage of the project components.
New car is created. Admin looks for new cars to validate Admin validates car from queue
New order is created Passenger accepts the ride Driver looks for available orders Driver accepts order Passenger gets position during the ride Driver completes the order Passenger queries order history
Passenger creates order Passenger declines order for some reason
Driver looks for available orders, but there is no available orders currently
Passenger adds a payment method Passenger checks payment methods from second device
Admin looks for all drivers Admin blocks one of the drivers
Driver, who is not logged in tries to look for orders