API · v1 · stabil
CODEMETA OSDeveloper Center
Konsole öffnen
Entity · party_relationships

Party Relationship Schema

Schema-ID
party_relationship
Collection
party_relationships
Permissions
  • Lesenparty_relationship_view
  • Anlegenparty_relationship_create
  • Ändernparty_relationship_edit
  • Löschenparty_relationship_delete

Felder

Party Relationship Schema

party_relationships4 Permissions

Schema for modeling labeled edges between PERSON and ORGANIZATION parties

personPartyIduuiderforderlich

ID of the PERSON party

organizationPartyIduuiderforderlich

ID of the ORGANIZATION party

functionstringoptional

Function/role at this organization (e.g. IT-Leiter, Geschäftsführer)

max 200 Zeichennullable
functionRolesstring[]optional

Structured function/role slugs from FUNCTION_ROLES taxonomy. Enables recipient-resolver for campaigns (e.g. "IT_LEAD", "MANAGING_DIRECTOR"). Free-text "function" field remains for descriptive context.

Default: []
functionRoleCustomstringoptional

Free-text role description used when functionRoles contains "OTHER".

max 200 Zeichennullable
marketingConsentobjectoptional

DSGVO/§7 UWG marketing consent on the contact-relationship level. Required for newsletter and sales-outreach campaigns.

nullable
statusstringoptional
NONEGRANTEDREVOKED
Default: "NONE"
grantedAtdatetimeoptional
nullable
grantedByuuidoptional

User ID who recorded the consent

nullable
sourcestringoptional
MANUALDOUBLE_OPT_INCONTRACTIMPORTFORM
nullable
legalBasisstringoptional
CONSENTLEGITIMATE_INTERESTEXISTING_CUSTOMER
nullable
notesstringoptional

Free-text documentation (e.g. "Verbally confirmed on 2026-04-17 call")

max 1000 Zeichennullable
revokedAtdatetimeoptional
nullable
revokedReasonstringoptional
max 500 Zeichennullable
channelsstring[]optional
Default: []
categoriesstring[]optional
nullable
emailstringoptional

Organization-specific email address

max 255 Zeichennullable
phoneLandlinestringoptional

Organization-specific landline phone number

max 50 Zeichennullable
phoneMobilestringoptional

Organization-specific mobile phone number

max 50 Zeichennullable
isPrimarybooleanoptional

Whether this person is a primary contact (Hauptansprechpartner) OF THE ORGANIZATION. Read from the organization side everywhere (customer list column, campaign recipients, DQ score); several primaries per organization are allowed (ADR 0545). NOT "the primary organization of this person" — that reading led the weclapp sync and the email contact wizard to flag every created contact until 2026-09-15. Only an explicit user choice sets it; imports, syncs and pre-filled create dialogs leave it false.

Default: false
isEmergencyContactbooleanoptional

Whether this person is an emergency contact for the organization

Default: false
isDefaultCcbooleanoptional

Standard-CC: this contact is put on CC of every outbound mail to this organization, even when the sender did not add them (typically the IT lead on the customer side who wants to see all correspondence). Resolved by `resolveDefaultCcRecipients()` (apps/api/src/services/email/default-cc.service.ts) and enforced on the message DRAFT->SENT send path; the compose dialog pre-fills the same addresses as removable chips. Only triggers when a recipient actually belongs to this organization - the entity context alone (e.g. a ticket of this customer) is not enough, so a mail to a supplier on that ticket does not silently CC the customer. Runtime fallback: missing/null counts as false - no backfill needed.

Default: falsenullable
isActivebooleanoptional

Whether this contact relationship is still active. Set to false when the person has left the organization ("ausgetreten"): the contact is greyed out with an "inactive" badge in the CRM and is no longer offered in contact pickers, so it cannot be linked to new tickets/activities. Existing links are untouched. Runtime fallback: a missing field counts as active (isActive !== false) — no backfill needed for pre-existing relationships.

