Skip to content

About

Practicing basic concepts in exceptions and logs, Spring Boot.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Exceptions and Logs

This is an educational project using Spring Boot to create an API for generating service orders, focusing on the implementation of exceptions and logging.

Table of contents

  1. Overview
  2. Technologies
  3. UML Diagram
  4. Getting Started
  5. Usage
  6. Project Structure
  7. License

Overview

This project demonstrates the use of Spring Boot to build a REST API for managing service orders. It emphasizes the implementation of custom exceptions and logging mechanisms to handle errors effectively.

Technologies

  • Java
  • Spring Boot
  • Maven
  • Docker
  • SQL (MySQL)

UML Diagram

UML Diagram

Getting Started

Prerequisites

  • Java 21
  • Maven 3.8+
  • Docker (optional, for containerized deployment)

Installation

  1. Clone the repository:
    git clone https://github.com/DJAngel973/exceptions-and-logs.git
    cd exceptions-and-logs

Build the project

  1. Build the project using Maven:
    ./mvnw clean install
  2. Run the application:
    ./mvnw spring-boot:run
  3. (optional) Run the application in a Docker container:
    docker-compose up
  4. Access the API in your browser or a tool like Postman:
    http://localhost:8080

Usage

  • API Endpoints:

    • POST /api/clientes/registrar: Register a new client.
    • GET /api/clientes/id: Get details about a client.
    • GET /api/clientes/: Get list all clients.
    • DELETE /api/clientes/id: Delete client with id.
    • PUT /api/clientes/id: Update cliente with id.
    • POST /api/ordenes/registrar: Register a new service order.
    • GET /api/ordenes/id: Get details of an order.
  • Error handling:

    • ClientNotFoundException: It is launched when a client is not found.
    • OrderNotFoundException: It is thrown when an order is not found.
    • InvalidDataException: Thrown when input data is invalid.
    • IdDuplicadoException: Thrown when attempting to register a duplicate ID.

Project Structure

src/
├── main/
│   ├── java/co/edu/JdA/
│   │   ├── Main.java
│   │   ├── controller/
│   │   │   ├── ClientController.java
│   │   │   └── OrderController.java
│   │   ├── DTO/
│   │   │   ├── ClientCreationDTO.java
│   │   │   ├── ClientResponseDTO.java
│   │   │   ├── OrderCreateDTO.java
│   │   │   └── OrderResponseDTO.java
│   │   ├── entity/
│   │   │   ├── ClientEntity.java
│   │   │   └── OrderEntity.java
│   │   ├── exception/
│   │   │   ├── ClientNotFoundException.java
│   │   │   ├── IdDuplicadoException.java
│   │   │   ├── InvalidDataException.java
│   │   │   └── OrderNotFoundException.java
│   │   ├── repository/
│   │   │   ├── ClientRepository.java
│   │   │   └── OrderRepository.java
│   │   └── service/
│   │       ├── ClientService.java
│   │       └── OrderService.java
│   └── resources/
│       ├── db/migration/
│       │   └── V2__add_registration_date.sql
│       └── application.properties
├── docs/
│   ├── UML-diagram.png
│   └── UML.plantuml
└── docker/
    └── V1__init.sql

License

This project is licensed under the MIT License. See the LICENSE file for details.

Java Spring Boot MySQL Docker Maven IntelliJ IDEA Linux

About

Practicing basic concepts in exceptions and logs, Spring Boot.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages