CrmContact
The CrmContact entity, mapped to the crm_contact table.
| Table | crm_contact |
| Tenant-scoped | Yes — extends TenantOwned |
| Columns | 10 |
| Relationships | 3 |
| Source | backend/src/main/java/com/motorph/payroll/model/CrmContact.java |
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
contactId | Integer | contact_id | — | primary key, generated |
firstName | String | first_name | — | — |
lastName | String | last_name | — | — |
email | String | email | Yes | — |
phone | String | phone | Yes | — |
jobTitle | String | job_title | Yes | — |
isPrimary | Boolean | is_primary | — | — |
status | String | status | — | — |
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 |
|---|---|---|---|---|
organization | @ManyToOne | CrmOrganization | org_id | — |
owner | @ManyToOne | Employee | owner_id | — |
createdBy | @ManyToOne | Employee | created_by | — |
Referenced by
| Entity | Field | Kind |
|---|---|---|
| CrmActivity | contact | @ManyToOne |
| CrmDeal | contact | @ManyToOne |
| CrmNote | contact | @ManyToOne |
Neighbourhood
Repository
CrmContactRepository
Declared over CrmContact with id type Integer, with JpaSpecificationExecutor for dynamic filtering. Source: backend/src/main/java/com/motorph/payroll/repository/CrmContactRepository.java
| Method | Returns | Notes |
|---|---|---|
findWithDetailsByContactId(Integer contactId) | Optional<CrmContact> | derived |
findAllByOrganization_OrgId(Integer orgId) | List<CrmContact> | derived |
Reached by
These controllers hold — directly or through a service they depend on — a repository over CrmContact.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| CrmActivityController | /api/crm/activities | 5 | CRM |
| CrmContactController | /api/crm/contacts | 6 | CRM |
| CrmDealController | /api/crm/deals | 11 | CRM |
| CrmLeadController | /api/crm/leads | 7 | 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/.