partners-api icon indicating copy to clipboard operation
partners-api copied to clipboard

This projec is an API simulates the functionality of a food delivery platform like Ifood or Uber Eats.

Partners API

Java Spring Postgres

This project is an API built using Java, Java Spring, Flyway Migrations, PostgresSQL as the database, and Spring Security for authentication control.

The API simulates the functionality of a food delivery platform like iFood and Zé Delivery. Users can register themselves into the app, and logged-in users can search for nearby restaurant partners, while ADMIN users can register new partners in the API.

Table of Contents

  • Installation
  • Configuration
  • Usage
  • API Endpoints
  • Authentication
  • Database
  • Contributing

Installation

  1. Clone the repository:
git clone https://github.com/your-username/project-name.git
  1. Install dependencies with Maven

  2. Install PostgresSQL

  3. Install Postgis Extension

Usage

  1. Start the application with Maven
  2. The API will be accessible at http://localhost:8080

API Endpoints

The API provides the following endpoints:

GET /partners - Retrieve a list of all partners.

GET /partners/{partnerId} - Retrieve a specific partner by ID.

POST /partners - Register a new partner (ADMIN access required).

GET /partners/search - Search for partners near a specified location.

POST /auth/login - Login into the App

POST /auth/register - Register a new user into the App

Authentication

The API uses Spring Security for authentication control. The following roles are available:

ROLE_USER - Standard user role for logged-in users.
ROLE_ADMIN - Admin role for managing partners (registering new partners).

To access protected endpoints as an ADMIN user, provide the appropriate authentication credentials in the request header.

Database

The project utilizes PostgresSQL as the database. The necessary database migrations are managed using Flyway.

Also, this project is using the PostgresSQL extension Postgis to store coordinates in GeoJson pattern.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the repository.

When contributing to this project, please follow the existing code style, commit conventions, and submit your changes in a separate branch.