# salmakhalill/team-1-iti architecture

> Architecture diagram of the GitHub repository salmakhalill/team-1-iti, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/salmakhalill/team-1-iti
- Repository: https://github.com/salmakhalill/team-1-iti

## Overview

This ASP.NET Core MVC inventory system supports catalog maintenance, stock monitoring and reordering, purchase and sale transactions, dashboard analytics, and an AI assistant that answers from policy documents or live business data. The primary workflow is a user request routed to an MVC controller, handled through a service or database context, and returned as a page or AI response. The graph includes the documented capability branches, but several controller and AI integrations are unsampled; their connections are shown only where the excerpts, source index, or README support them.

Main entry points: [`Data/InventoryManagementDbContext.cs`](https://github.com/salmakhalill/team-1-iti/blob/main/Data/InventoryManagementDbContext.cs) (Business database), [`Services/AI/AIService.cs`](https://github.com/salmakhalill/team-1-iti/blob/main/Services/AI/AIService.cs) (AI orchestration), [`Services/AI/RAGService.cs`](https://github.com/salmakhalill/team-1-iti/blob/main/Services/AI/RAGService.cs) (Policy retrieval), [`Services/InventoryService.cs`](https://github.com/salmakhalill/team-1-iti/blob/main/Services/InventoryService.cs) (Inventory service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog management"]
  node_products["Products"]
  node_categories["Categories"]
  node_category_service["Category service<br/>[CategoryService.cs]"]
  node_suppliers["Suppliers"]
  node_supplier_service["Supplier service<br/>[SupplierService.cs]"]
end

subgraph group_operations["Stock and transactions"]
  node_purchases["Purchases"]
  node_purchase_service["Purchase service<br/>[PurchaseService.cs]"]
  node_sales["Sales<br/>[SalesController.cs]"]
  node_sale_service["Sale service<br/>[SaleService.cs]"]
  node_inventory["Stock board"]
  node_inventory_service["Inventory service"]
  node_database[("Business database")]
end

subgraph group_insights["Dashboard and alerts"]
  node_dashboard["Dashboard"]
  node_low_alert["Low-stock alert"]
end

subgraph group_assistant["AI assistant"]
  node_ai_controller["AI endpoint<br/>[AIController.cs]"]
  node_ai_service["AI orchestration<br/>[AIService.cs]"]
  node_rag["Policy retrieval<br/>[RAGService.cs]"]
  node_embedding["Embedding service"]
  node_policy["Operations policy PDF"]
end

node_user(("User"))
node_openrouter{{"OpenRouter"}}

node_user -->|"manages products"| node_products
node_user -->|"manages categories"| node_categories
node_user -->|"manages suppliers"| node_suppliers
node_products -->|"queries and saves"| node_database
node_categories -->|"delegates to"| node_category_service
node_category_service -->|"reads and writes"| node_database
node_suppliers -->|"delegates to"| node_supplier_service
node_supplier_service -->|"reads and writes"| node_database
node_user -->|"records purchase"| node_purchases
node_purchases -->|"delegates to"| node_purchase_service
node_purchase_service -->|"adds stock"| node_database
node_user -->|"records sale"| node_sales
node_sale_service -->|"deducts stock"| node_database
node_user -->|"views stock"| node_inventory
node_inventory_service -->|"queries stock"| node_database
node_user -->|"views analytics"| node_dashboard
node_dashboard -->|"queries metrics"| node_database
node_low_alert -->|"gets low stock"| node_inventory_service
node_user -->|"asks question"| node_ai_controller
node_ai_controller -.->|"dispatches question"| node_ai_service
node_ai_service -->|"retrieves policy"| node_rag
node_ai_service -->|"calls live-data tools"| node_inventory_service
node_rag -->|"creates embeddings"| node_embedding
node_rag -->|"reads and chunks"| node_policy
node_embedding -->|"requests embeddings"| node_openrouter
node_ai_service -.->|"requests completions"| node_openrouter

click node_products "https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/ProductController.cs"
click node_categories "https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/CategoriesController.cs"
click node_category_service "https://github.com/salmakhalill/team-1-iti/blob/main/Services/CategoryService.cs"
click node_suppliers "https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/SuppliersController.cs"
click node_supplier_service "https://github.com/salmakhalill/team-1-iti/blob/main/Services/SupplierService.cs"
click node_purchases "https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/PurchasesController.cs"
click node_purchase_service "https://github.com/salmakhalill/team-1-iti/blob/main/Services/PurchaseService.cs"
click node_sales "https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/SalesController.cs"
click node_sale_service "https://github.com/salmakhalill/team-1-iti/blob/main/Services/SaleService.cs"
click node_inventory "https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/InventoryController.cs"
click node_inventory_service "https://github.com/salmakhalill/team-1-iti/blob/main/Services/InventoryService.cs"
click node_database "https://github.com/salmakhalill/team-1-iti/blob/main/Data/InventoryManagementDbContext.cs"
click node_dashboard "https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/DashboardController.cs"
click node_low_alert "https://github.com/salmakhalill/team-1-iti/blob/main/ViewComponents/ViewComponentLowStockAlertViewComponent.cs"
click node_ai_controller "https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/AIController.cs"
click node_ai_service "https://github.com/salmakhalill/team-1-iti/blob/main/Services/AI/AIService.cs"
click node_rag "https://github.com/salmakhalill/team-1-iti/blob/main/Services/AI/RAGService.cs"
click node_embedding "https://github.com/salmakhalill/team-1-iti/blob/main/Services/AI/EmbeddingService.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_products,node_categories,node_category_service,node_suppliers,node_supplier_service,node_user toneBlue
class node_purchases,node_purchase_service,node_sales,node_sale_service,node_inventory,node_inventory_service,node_database toneAmber
class node_dashboard,node_low_alert,node_openrouter toneMint
class node_ai_controller,node_ai_service,node_rag,node_embedding,node_policy toneRose
```

## Components

### Catalog management

- [Products](https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/ProductController.cs): `Controllers/ProductController.cs`
- [Categories](https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/CategoriesController.cs): `Controllers/CategoriesController.cs`
- [Category service](https://github.com/salmakhalill/team-1-iti/blob/main/Services/CategoryService.cs): `Services/CategoryService.cs`
- [Suppliers](https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/SuppliersController.cs): `Controllers/SuppliersController.cs`
- [Supplier service](https://github.com/salmakhalill/team-1-iti/blob/main/Services/SupplierService.cs): `Services/SupplierService.cs`

### Stock and transactions

- [Purchases](https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/PurchasesController.cs): `Controllers/PurchasesController.cs`
- [Purchase service](https://github.com/salmakhalill/team-1-iti/blob/main/Services/PurchaseService.cs): `Services/PurchaseService.cs`
- [Sales](https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/SalesController.cs): `Controllers/SalesController.cs`
- [Sale service](https://github.com/salmakhalill/team-1-iti/blob/main/Services/SaleService.cs): `Services/SaleService.cs`
- [Stock board](https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/InventoryController.cs): `Controllers/InventoryController.cs`
- [Inventory service](https://github.com/salmakhalill/team-1-iti/blob/main/Services/InventoryService.cs): `Services/InventoryService.cs`
- [Business database](https://github.com/salmakhalill/team-1-iti/blob/main/Data/InventoryManagementDbContext.cs): `Data/InventoryManagementDbContext.cs`

### Dashboard and alerts

- [Dashboard](https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/DashboardController.cs): `Controllers/DashboardController.cs`
- [Low-stock alert](https://github.com/salmakhalill/team-1-iti/blob/main/ViewComponents/ViewComponentLowStockAlertViewComponent.cs): `ViewComponents/ViewComponentLowStockAlertViewComponent.cs`

### AI assistant

- [AI endpoint](https://github.com/salmakhalill/team-1-iti/blob/main/Controllers/AIController.cs): `Controllers/AIController.cs`
- [AI orchestration](https://github.com/salmakhalill/team-1-iti/blob/main/Services/AI/AIService.cs): `Services/AI/AIService.cs`
- [Policy retrieval](https://github.com/salmakhalill/team-1-iti/blob/main/Services/AI/RAGService.cs): `Services/AI/RAGService.cs`
- [Embedding service](https://github.com/salmakhalill/team-1-iti/blob/main/Services/AI/EmbeddingService.cs): `Services/AI/EmbeddingService.cs`
- **Operations policy PDF**

### Other components

- **User**
- **OpenRouter**

## Connections

- User → Products: manages products
- User → Categories: manages categories
- User → Suppliers: manages suppliers
- Products → Business database: queries and saves (evidence: `Controllers/ProductController.cs`)
- Categories → Category service: delegates to (evidence: `Controllers/CategoriesController.cs`)
- Category service → Business database: reads and writes (evidence: `Services/CategoryService.cs`)
- Suppliers → Supplier service: delegates to (evidence: `Controllers/SuppliersController.cs`)
- Supplier service → Business database: reads and writes (evidence: `Services/SupplierService.cs`)
- User → Purchases: records purchase
- Purchases → Purchase service: delegates to (evidence: `Controllers/PurchasesController.cs`)
- Purchase service → Business database: adds stock (evidence: `Services/PurchaseService.cs`)
- User → Sales: records sale
- Sale service → Business database: deducts stock (evidence: `Services/SaleService.cs`)
- User → Stock board: views stock
- Inventory service → Business database: queries stock (evidence: `Services/InventoryService.cs`)
- User → Dashboard: views analytics
- Dashboard → Business database: queries metrics (evidence: `Controllers/DashboardController.cs`)
- Low-stock alert → Inventory service: gets low stock (evidence: `ViewComponents/ViewComponentLowStockAlertViewComponent.cs`)
- User → AI endpoint: asks question
- AI endpoint → AI orchestration: dispatches question
- AI orchestration → Policy retrieval: retrieves policy (evidence: `Services/AI/AIService.cs`)
- AI orchestration → Inventory service: calls live-data tools (evidence: `Services/AI/AIService.cs`)
- Policy retrieval → Embedding service: creates embeddings (evidence: `Services/AI/RAGService.cs`)
- Policy retrieval → Operations policy PDF: reads and chunks (evidence: `Services/AI/RAGService.cs`)
- Embedding service → OpenRouter: requests embeddings (evidence: `Services/AI/EmbeddingService.cs`)
- AI orchestration → OpenRouter: requests completions
