# apollo478/kouka-tech-test architecture

> Architecture diagram of the GitHub repository apollo478/kouka-tech-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apollo478/kouka-tech-test
- Repository: https://github.com/apollo478/kouka-tech-test

## Overview

CongeManagement is an ASP.NET Core leave-management API built around employee records and leave requests. Users create and retrieve employees, then submit, inspect, update, or delete leave requests. The application service validates date ranges and overlaps, enforces pending-status and manager-authorization rules, and delegates persistence through repository interfaces. The README documents PostgreSQL and Entity Framework Core. The graph reflects the sampled controllers, services, repositories, and context; broader wiring is shown only where Program.cs explicitly registers it.

Main entry points: [`CongeManagement/Program.cs`](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement/Program.cs) (Runtime Registration), [`CongeManagement.Application/Services/LeaveRequestService.cs`](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Application/Services/LeaveRequestService.cs) (Leave Service), [`CongeManagement.Infrastructure/Context/CongeDbContext.cs`](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Infrastructure/Context/CongeDbContext.cs) (EF Core Context), [`CongeManagement.Infrastructure/Repositories/EmployeeRepository.cs`](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Infrastructure/Repositories/EmployeeRepository.cs) (Employee Repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_employee_controller["Employee API"]
  node_leave_controller["Leave API"]
end

subgraph group_application["Application Services"]
  node_employee_service["Employee Service<br/>[EmployeeService.cs]"]
  node_leave_service["Leave Service"]
  node_leave_rules["Leave Rules"]
end

subgraph group_domain["Domain Contracts"]
  node_employee_contract["Employee Repository Contract"]
  node_leave_contract["Leave Repository Contract"]
  node_employee_entity["Employee Model<br/>[Employee.cs]"]
  node_leave_entity["Leave Model<br/>[LeaveRequest.cs]"]
end

subgraph group_infrastructure["Persistence"]
  node_employee_repository["Employee Repository"]
  node_leave_repository["Leave Repository"]
  node_db_context["EF Core Context<br/>[CongeDbContext.cs]"]
end

node_client(("API Client"))
node_postgres[("PostgreSQL")]
node_composition["Runtime Registration<br/>[Program.cs]"]

node_client -->|"HTTP requests"| node_employee_controller
node_client -->|"HTTP requests"| node_leave_controller
node_employee_controller -->|"calls"| node_employee_service
node_leave_controller -->|"calls"| node_leave_service
node_leave_service -->|"applies"| node_leave_rules
node_employee_service -->|"calls"| node_employee_contract
node_leave_service -->|"calls"| node_leave_contract
node_leave_service -->|"checks employee"| node_employee_contract
node_employee_repository -->|"implements"| node_employee_contract
node_leave_repository -->|"implements"| node_leave_contract
node_employee_repository -->|"queries and saves"| node_db_context
node_leave_repository -->|"queries and saves"| node_db_context
node_db_context -->|"reads and writes"| node_postgres
node_composition -->|"registers"| node_employee_service
node_composition -->|"registers"| node_leave_service
node_composition -->|"registers"| node_employee_repository
node_composition -->|"registers"| node_leave_repository
node_composition -->|"configures"| node_db_context

click node_employee_controller "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement/Controllers/EmployeeController.cs"
click node_leave_controller "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement/Controllers/LeaveRequestController.cs"
click node_employee_service "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Application/Services/EmployeeService.cs"
click node_leave_service "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Application/Services/LeaveRequestService.cs"
click node_leave_rules "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Application/Services/LeaveRequestService.cs"
click node_employee_contract "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Domain/Interfaces/IEmployeeRepository.cs"
click node_leave_contract "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Domain/Interfaces/ILeaveRequestRepository.cs"
click node_employee_entity "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Domain/Entities/Employee.cs"
click node_leave_entity "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Domain/Entities/LeaveRequest.cs"
click node_employee_repository "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Infrastructure/Repositories/EmployeeRepository.cs"
click node_leave_repository "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Infrastructure/Repositories/LeaveRequestRepository.cs"
click node_db_context "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Infrastructure/Context/CongeDbContext.cs"
click node_composition "https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement/Program.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_employee_controller,node_leave_controller,node_client toneBlue
class node_employee_service,node_leave_service,node_leave_rules,node_postgres toneAmber
class node_employee_contract,node_leave_contract,node_employee_entity,node_leave_entity toneMint
class node_employee_repository,node_leave_repository,node_db_context toneRose
class node_composition toneTeal
```

## Components

### HTTP API

- [Employee API](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement/Controllers/EmployeeController.cs): `CongeManagement/Controllers/EmployeeController.cs`
- [Leave API](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement/Controllers/LeaveRequestController.cs): `CongeManagement/Controllers/LeaveRequestController.cs`

### Application Services

- [Employee Service](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Application/Services/EmployeeService.cs): `CongeManagement.Application/Services/EmployeeService.cs`
- [Leave Service](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Application/Services/LeaveRequestService.cs): `CongeManagement.Application/Services/LeaveRequestService.cs`
- [Leave Rules](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Application/Services/LeaveRequestService.cs): `CongeManagement.Application/Services/LeaveRequestService.cs`

### Domain Contracts

- [Employee Repository Contract](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Domain/Interfaces/IEmployeeRepository.cs): `CongeManagement.Domain/Interfaces/IEmployeeRepository.cs`
- [Leave Repository Contract](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Domain/Interfaces/ILeaveRequestRepository.cs): `CongeManagement.Domain/Interfaces/ILeaveRequestRepository.cs`
- [Employee Model](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Domain/Entities/Employee.cs): `CongeManagement.Domain/Entities/Employee.cs`
- [Leave Model](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Domain/Entities/LeaveRequest.cs): `CongeManagement.Domain/Entities/LeaveRequest.cs`

### Persistence

- [Employee Repository](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Infrastructure/Repositories/EmployeeRepository.cs): `CongeManagement.Infrastructure/Repositories/EmployeeRepository.cs`
- [Leave Repository](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Infrastructure/Repositories/LeaveRequestRepository.cs): `CongeManagement.Infrastructure/Repositories/LeaveRequestRepository.cs`
- [EF Core Context](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement.Infrastructure/Context/CongeDbContext.cs): `CongeManagement.Infrastructure/Context/CongeDbContext.cs`

### Other components

- **API Client**
- **PostgreSQL**
- [Runtime Registration](https://github.com/apollo478/kouka-tech-test/blob/master/CongeManagement/Program.cs): `CongeManagement/Program.cs`

## Connections

- API Client → Employee API: HTTP requests
- API Client → Leave API: HTTP requests
- Employee API → Employee Service: calls
- Leave API → Leave Service: calls
- Leave Service → Leave Rules: applies
- Employee Service → Employee Repository Contract: calls
- Leave Service → Leave Repository Contract: calls
- Leave Service → Employee Repository Contract: checks employee
- Employee Repository → Employee Repository Contract: implements
- Leave Repository → Leave Repository Contract: implements
- Employee Repository → EF Core Context: queries and saves
- Leave Repository → EF Core Context: queries and saves
- EF Core Context → PostgreSQL: reads and writes
- Runtime Registration → Employee Service: registers
- Runtime Registration → Leave Service: registers
- Runtime Registration → Employee Repository: registers
- Runtime Registration → Leave Repository: registers
- Runtime Registration → EF Core Context: configures
