Skip to main content

CrmDeal

The CrmDeal entity, mapped to the crm_deal table.

Tablecrm_deal
Tenant-scopedYes — extends TenantOwned
Columns11
Relationships5
Sourcebackend/src/main/java/com/motorph/payroll/model/CrmDeal.java

Columns​

FieldTypeColumnNullNotes
dealIdIntegerdeal_id—primary key, generated
nameStringname——
stageStringstage——
probabilityIntegerprobability——
expectedValueBigDecimalexpected_valueYes—
actualValueBigDecimalactual_valueYes—
expectedCloseDateLocalDateexpected_close_dateYes—
actualCloseDateLocalDateactual_close_dateYes—
lostReasonStringlost_reasonYes—
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
organization@ManyToOneCrmOrganizationorg_id—
contact@ManyToOneCrmContactcontact_id—
lead@ManyToOneCrmLeadlead_id—
owner@ManyToOneEmployeeowner_id—
accountManager@ManyToOneEmployeeaccount_manager_id—

Referenced by​

EntityFieldKind
CrmActivitydeal@ManyToOne
CrmNotedeal@ManyToOne

Neighbourhood​

Repository​

CrmDealRepository​

Declared over CrmDeal with id type Integer, with JpaSpecificationExecutor for dynamic filtering. Source: backend/src/main/java/com/motorph/payroll/repository/CrmDealRepository.java

MethodReturnsNotes
findWithDetailsByDealId(Integer dealId)Optional<CrmDeal>derived
findAllByStageNotIn(List<String> excludedStages)List<CrmDeal>derived
countByStage(String stage)longderived
countGroupedByStage()List<Object[]>explicit @Query
renameStage(@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 CrmDeal.

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