Skip to main content

CrmLead

The CrmLead entity, mapped to the crm_lead table.

Tablecrm_lead
Tenant-scopedYes — extends TenantOwned
Columns14
Relationships1
Sourcebackend/src/main/java/com/motorph/payroll/model/CrmLead.java

Columns​

FieldTypeColumnNullNotes
leadIdIntegerlead_id—primary key, generated
firstNameStringfirst_name——
lastNameStringlast_name——
emailStringemailYes—
phoneStringphoneYes—
companyStringcompanyYes—
jobTitleStringjob_titleYes—
sourceStringsourceYes—
statusStringstatus——
estimatedValueBigDecimalestimated_valueYes—
notesStringnotesYes—
convertedAtLocalDateTimeconverted_atYes—
createdAtLocalDateTimecreated_at——
updatedAtLocalDateTimeupdated_atYes—

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​

FieldKindTargetJoin columnRequired
assignedTo@ManyToOneEmployeeassigned_to—

Referenced by​

EntityFieldKind
CrmActivitylead@ManyToOne
CrmDeallead@ManyToOne
CrmNotelead@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

MethodReturnsNotes
findWithDetailsByLeadId(Integer leadId)Optional<CrmLead>derived
countBySource(String source)longderived
countGroupedBySource()List<Object[]>explicit @Query
renameSource(@Param("oldName") String oldName, @Param("newName") String newName)intexplicit @Query, modifying

Reached by​

These controllers hold — directly or through a service they depend on — a repository over CrmLead.

ControllerBase pathEndpointsModule
CrmActivityController/api/crm/activities5CRM
CrmDealController/api/crm/deals11CRM
CrmLeadController/api/crm/leads7CRM
CrmPicklistController/api/crm/picklists4CRM

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/.