Skip to main content

SGRH API Documentation

Welcome to the Sistema de Gestión de Reservas de Hoteles (SGRH) API documentation.
Current Status: The SGRH project has a fully implemented domain layer with rich business logic, but the API controllers are currently under development. This documentation describes the planned API surface based on the existing domain model and application architecture.

Overview

SGRH is a hotel reservation management system built with clean architecture principles. The system has:
  • Complete domain layer with entities, business rules, and policies
  • EF Core persistence with full database configuration
  • CQRS structure in the application layer (implementation in progress)
  • 🚧 API controllers (currently being implemented)

Current API Endpoints

The following endpoint is currently implemented for database connectivity testing:

Test Database Connection

GET /api/test-db/ping
Returns database connection status. Response:
{
  "connected": true
}

Planned API Architecture

The full API will be built using:
  • Framework: ASP.NET Core 8 Web API
  • Database: MySQL (configurable to SQL Server)
  • ORM: Entity Framework Core 8
  • Architecture: Monolithic modular with layered architecture
  • Pattern: CQRS (Command Query Responsibility Segregation)
  • Authentication: JWT Bearer tokens (planned)

Planned API Modules

Based on the domain model, the following API modules are planned for implementation:

Clientes

Client management - Domain model implemented

Reservas

Reservation management - Domain model implemented

Habitaciones

Room inventory - Domain model implemented

Tarifas y Temporadas

Pricing and seasons - Domain model implemented

Servicios Adicionales

Additional services - Domain model implemented

Reportes

Business intelligence queries (planned)

Auditoría

Audit logging - Domain model implemented

Domain-Driven Design

The API will expose operations based on the rich domain model:

Implemented Domain Features

  • Reservation aggregate with state machine (Pendiente → Confirmada → Finalizada → Cancelada)
  • Room management with temporal state tracking
  • Seasonal pricing with rate snapshots
  • Business rule enforcement via domain policies
  • Validation guards preventing invalid states
See the Domain Models section for complete entity documentation.

Development Setup

To run the current API:
1

Clone the repository

git clone https://github.com/Muryokusho0/SGRH.git
cd SGRH
2

Configure the database

Update appsettings.json with your database connection string:
{
  "ConnectionStrings": {
    "Default": "Server=localhost;Database=SGRH;User Id=sa;Password=YourPassword;"
  }
}
3

Run migrations

dotnet ef database update --project SGRH.Persistence --startup-project SGRH.Api
4

Start the API

cd SGRH.Api
dotnet run
5

Test the connection

curl http://localhost:5000/api/test-db/ping

Swagger Documentation

Access the Swagger UI for interactive API exploration:
http://localhost:5000/swagger

Next Steps

Domain Models

Explore the implemented business entities

Architecture

Understand the system architecture

Application Layer

Review the CQRS structure

Configuration

Configure database and services

Build docs developers (and LLMs) love