Default: truenullable
emergencyPhonestringoptional

Emergency phone number

max 50 Zeichennullable
roleSlugstringoptional

Role slug determining permissions for this person at this organization

max 100 Zeichennullable
shopRoleIduuidoptional

Optional FK to shop_roles. Determines which customer-portal capabilities and product visibility this person has at this organization.

nullable
notesstringoptional

Free-text notes about this relationship

max 2000 Zeichennullable
noteSeveritystringoptional

Traffic-light importance of the contact note (`notes`). NONE = neutral grey italic (default, matches the rendering before this field existed), GREEN = uncritical, YELLOW = attention, RED = important. Drives the colour of the note on the contact card and in the "important contacts" hero cards. Runtime fallback: a missing or null field counts as NONE — no backfill needed for pre-existing relationships.

NONEGREENYELLOWRED
Default: "NONE"nullable
noteValidFromdateoptional

Optional start of the contact note's validity window (YYYY-MM-DD, inclusive — same semantics as party.notices[].validFrom). Before this date the note is hidden on the contact card and the "important contacts" hero cards; the edit dialogs always show it. Missing/null = valid immediately — no backfill needed for pre-existing relationships.

nullable
noteValidUntildateoptional

Optional end of the contact note's validity window (YYYY-MM-DD, inclusive). After this date the note disappears from the display surfaces automatically without anyone having to clear it (e.g. "on parental leave until …"). Missing/null = valid indefinitely — no backfill needed.

nullable
invitationOnlybooleanoptional

True when this relationship was created solely as part of a portal-invite flow and the user never accepted. Used by the revoke handler to soft-delete the stub when the pending invitation gets cancelled, so cancelled invites do not leave orphan CRM contacts in the Portal-Zugänge list.

Default: falsenullable
customerOrgUnitIduuidoptional

FK to a customer_org_unit. Only valid when organizationPartyId references a customer ORGANIZATION party — the referenced OU must have customerOrgUnit.customerPartyId === organizationPartyId. Used by the customer org chart and the CUSTOMER_OU_HEAD approver-DSL node (ADR 0130a).

Default: nullnullable
workAddressIduuidoptional

Site the contact actually works at: the `_id` of an entry in the ORGANIZATION party's `addresses[]` (same id space as `ticket.partyAddressId`). Independent of `workLocationMode` — a contact can be assigned to "Niederlassung Berlin" and still work HOME_OFFICE most of the time. Runtime fallback: missing/null = unknown site, the contact card simply shows no site chip — no backfill needed.

Default: nullnullable
workLocationModestringoptional

Where the contact primarily works: ON_SITE (at `workAddressId`), HOME_OFFICE (predominantly from home), HYBRID (split between site and home), REMOTE (mobile / no fixed site). Runtime fallback: missing/null = no statement made — no backfill needed.

ON_SITEHOME_OFFICEHYBRIDREMOTEnull
Default: nullnullable
reportsToPersonPartyIduuidoptional

PERSON party-id of the disciplinary manager inside the same customer organization. The referenced person must have an active party_relationship with the same organizationPartyId. Used by the CUSTOMER_MANAGER approver-DSL node (ADR 0130a). Self-reference is rejected; cycles are detected at resolve time, not on write.

Default: nullnullable

Standard-Endpoints

Diese Resource folgt dem generischen CRUD-Vertrag der Plattform. Lesen Sie die Konventionen für Pagination, Idempotenz, Optimistic Locking und Audit. Die wichtigsten Endpoints:

  • GET /api/v1/party_relationships — Liste, paginiert + filterbar
  • GET /api/v1/party_relationships/<id> — Einzelne Entity
  • POST /api/v1/party_relationships — Anlegen
  • PATCH /api/v1/party_relationships/<id> — Teil-Update
  • DELETE /api/v1/party_relationships/<id> — Soft-Delete
  • GET /api/v1/party_relationships/<id>/timeline — Audit + Aktivitäten

Suche