Skip to content

RESTful API designed to handle custom sales data from a high-value customer operating across multiple EU countries. ( Laravel 11, PHP 8.4, MySQL 8, Redis, Docker )

Notifications You must be signed in to change notification settings

freelancerwebro/sellers-service

Repository files navigation

Sellers Service

RESTful API designed to handle custom sales data from a high-value customer operating across multiple EU countries. This module processes CSV files containing sales representatives' contacts and sales records, storing them in a structured database and exposing the data via API.

  • Handles CSV files with hundreds to tens of thousands of records
  • Automated data processing upon file upload
  • Categorized data: Seller, Contact, and Sale
  • REST API for easy data retrieval

Tech Stack

  • Laravel 11
  • PHP 8.4
  • MySQL 8
  • Redis
  • Docker
  • PHPUnit

Requirements

Installation

Clone the git repository:

git clone git@github.com:freelancerwebro/sellers-service.git
cd sellers-service

Run the following command to build the service:

./deploy.sh

Usage

  • POST /load: Upload a CSV file
  • GET /sellers/{id}: Provide complete seller data via id
  • GET /sellers/{id}/contacts: Provide a list of all contacts established by the seller.
  • GET /sellers/{id}/sales: Provide a list of all sales data accomplished by the seller.
  • GET /sales/{year}: Provide an object with two properties: stats (netAmount, grossAmount, taxAmount, profit, % profit) and sales (list of the all sales matching the period).

Start Processing Background Jobs

Background jobs efficiently process CSV data in chunks. Each chunk consists of 1,000 rows, allowing for asynchronous processing. For example, a CSV file with 6,500 rows will be split into 7 chunks, with each chunk handled by a separate background job to optimize performance and scalability.

php artisan queue:work --tries=3

Running tests

composer test

Running code quality tools

composer cs

Preview

Load CSV file

app preview

Sample csv files: 2_records.csv, 1000_records.csv, 5000_records.csv, 10000_records.csv, 50000_records.csv, 100000_records.csv

Get seller by ID

app preview

Get seller contacts

app preview

Get seller sales

app preview

Get year stats

app preview

API Documentation

http://localhost:8083

app preview

About

RESTful API designed to handle custom sales data from a high-value customer operating across multiple EU countries. ( Laravel 11, PHP 8.4, MySQL 8, Redis, Docker )

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages