CrmLead
The CrmLead entity, mapped to the crm_lead table.
| Table | crm_lead |
| Tenant-scoped | Yes — extends TenantOwned |
| Columns | 14 |
| Relationships | 1 |
| Source | backend/src/main/java/com/motorph/payroll/model/CrmLead.java |
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
leadId | Integer | lead_id | — | primary key, generated |
firstName | String | first_name | — | — |
lastName | String | last_name | — | — |
email | String | email | Yes | — |
phone | String | phone | Yes | — |
company | String | company | Yes | — |
jobTitle | String | job_title | Yes | — |
source | String | source | Yes | — |
status | String | status | — | — |
estimatedValue | BigDecimal | estimated_value | Yes | — |
notes | String | notes | Yes | — |
convertedAt | LocalDateTime | converted_at | Yes | — |
createdAt | LocalDateTime | created_at | — | — |
updatedAt | LocalDateTime | updated_at | Yes | — |
Plus tenant_id, inherited from TenantOwned. Hibernate stamps it on insert and adds where tenant_id = ? to every query, so it is never written or read by application code.
Relationships
| Field | Kind | Target | Join column | Required |
|---|---|---|---|---|
assignedTo | @ManyToOne | Employee | assigned_to | — |
Referenced by
| Entity | Field | Kind |
|---|---|---|
| CrmActivity | lead | @ManyToOne |
| CrmDeal | lead | @ManyToOne |
| CrmNote | lead | @ManyToOne |
Neighbourhood
Repository
CrmLeadRepository
Declared over CrmLead with id type Integer, with JpaSpecificationExecutor for dynamic filtering. Source: backend/src/main/java/com/motorph/payroll/repository/CrmLeadRepository.java
| Method | Returns | Notes |
|---|---|---|
findWithDetailsByLeadId(Integer leadId) | Optional<CrmLead> | derived |
countBySource(String source) | long | derived |
countGroupedBySource() | List<Object[]> | explicit @Query |
renameSource(@Param("oldName") String oldName, @Param("newName") String newName) | int | explicit @Query, modifying |
Reached by
These controllers hold — directly or through a service they depend on — a repository over CrmLead.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| CrmActivityController | /api/crm/activities | 5 | CRM |
| CrmDealController | /api/crm/deals | 11 | CRM |
| CrmLeadController | /api/crm/leads | 7 | CRM |
| CrmPicklistController | /api/crm/picklists | 4 | CRM |
Generated page
This page is rebuilt from the source on every docs build by docs-site/scripts/gen-code-wiki.mjs. Editing it has no effect — change the code, or, if what you want to say is prose, write it in docs/.