Skip to content

cristimanolache28/price-comparator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Product & Discount Import System

🛠️ Project Overview

This Spring Boot application allows importing product and discount data from CSV files into a relational database. It supports multiple market, tracks product price history over time, and avoids duplicate discount entries within overlapping time periods.

In addition, the application includes user authentication with role-based access, and two key features for analyzing discount data.


🧩 Key Features

  • CSV Import Functionality
    Easily import product and discount data from multiple CSV files with different import dates.

  • Product Management
    Ensures that each product is unique using a combination of product_code and store_name.

  • Duplicate Discount Prevention
    When importing discount data, the system checks for overlapping date ranges and avoids inserting duplicates.

  • Date-Aware Logic
    Correctly maps imported data to specific dates for accurate historical records.


💡 Main Functionalities

  • Top Discounts per Store
    Returns the products with the highest discount for each store on a given date.

  • Today's Discounts
    Returns the list of products that received a new discount today.

Both of these endpoints require the user to be authenticated.


Authentication & Authorization

  • The application uses a simple authentication system with User and Role entities.
  • Users can have multiple roles – implemented via a Many-to-Many relationship.
  • Access to key endpoints (e.g., top discounts, today’s discounts) is restricted to authenticated users only.

Technologies Used

  • Java 17
  • Spring Boot
  • Spring Security
  • Spring Data JPA
  • PostgreSQL
  • Apache Commons CSV
  • Lombok
  • MapStruct (optional)

How It Works

  1. User uploads a CSV file containing product or discount data.
  2. Backend parses the file and:
    • Checks if a product with the same code + store already exists.
    • Adds or updates the product and saves the current price to the history table.
    • For discounts, validates against existing records to prevent duplicates in the same time frame.
  3. Authenticated users can then access endpoints to analyze current and historical discount data.

About

The goal of this project is to build the backend for aPrice Comparator - Market application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages