# caresle/microservice-employees-odoo architecture

> Architecture diagram of the GitHub repository caresle/microservice-employees-odoo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/caresle/microservice-employees-odoo
- Repository: https://github.com/caresle/microservice-employees-odoo

## Overview

##### Main Components

a) External Systems:
- Odoo ERP System (with PostgreSQL database)
- Client Applications (API consumers)

b) Microservice Components:
- API Layer (Express.js Server)
- Controller Layer
- Database Layer (ODBC Connection)
- Query Layer

##### Component Organization

**[Client Applications] → [API Layer (Express.js)] → [Controller Layer] → [Query Layer] → [ODBC Layer] → [Odoo PostgreSQL Database]**

##### Specific Implementation Details

- Rectangle with rounded corners: External systems (Clients, Odoo ERP)
- Rectangle: Internal service components

##### Component Details

API Layer:
- Port: 3005 (from README)
- Endpoint: GET /employees
- Query Parameters: id, name, email, company

Controller Layer:
- employees.controller.ts
- Request handling
- Response formatting

Query Layer:
- employees.queries.ts
- SQL query management
- Data transformation

Database Layer:
- postgresql.ts
- ODBC connection handling
- Database interaction

##### Additional Elements

**{**
- "status": 200,
- "msg": "success",
- "data": [
- {
- "id": 1,
- "name": "Administrator",
- // ... other fields
- }
- ]
**}**

##### Important Notes

- Environment variables connection points
- TypeScript compilation process
- Error handling flow
- Main configuration files (tsconfig.json, .env)

##### Technical Stack Indicators

Technology badges or labels for:
- TypeScript
- Node.js
- Express.js
- PostgreSQL
- ODBC
- Docker

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Systems
    subgraph Clients
        CLIENT[Client Applications]:::client
    end

    subgraph "Microservice Container"
        %% API Layer
        subgraph API
            APP[Express Server]:::api
            ROUTES["Employee Routes"]:::api
        end

        %% Controller Layer
        subgraph Controller
            CTRL["Employee Controller"]:::controller
        end

        %% Query Layer
        subgraph Query
            QUERIES["Employee Queries"]:::query
        end

        %% Database Layer
        subgraph Database
            ODBC["PostgreSQL ODBC"]:::database
        end

        %% Configuration
        subgraph Config
            ENV[".env Configuration"]:::config
            TS["TypeScript Config"]:::config
            DOCKER["Docker Config"]:::config
        end
    end

    subgraph "Odoo System"
        ODOO[Odoo ERP]:::external
        DB[(PostgreSQL DB)]:::storage
    end

    %% Relationships
    CLIENT --"HTTP GET /employees"--> APP
    APP --> ROUTES
    ROUTES --> CTRL
    CTRL --> QUERIES
    QUERIES --> ODBC
    ODBC --> DB
    DB --- ODOO

    %% Configuration Dependencies
    ENV -.-> APP
    ENV -.-> ODBC
    TS -.-> APP
    DOCKER -.-> APP

    %% Response Format
    subgraph "Response Format"
        RESP["JSON Response:
        {
          status: 200,
          msg: success,
          data: [...]
        }"]:::response
    end

    CTRL -.-> RESP

    %% Styles
    classDef client fill:#2196F3,stroke:#1565C0,color:white
    classDef api fill:#4CAF50,stroke:#2E7D32,color:white
    classDef controller fill:#4CAF50,stroke:#2E7D32,color:white
    classDef query fill:#FFC107,stroke:#FFA000,color:black
    classDef database fill:#FFC107,stroke:#FFA000,color:black
    classDef external fill:#F44336,stroke:#C62828,color:white
    classDef storage fill:#9E9E9E,stroke:#616161,color:white
    classDef config fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef response fill:#78909C,stroke:#546E7A,color:white

    %% Click Events
    click APP "https://github.com/Caresle/microservice-employees-odoo/blob/main/src/app.ts"
    click ROUTES "https://github.com/Caresle/microservice-employees-odoo/blob/main/src/routes/employees.routes.ts"
    click CTRL "https://github.com/Caresle/microservice-employees-odoo/blob/main/src/controller/employees.controller.ts"
    click ODBC "https://github.com/Caresle/microservice-employees-odoo/blob/main/src/db/odbc/postgresql.ts"
    click QUERIES "https://github.com/Caresle/microservice-employees-odoo/blob/main/src/queries/employees.queries.ts"
    click ENV "https://github.com/Caresle/microservice-employees-odoo/blob/main/.env.example"
    click TS "https://github.com/Caresle/microservice-employees-odoo/blob/main/tsconfig.json"
    click DOCKER "https://github.com/Caresle/microservice-employees-odoo/tree/main/Dockerfile"
```
