Skip to content

"TOYOTA - 32Bit Backend Project: A role-based Spring Boot application for product sales, order management, and PDF receipt generation."

Notifications You must be signed in to change notification settings

baranyalcinn/TYT-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinkedIn 32Bit


Logo

TOYOTA - 32Bit Backend Project

A role-controlled application for selling products and generating PDF receipts.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Contact
  7. Acknowledgments

About The Project

Product Name Screen Shot

This project tackles the challenges of managing product sales and generating professional receipts. Our role-based application, built on the robust Spring Boot framework, streamlines these processes for enhanced efficiency and accuracy.

Key Features:

  • Role-based Access Control: Securely manage user permissions (product management, orders, receipts).
  • Product Management: Effortlessly add, update, and track product details and pricing.
  • Order Processing: Simplify order placement, monitor status, and generate invoices.
  • Automated PDF Receipts: Generate professional PDF receipts with comprehensive order and product information.

⬆️


Built With

  • Spring-Boot
  • Spring-Data
  • Spring-Web
  • JWT
  • JUnit
  • Mockito
  • Log4j
  • PostgreSQL
  • Lombok
  • Docker
  • Jib
  • Maven
  • MapStruct
  • iText
  • ZXing

⬆️

Getting Started

Prerequisites

  • JDK 17 or higher
  • Maven 3.6.3 or higher
  • PostgreSQL 15 or higher
  • Docker (optional)

Installation

  1. Clone the repository:

    git clone https://github.com/baranyalcinn/TYT-Project.git
  2. Navigate to the project directory:

    cd master
  3. Create Database

    CREATE DATABASE your_database_name;
  4. Update Database Configuration Open the application-dev.yml or application-test.yml file in the src/main/resources directory and update the database connection details:

    spring:
      datasource:
        url: jdbc:postgresql://localhost:5432/your_database_name
        username: your_database_user
        password: your_database_password
  5. Run the application:

    mvn spring-boot:run

⬆️

Usage

This project includes a Postman collection to help you quickly explore and test the API.

Getting Started with the Postman Collection:

  1. Download the Collection: You can download the toyota.postman_collection.json file here.

  2. Import into Postman:

    • Open your Postman application.
    • Click on Import.
    • Select the toyota.postman_collection.json file you downloaded.
  3. Start Testing! The collection contains pre-configured requests for the API endpoints. You can now send requests and explore the API's functionality.

Profiles:

  • dev: For local development and testing with application-dev.yml file.
  • test: For deployment and testing on a server or other machines with application-test.yml file (default for Docker).

This file (readyForProject.sql) contains the SQL statements to create and populate tables for your project. Follow these steps to import the tables into your PostgreSQL database:

1. Using the psql Tool (Command Line):

  1. Open your terminal and connect to your PostgreSQL server:

    psql -h localhost -p 5432 -U your_username -d your_database_name

    (Replace localhost, 5432, your_username, and your_database_name with your actual credentials if needed)

  2. Run the following command to import the SQL file:

    psql -h localhost -p 5432 -U your_username -d your_database_name < readyForProject.sql

2. Using the pgAdmin Tool (Graphical):

  1. Open pgAdmin and connect to your PostgreSQL server.
  2. Right-click on your target database.
  3. Select the "Query Tool" option.
  4. Open the readyForProject.sql file in a text editor, copy its contents, and paste them into the Query Tool.
  5. Click the "Execute" button (looks like a lightning bolt).

Important Notes:

  • Make sure your PostgreSQL server is running and you can connect to the database where you want to import the tables.
  • Backup your existing database: This process will overwrite any existing tables with the same names. If you have valuable data in those tables, back them up before importing.
  • The readyForProject.sql file might contain sensitive data. Store this file securely.

Docker Compose and Volumes Explanation

The docker-compose.yml file makes it easy to run the application using Docker containers. The volumes section within this file manages how files are shared between the containers and your host computer. Here's a breakdown of the volume definitions used in this project:

1. Application Logs (x-log-volume)

This volume maps the application logs from your host machine to the /app/logs directory inside the container.

  • On your host machine:
    1. Create a directory named TYT-Project in a location you prefer (e.g., Documents).
    2. Inside the TYT-Project directory, create a subdirectory named logs.
  • Updating docker-compose.yml:
    • Modify the x-log-volume definition to point to this new logs directory:
      x-log-volume: &log-volume
                      /path/to/your/TYT-Project/logs:/app/logs 
    • Replace /path/to/your/TYT-Project/logs with the actual path to your logs directory.

2. Generated Slips (x-slips-volume)

This volume maps the generated slips from your host machine to the /usr/share/app/slips directory inside the container.

  • On your host machine:
    • Inside the TYT-Project directory, create another subdirectory named slips.
  • Updating docker-compose.yml:
    • Update the x-slips-volume definition:
      x-slips-volume: &slips-volume
                      /path/to/your/TYT-Project/slips:/usr/share/app/slips
    • Replace /path/to/your/TYT-Project/slips with the actual path to your slips directory.

Key Advantages of Using Volumes:

  • Persistence: Even if your Docker containers are stopped or removed, your log files and generated slips will remain safe in the designated folders on your host machine.
  • Easy Access: You can directly access and manage these files using your preferred tools on your host system.
  • Organization: Keeping these files separate from the container's file system promotes better organization of your project.

By following these steps, you'll create dedicated directories on your host machine for both the logs and the generated slips. This makes it much simpler to manage these files, even when you're running your application with Docker.


Docker:

  1. Build the Docker image:

    mvn compile jib:dockerBuild
  2. Run the Docker-Compose:

    docker-compose up --build -d

    Make sure to expose the port you specified in your application properties.

⬆️

Roadmap

  • Implement additional features.
  • Enhance API documentation.
  • Improve test coverage.
  • Integrate with other services.

See the open issues for a full list of proposed features (and known issues).

⬆️

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature.
  3. Make your changes and commit them.
  4. Push your changes to your fork.
  5. Submit a pull request.

⬆️

Contact

Project Link: https://github.com/baranyalcinn/TYT-Project/tree/master

⬆️

Acknowledgments

⬆️

About

"TOYOTA - 32Bit Backend Project: A role-based Spring Boot application for product sales, order management, and PDF receipt generation."

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published