---
tags: [attachments, cross-module]
module: Attachments
---

# CrossModuleDependencies

## Connections
[[_Attachments]] · [[[Model]GeneralAttachment]] · [[[Service]AttachmentServices]]

---

## Sales Module
| Used | Type | Purpose |
|---|---|---|
| `Customer` | Model | [[[Model]GeneralAttachment]] customer relationship |
| `Invoice` | Model | [[[Model]GeneralAttachment]] invoice relationship |
| `InvoiceAttachment` | Model | Created by `AttachingFileToModelService` when attaching to an invoice |
| `RetrievingActiveCustomersService` | Service | Customer dropdown in create form + file listing |

---

## Purchases Module
| Used | Type | Purpose |
|---|---|---|
| `Supplier` | Model | [[[Model]GeneralAttachment]] supplier relationship |
| `PurchaseBill` | Model | [[[Model]GeneralAttachment]] bill relationship |
| `PurchaseBillAttachment` | Model | Created by `AttachingFileToModelService` when attaching to a bill |
| `Expense` | Model | [[[Model]GeneralAttachment]] expense relationship |
| `ExpenseAttachment` | Model | Created by `AttachingFileToModelService` when attaching to an expense |
| `RetrievingActiveSuppliersService` | Service | Supplier dropdown in create form |

---

## Accounting Module
| Used | Type | Purpose |
|---|---|---|
| [[Accounting/[Cross]CrossModuleDependencies]] `SuppliersAndCustomersExistenceRule` | Validation Rule | Validates the `reference` field (supplier or customer ID) on upload |

---

## CompanyUser Module
| Used | Type | Purpose |
|---|---|---|
| [[[Model]User]] | Model | `added_by` and `deleted_by` relationships on [[[Model]GeneralAttachment]] |

---

## App (Core)
| Used | Type | Purpose |
|---|---|---|
| `TenantBaseController` | Base class | Controller parent |
| `BaseRepository` | Base class | Repository parent |
| `Upload` | Service | File upload to S3 or local |
| `ConvertingEncodedStringsToFileService` | Service | Converts base64 strings to UploadedFile (API-Agent header flow) |
| `AWSBasePathEnum` | Enum | S3 path constants |
| `GlobalAttachmentRule` | Validation Rule | File type/size validation |
