🚘 Car Sharing App 🚘
Introduction
Welcome to Car Sharing Service App! 👋
Our Car Sharing Service App is a convenient and secure app which will definitely be the best solution for you and your renting car services. Both customers and managers will get pleasant experience while using it.
🔨 Technologies
- Java 17
- Maven
- Spring boot, Spring JPA, Spring Security
- Lombok
- MapStruct
- MySql 8
- Hibernate
- Liquibase
- JUnit5 (+ Mockito)
- Docker
- Swagger
- Amazon Web Services (AWS)
- Telegram API
- Stripe API
Models
Car:
The Car model is a structured representation of a vehicle available in a car sharing service, encompassing key attributes for effective management and user interaction.
It includes the following attributes:
- Model: A distinctive identifier denoting the specific name or label of the car model.
- Brand: The brand or manufacturer responsible for producing the car, providing insight into its origin.
- Type: An enumeration capturing the body type of the car. It can take values from the set {SEDAN, SUV, HATCHBACK, UNIVERSAL}, elucidating the vehicle's structural category.
- Inventory: An integer reflecting the current availability of this particular car within the car sharing service. This attribute aids in real-time tracking of the car's stock.
- Daily Fee: A decimal value in $USD, indicating the cost users incur per day when renting this car. This information facilitates transparent pricing for potential renters.
- Image URL: A string representing a URL pointing to an image of the car. This visual aid allows users to preview the car's appearance before making a rental selection.
- Model: A distinctive identifier denoting the specific name or label of the car model.
- Brand: The brand or manufacturer responsible for producing the car, providing insight into its origin.
- Type: An enumeration capturing the body type of the car. It can take values from the set {SEDAN, SUV, HATCHBACK, UNIVERSAL}, elucidating the vehicle's structural category.
- Inventory: An integer reflecting the current availability of this particular car within the car sharing service. This attribute aids in real-time tracking of the car's stock.
- Daily Fee: A decimal value in $USD, indicating the cost users incur per day when renting this car. This information facilitates transparent pricing for potential renters.
- Image URL: A string representing a URL pointing to an image of the car. This visual aid allows users to preview the car's appearance before making a rental selection.
User (Customer):
This model is a basic representation of customer information and is commonly used in user management systems for applications. The password field is securely hashed and stored.
It includes the following attributes:
- Email: String, representing the user's email address.
- First name: String, representing the user's first name.
- Last name: String, representing the user's last name.
- Password: String, representing the user's password.
- Email: String, representing the user's email address.
- First name: String, representing the user's first name.
- Last name: String, representing the user's last name.
- Password: String, representing the user's password.
Role
Provides the possible roles, including CUSTOMER and MANAGER. This model is commonly used for managing user roles and permissions.
- CUSTOMER - default role for all registered users
- MANAGER - with this role you can manage cars and rentals
- CUSTOMER - default role for all registered users
- MANAGER - with this role you can manage cars and rentals
Rental
The Rental model encapsulates information related to a car rental transaction.
It includes the following attributes:
- Rental date: Represents the date when the car was rented.
- Return date: Signifies the expected date for the car to be returned.
- Actual return date: Records the actual date when the car was returned.
- Car ID: A unique identifier associated with the specific car involved in the rental.
- User ID: A unique identifier corresponding to the user who initiated the rental.
- Rental date: Represents the date when the car was rented.
- Return date: Signifies the expected date for the car to be returned.
- Actual return date: Records the actual date when the car was returned.
- Car ID: A unique identifier associated with the specific car involved in the rental.
- User ID: A unique identifier corresponding to the user who initiated the rental.
Payment:
The Payment model represents a financial transaction.
It encompasses the following attributes:
- Status: An enumeration with possible values PENDING, PAID or CANCELED, indicating the current status of the payment.
- Type: An enumeration with possible values PAYMENT or FINE, specifying whether the transaction is related to a regular payment or a fine.
- Rental: A unique identifier associated with the specific car rental to which the payment or fine is related.
- Session URL: A URL pointing to the payment session with a stripe, facilitating online payment processing.
- Session ID: A String representing the unique identifier of the payment session.
- Amount to Pay: A decimal value (in $USD) representing the calculated total price for the rental or fine.
- Status: An enumeration with possible values PENDING, PAID or CANCELED, indicating the current status of the payment.
- Type: An enumeration with possible values PAYMENT or FINE, specifying whether the transaction is related to a regular payment or a fine.
- Rental: A unique identifier associated with the specific car rental to which the payment or fine is related.
- Session URL: A URL pointing to the payment session with a stripe, facilitating online payment processing.
- Session ID: A String representing the unique identifier of the payment session.
- Amount to Pay: A decimal value (in $USD) representing the calculated total price for the rental or fine.
How run this project
- Make sure you have installed next tools
Authentication Controller:
HTTP method | Endpoint | Role | Function |
---|---|---|---|
POST | /auth/registration | ALL | Allows a new customer to register |
POST | /auth/login | ALL | Authenticates a customer and returns JWT token |
HTTP method | Endpoint | Role | Function |
---|---|---|---|
POST | /api/auth/registration | ALL | Allows a new customer to register |
POST | /api/auth/login | ALL | Authenticates a customer and returns JWT token |
User Controller: Updating and getting user info
HTTP method | Endpoint | Role | Function |
---|---|---|---|
PUT | /users/{id}/role | MANAGER | Enables managers to update user's role |
GET | /users/me | CUSTOMER | Enables customers to get info about themselves |
PATCH | /users/update | CUSTOMER | Enables customers to update their firstname and lastname |
HTTP method | Endpoint | Role | Function |
---|---|---|---|
GET | /api/users/me | CUSTOMER | Enables customers to get info about themselves |
PATCH | /api/users/update | CUSTOMER | Enables customers to update their firstname and lastname |
PUT | /api/users/{id}/role | MANAGER | Enables managers to update user's role |
Car Controller: Managing and browsing cars
HTTP method | Endpoint | Role | Function |
---|---|---|---|
POST | /cars | MANAGER | Enables manager to add a new car to DB |
GET | /cars | ALL | Enables even unauthorized users to get all cars |
GET | /cars/{id} | ALL | Enables even unauthorized users to get info on a specific car |
PUT | /cars/{id} | MANAGER | Enables managers to update info on an existing in DB car |
DELETE | /categories/{id} | MANAGER | Enables managers to delete a car from DB |
HTTP method | Endpoint | Role | Function |
---|---|---|---|
GET | /api/cars | ALL | Enables even unauthorized users to get all cars |
GET | /api/cars/{id} | ALL | Enables even unauthorized users to get info on a specific car |
POST | /api/cars | MANAGER | Enables manager to add a new car to DB |
PUT | /api/cars/{id} | MANAGER | Enables managers to update info on an existing in DB car |
DELETE | /api/categories/{id} | MANAGER | Enables managers to delete a car from DB |
Payment Controller: Managing and browsing payments
HTTP method | Endpoint | Role | Function |
---|---|---|---|
GET | /api/payments | CUSTOMER | Enables customers to get all their payments |
GET | /api/payments/search/?status= | CUSTOMER | Enables customers to get all their payments by status (PAID/PENDING/CANCELED) |
POST | /api/payments/pay | CUSTOMER | Enables customers to create session to use Stripe |
Rental Controller: Managing and browsing rentals
HTTP method | Endpoint | Role | Function |
---|---|---|---|
POST | /api/rentals | CUSTOMER | Enables customers to create new rental |
GET | /api/rentals | CUSTOMER | Enables customers to get all their rentals |
GET | /api/rentals/?is_active= | CUSTOMER | Enables customers to get all their rentals by activeness (true/false) |
GET | /api/rentals/search/?user_id=&is_active= | MANAGER | Enables managers to search rentals using userId and activeness |
POST | /api/rentals/{id}/return | MANAGER | Enables managers to return rental by setting actual return date |
📞 ContactsContributors
- Author: The Champions team