Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/beratyesbek/device-managment


https://github.com/beratyesbek/device-managment

Last synced: 27 days ago
JSON representation

Awesome Lists containing this project

README

        

# Device Management REST Service

## Description

This project provides a RESTful service for managing a device database. The service supports operations for adding, retrieving, updating, deleting, and searching devices. Devices are associated with brands, and both entities are represented in the system.

## Represented Entities

### Device
- `deviceName`: The name of the device.
- `brand`: The brand associated with the device.
- `createdAt`: The time when the device was created.

### Brand
- `name`: The name of the brand.
- `devices`: A list of devices associated with the brand.

"

## Supported Operations

1. **Add Device**: Adds a new device to the database.
2. **Get Device by Identifier**: Retrieves a device by its unique identifier.
3. **List All Devices**: Lists all devices in the database.
4. **Update Device**: Updates an existing device. Supports both full and partial updates.
5. **Delete Device**: Deletes a device from the database.
6. **Search Device by Brand**: Searches for devices based on the brand name.

## Features

- **Soft Delete**: Devices are not permanently deleted from the database but marked as deleted.
- **Optimistic Locking**: Ensures data consistency in concurrent transactions.
- **Transactional Management**: Operations are wrapped in transactions to ensure atomicity.
- **Controller Advice**: Provides centralized exception handling.
- **Unit Tests & Integration Tests**: Ensures the reliability and functionality of the service.
- **Docker Configuration**: Includes Docker configuration for containerized deployment.
- **Test Containers**: Used for running integration tests in isolated environments.
- **MapStruct**: Used for mapping between DTOs and entities.
- **Lombok**: Used for reducing boilerplate code.
- **Spring Data JPA**: Used for data access and persistence.
- **Flyway**: Used for database migration.

## Usage

### Setting Up

1. **Clone the Repository**
```sh
git clone https://github.com/BeratYesbek/device-managment.git
cd device-managment
```

2. **Run**
```sh
docker-compose up --build
```

### API Endpoints
You can access the postman collection under the `postman` directory.:
- **POST /devices**: Add a new device.
- **GET /devices/{id}**: Get a device by its identifier.
- **GET /devices**: List all devices.
- **PUT /devices/{id}**: Update a device by its identifier.
- **DELETE /devices/{id}**: Delete a device by its identifier.
- **GET /devices/search**: Search devices by brand name.