# divad1196/odoo_graphql architecture

> Architecture diagram of the GitHub repository divad1196/odoo_graphql, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/divad1196/odoo_graphql
- Repository: https://github.com/divad1196/odoo_graphql

## Overview

##### Main Components Identification

a) Core GraphQL Layer:
- GraphQL Controller (/controllers/graphql.py)
- GraphQL Resolver (graphql_resolver.py)
- Type Definitions (/graphql_definitions/)
- Introspection Handler (introspection.py)

b) Odoo Integration Layer:
- Model Handlers (/models/graphql_handler.py)
- Field Arguments (/graphql_definitions/field_args.py)
- Basic Types (/graphql_definitions/basic_types.py)

c) Client Interfaces:
- GraphiQL Interface (/templates/graphiql.xml)
- Frontend JavaScript Library (/static/js/odoo_graphql.js)
- External Client Libraries (/examples/libs/)

**[Client Layer]**
- ↓ ↑
**[GraphQL API Layer]**
- ↓ ↑
**[Odoo Integration Layer]**
- ↓ ↑
**[Odoo Core]**

##### Component Relationships

a) External Flow:
- Client requests → GraphQL Controller
- GraphQL Controller → GraphQL Resolver
- Resolver → Odoo Models
- Response path back through the same layers

b) Internal Flow:
- Type Definitions ← → Resolver
- Model Handler ← → Odoo ORM
- Introspection System ← → GraphQL Schema

##### Additional Details

Annotations for:

- System parameters configuration
- GraphiQL editor endpoint
- External website integration points
- Authentication flow

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph CL[Client Layer]
        EC[External Clients]:::client
        GE["GraphiQL Editor Interface"]:::client
        FL["Frontend JavaScript Library"]:::client
    end
    click GE "https://github.com/divad1196/odoo_graphql/blob/18.0/odoo_graphql/templates/graphiql.xml"
    click FL "https://github.com/divad1196/odoo_graphql/blob/18.0/odoo_graphql/examples/libs/graphql.js"

    %% Authentication Layer
    subgraph AL[Authentication Layer]
        SM[Session Management]:::auth
        LH[Login/Logout Handlers]:::auth
        SS[Session Storage]:::auth
    end

    %% GraphQL Layer
    subgraph GL[GraphQL Layer]
        GC["GraphQL Controller"]:::graphql
        QR["Query/Mutation Resolver"]:::graphql
        TD["Type Definitions"]:::graphql
        IH["Introspection Handler"]:::graphql
    end
    click GC "https://github.com/divad1196/odoo_graphql/blob/18.0/odoo_graphql/controllers/graphql.py"
    click QR "https://github.com/divad1196/odoo_graphql/blob/18.0/odoo_graphql/graphql_resolver.py"
    click TD "https://github.com/divad1196/odoo_graphql/tree/18.0/odoo_graphql/graphql_definitions/"
    click IH "https://github.com/divad1196/odoo_graphql/blob/18.0/odoo_graphql/introspection.py"

    %% Odoo Core Layer
    subgraph OCL[Odoo Core Layer]
        ARM[Access Rights Management]:::odoo
        AR[Access Rules]:::odoo
        MH["Model Handler"]:::odoo
    end
    click MH "https://github.com/divad1196/odoo_graphql/blob/18.0/odoo_graphql/models/graphql_handler.py"

    %% Authentication Flow
    EC -->|1. Login Request| LH
    FL -->|Login via odoo.login| LH
    LH -->|2. Validate Credentials| SM
    SM -->|3. Generate Token| SS
    SS -->|4. Return Session Info| FL

    %% Query Flow
    EC -->|GraphQL Queries| GC
    GE -->|Development Queries| GC
    GC -->|Session Validation| SM
    GC -->|Process Query| QR
    QR -->|Type Resolution| TD
    QR -->|Introspection Request| IH
    QR -->|Data Access| MH
    MH -->|Check Permissions| ARM
    ARM -->|Apply Rules| AR

    %% Styles
    classDef client fill:#a8d1f0,stroke:#333,stroke-width:2px
    classDef auth fill:#90EE90,stroke:#333,stroke-width:2px
    classDef graphql fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef odoo fill:#FFA500,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        C[Client Components]:::client
        A[Authentication Components]:::auth
        G[GraphQL Components]:::graphql
        O[Odoo Components]:::odoo
    end
```
