# Nebula ERP Reports

## Overview

The Nebula ERP Reports project provides comprehensive reporting functionalities for an ERP system. It includes modules for managing and generating reports on inventory, sales, purchases, suppliers, patients, and financial transactions. This project is organized into controllers, services, models, and utilities to support multi-module reporting across different business operations.

## Features

- **Multi-Module Reporting**: Inventory, Sales, Purchase, Supplier, Patient, and Financial reports.
- **JWT Authentication**: Secured APIs using JWT for authentication and access control.
- **Modular Structure**: Organized into controllers, services, models, repositories, and utilities for better code maintainability.
- **Maven-based Build**: Easily build and manage dependencies.
- **Error Handling and Logging**: Consistent structure for handling errors and generating logs.

## Technologies

- **Java**: Primary programming language for the application.
- **Spring Boot**: Framework for building the application.
- **Maven**: Dependency and project management.
- **JWT**: For secure authentication.
- **PostgreSQL**: Database for handling persistent data.

## Prerequisites

Before running this project, ensure you have the following installed:

- [JAVA](https://www.java.com/en/) (version 11 or later)
- [Maven](https://maven.apache.org/)
- [PostgreSQL](https://sbp.enterprisedb.com/getfile.jsp?fileid=1259129)

## Installation

Follow these steps to set up the project locally:

1. **Clone the repository:**

   ```bash
   git clone <repository-url>
   cd nebula-erp-reports

2. **Set up PostgreSQL Database:**

   Create and configure the PostgreSQL databases (inventory, product, purchase, sales) as specified in application.properties.

3. **Configure environment properties:**

   Update application.properties with the correct database credentials and other environment settings.

4. **Build the application:**

   ```bash
   mvn clean install 

## Running the Application

To start the application, run:

`mvn spring-boot:run`

The server will run on http://localhost:8082 by default. You can adjust the port in application.properties.

## Project Structure

- **src/main/java/com/nebula/erp/reports/config**: Contains configuration classes for databases and web settings.
- **src/main/java/com/nebula/erp/reports/controller**: Controllers that handle API endpoints for each report module (Inventory, Sales, Purchase, etc.).
- **src/main/java/com/nebula/erp/reports/model**: Contains model classes that represent the database entities.
- **src/main/java/com/nebula/erp/reports/repository**: Repositories to handle data operations for each module.
- **src/main/java/com/nebula/erp/reports/service**: Service layer that contains business logic for each report type.
- **src/main/java/com/nebula/erp/reports/utility**: Utility classes for tasks like JWT handling and response structuring.

## Key Endpoints

- **Inventory Reports**: /api/inventory/...
- **Sales Reports**: /api/sales/...
- **Purchase Reports**: /api/purchase/...
- **Supplier Reports**: /api/supplier/...
- **Patient & Prescription Reports**: /api/patient-prescription/...
- **Financial Reports**: /api/financial/...

## Security

The application uses JWT tokens for secure access. Update JwtUtils.java for token configurations, and ensure your JWT secret and expiration settings are specified in application.properties.

## Additional Configurations

- **Database Configuration**: Customize each database connection in the application.properties file or individual config classes in /config.