# CRM Entities {#crm-entities}


Entities for contacts, sales pipelines, pipeline stages, and deals.


## Contact (OrganizationContact) {#contact-organizationcontact}


| Column         | Type    | Description                                       |
| -------------- | ------- | ------------------------------------------------- |
| `name`         | string  | Contact/company name                              |
| `contactType`  | enum    | `CUSTOMER`, `CLIENT`, `LEAD`, `VENDOR`, `PARTNER` |
| `primaryEmail` | string? | Primary email                                     |
| `primaryPhone` | string? | Primary phone                                     |
| `imageUrl`     | string? | Avatar/logo                                       |
| `budget`       | number? | Client budget                                     |
| `budgetType`   | enum?   | `HOURS` or `COST`                                 |
| `notes`        | string? | Notes                                             |

**Relations:** `members` (ManyToMany Employee), `projects` (OneToMany OrganizationProject), `invoices` (ManyToMany Invoice), `tags` (ManyToMany Tag)


## Pipeline {#pipeline}


| Column        | Type    | Description   |
| ------------- | ------- | ------------- |
| `name`        | string  | Pipeline name |
| `description` | string? | Description   |
| `isActive`    | boolean | Active status |

**Relations:** `stages` (OneToMany PipelineStage)


## PipelineStage {#pipelinestage}


| Column        | Type    | Description    |
| ------------- | ------- | -------------- |
| `name`        | string  | Stage name     |
| `description` | string? | Description    |
| `index`       | number  | Order index    |
| `pipelineId`  | UUID    | FK to pipeline |

**Relations:** `deals` (OneToMany Deal)


## Deal {#deal}


| Column            | Type    | Description             |
| ----------------- | ------- | ----------------------- |
| `title`           | string  | Deal title              |
| `probability`     | number? | Win probability (0-100) |
| `stageId`         | UUID    | FK to pipeline stage    |
| `clientId`        | UUID?   | FK to contact           |
| `createdByUserId` | UUID?   | FK to creator           |

**Relations:** `stage` (ManyToOne PipelineStage), `client` (ManyToOne OrganizationContact)


## Entity Relationships {#entity-relationships}






```mermaid
erDiagram
    Pipeline ||--o{ PipelineStage : has
    PipelineStage ||--o{ Deal : contains
    Deal }o--o| OrganizationContact : client
    OrganizationContact ||--o{ OrganizationProject : sponsors
    OrganizationContact }o--o{ Employee : members
```






## Related Pages {#related-pages}


- [Pipeline & Deal Endpoints](https://sourcey-gauzy.pages.dev/api/pipeline-deal-endpoints/index.md) — API reference
- [Contact Endpoints](https://sourcey-gauzy.pages.dev/api/contact-endpoints/index.md) — contact API
- [Sales Pipelines](https://sourcey-gauzy.pages.dev/features/sales-pipelines/index.md) — feature guide
