Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beratyesbek/device-managment
https://github.com/beratyesbek/device-managment
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/beratyesbek/device-managment
- Owner: BeratYesbek
- Created: 2024-08-02T08:48:32.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-02T18:41:57.000Z (3 months ago)
- Last Synced: 2024-08-02T22:41:26.163Z (3 months ago)
- Language: Java
- Size: 79.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.