Contract Schema
Felder
Contract Schema
Schema for validating contract entities
name
Contract name
description
Contract description
descriptionHtml
Rich text HTML version of the contract description
contractTypeId
Contract type UUID
contractCategory
Contract category — MAINTENANCE covers all service contracts (positions, asset assignments, contingents, SLA, compliance, coverage); LICENSE is the separate license-billing flow (positions grid + Weclapp invoice import).
MAINTENANCELICENSEpartyId
Associated party UUID
contactPartyId
Associated contact person UUID
parentContractId
Parent contract UUID for sub-contracts
status
Contract status (ADR 0198 R7): DRAFT → PENDING_APPROVAL → ACTIVE → EXPIRING → CANCELLED (+ TEMPLATE). SUSPENDED/RENEWED/EXPIRED removed — pausing gone, renewal is in-place, lapse at endDate ends in CANCELLED.
DRAFTPENDING_APPROVALACTIVEEXPIRINGCANCELLEDTEMPLATEstartDate
Contract start date (YYYY-MM-DD)
endDate
Contract end date (YYYY-MM-DD)
cancellationDeadline
Earliest cancellation deadline across the contract + positions (R5).
nextNotificationDate
Earliest expiry reminder date across the contract + positions (R5).
nextRenewalDate
Earliest auto-renewal boundary across the contract + positions (R5).
cancellationDeadlineSource
nextNotificationSource
nextRenewalSource
contractDate
Contract signing date (from legacy Toast import)
activatedAt
Activation timestamp
cancelledAt
Cancellation timestamp
expiredAt
Expiration timestamp
cancellation
extensionDays
Auto-renewal extension length in days (day-precise, replaces extensionMonths)
extensionMonths
deprecated — migrated to extensionDays; kept for backward compatibility
nextPossibleDate
cancellationRequestedAt
cancellationRequestedBy
cancellationReason
cancellationEffectiveDate
softframe
Reference frame for cancellation period (weclapp: cancellationPeriodSoftframe)
CONTRACT_ENDEND_OF_MONTHEND_OF_QUARTEREND_OF_CALENDAR_YEAREND_OF_CONTRACT_YEARnullnotification
enabled
channels
targets
inApp
email
task
opportunity
leadQuantity
leadUnit
DAYWEEKMONTHYEARnulllastNotifiedAt
monthlyRevenue
Monthly revenue as decimal string
currencyCode
Three-letter currency code (ISO 4217)
billingCycle
Billing cycle
MONTHLYQUARTERLYSEMI_ANNUALYEARLYONE_TIMENONEpaymentTermsDays
Payment terms in days
priceEscalation
type
FIXED_PERCENTCPI_INDEXMANUALpercentPerYear
effectiveMonth
lastAppliedAt
serviceTargetProfileId
Service target profile UUID (ADR 0117a — replaces slaProfileId)
scope
coverageType
Legacy coverage type — kept for backwards-compat. New code reads `coverageMode` (see below).
ALL_ASSETSASSIGNED_ONLYCUSTOMcoverageMode
Defines what counts as a contract-covered service. ALL_WITH_EXCLUSIONS: all services except the excluded* lists. ONLY_SPECIFIC: only the included* lists. ONLY_EXPLICIT_ASSIGNMENTS: only matches via explicit assignments[]. Falls back to coverageType mapping when unset.
ALL_WITH_EXCLUSIONSONLY_SPECIFICONLY_EXPLICIT_ASSIGNMENTSexcludedServiceTypeIds
excludedLocationIds
excludedTechnicianIds
includedServiceTypeIds
includedLocationIds
includedTechnicianIds
serviceTypeIds
technicianUserIds
technicianOrgUnitIds
locationIds
assignedToId
Assigned user UUID
orgUnitId
Associated org unit UUID
amendmentOf
Original contract UUID this amends
amendmentNumber
Amendment sequence number
templateId
Template contract UUID this was created from
assignments
Contract assignments (assets, parties, locations, service types)
assignmentType
Subject of the assignment. ASSET = concrete asset; ASSET_TYPE = curated asset-type bucket (see `assetTypeKey`); PARTY = concrete customer employee; ALL_ASSETS = default coverage for any asset under the contract; ALL_PARTIES = default coverage for any customer employee; LOCATION = matches when `asset.locationId === assignment.locationId` (ADR 0151 Phase B). SERVICE_TYPE is legacy.
ASSETASSET_TYPEPARTYALL_ASSETSALL_PARTIESLOCATIONSERVICE_TYPEassetId
assetTypeKey
Curated asset-type bucket key for `assignmentType: ASSET_TYPE`. Each key maps to a set of asset.schema discriminator patterns (see `asset-type-keys.ts`).
PCSERVERNETWORKPERIPHERALMOBILELICENSEAPPLICATIONpartyId
locationDescription
locationId
Reference to a Location entity. Required when `assignmentType === "LOCATION"` (ADR 0151 Phase B); the resolver matches assets whose `asset.locationId` equals this value at Specificity 2.5 (between ASSET_TYPE and SERVICE_TYPE).
serviceTypeId
itemId
Optional link to a contract.items[].id — when set, billing is driven by the position and the assignment-level monthlyPrice/discountPercent are ignored by the UI.
monthlyPrice
discountPercent
stockingCost
responseTimeMinutes
Convenience field: when set, the save-helper synthesises a `targetsOverride.stages[]` entry with `kind=time_to_first_response` and this duration. Read back from the same stage.
resolutionTimeMinutes
Convenience field: when set, the save-helper synthesises a `targetsOverride.stages[]` entry with `kind=time_to_close` and this duration. Read back from the same stage.
validFrom
validUntil
notes
contingents
Contract contingents (prepaid hours, monetary budgets, trips)
contingentType
HOURSMONETARYTRIPStotalAmount
usedAmount
unit
HOURSMINUTESEURTRIPSperiodType
MONTHLYQUARTERLYYEARLYONE_TIMEUNLIMITEDperiodEnd
carryOver
type
NONEFULLCAPPEDPERCENTmaxCarryOver
maxCarryOverPercent
expiresAfterPeriods
overagePolicy
BLOCKALLOWALLOW_WITH_SURCHARGENOTIFYoverageSurchargePercent
overageCapAmount
autoRefill
conversionRate
fallbackContractId
fallbackPriority
exhaustedAt
items
Contract line items (incl. GROUP divider rows for positional grouping)
itemType
RECURRINGONE_TIMESURCHARGEDISCOUNTNOTEGROUPname
description
quantity
minQuantity
Lower clamp for a datasource-resolved quantity (ADR 0357). Ignored for static quantities.
maxQuantity
Upper clamp for a datasource-resolved quantity (ADR 0357).
unitPrice
discountPercent
interval
MONTHLYQUARTERLYSEMI_ANNUALYEARLYONE_TIMENONEDAILYWEEKLYTWO_YEARLYTHREE_YEARLYvalidFrom
validUntil
assetId
serviceTypeId
nextBillingDate
Next billing date for this specific item
previousBillingDate
Last time this item was billed
billingGroupId
Group ID for splitting items across multiple invoices
articleId
Optional link to a Codemeta catalog article
articleNumber
isBillOfMaterial
When true, this item is a sales bill of material with sub-items
useSubItemPrices
BOM pricing: when true, unitPrice mirrors the sum of subItems; else own price
subItems
quantitySource
Dynamic quantity source — resolved at billing time
conditions
Contract-level overrides for billing conditions. Each block is optional; unset fields fall back to service-type / tenant defaults (punctual override strategy).
surchargeStackingMode
How surcharges combine when several apply to the same minute (ADR 0431). ADDITIVE (default) sums them (1 + Σ pct/100) — the long-standing behaviour; MAX lets the single highest surcharge win (collective-agreement practice). Unset = fall back to service_type.billing.surchargeStackingMode, then ADDITIVE.
ADDITIVEMAXserviceRates
Per-service-type rate schedule (overrides service-type.billing.pricing). Multiple entries per serviceTypeId are allowed: each may carry a validFrom date; an entry without validFrom is the baseline. For a given booking date the effective entry is the one with the latest validFrom <= date. To change a rate, ADD a new entry (do not overwrite an existing one) so historical bookings keep their old rate.
travelAllowance
Arrival/departure travel costs: per-km rate, flat per-trip fee, vehicle base fee.
overtimeSurcharges
Overtime / evening / weekend / holiday surcharges applied multiplicatively to the service rate when the time-of-day + day-of-week (+ optional service-type / holiday) match.
name
fromTime
toTime
daysOfWeek
surchargePercent
serviceTypeIds
Service types this surcharge applies to. Empty/omitted = all service types (ADR 0163).
holidayMode
Public-holiday behaviour (ADR 0163). IGNORE/unset = match weekday windows only (never on a holiday); ALSO_ON_HOLIDAYS = weekday windows OR any holiday; ONLY_ON_HOLIDAYS = only on holidays (daysOfWeek ignored). Region resolved per technician via holiday-resolver.
IGNOREALSO_ON_HOLIDAYSONLY_ON_HOLIDAYSvalidFrom
validUntil
serviceRounding
Per-service-type rounding overrides. Unset fields fall back to service-type.billing.{roundingMinutes,roundingMode,minimumMinutes,billingUnitMinutes}.
roundingMinutes
roundingMode
UPDOWNNEARESTminimumMinutes
billingUnitMinutes
remarks
Structured free-text remarks list for capturing miscellaneous contract data (per ADR 0149).
notes
External notes
internalNotes
Internal notes (not visible to customer)
tags
Contract tags
customFields
Custom fields (tenant-specific)
linkedRiskIds
Linked risk IDs
licensePositions
License contract positions (for LICENSE category)
type
STATICDYNAMICdescription
companyName
unchangedUnitPrice
manualUnitPrice
Manually overridden own unit price (may be negative, e.g. discount positions). Replaces the weclapp article price as billing basis; unchangedUnitPrice keeps the fetched article price as revert target.
pricingDate
startDate
endDate
period
ISO-8601 billing period for this position (P1Y = yearly, P1M = monthly)
P1YP1Mnullfactor
rounding
EXACTCEILROUNDarticleType
BASICSALES_BILL_OF_MATERIALSTORABLEgroupName
useSalesBillOfMaterialItemPrices
salesBillOfMaterialItems
type
STATICDYNAMICdescription
unchangedUnitPrice
discountPercentage
pricingDate
articleFactor
rounding
EXACTCEILROUNDfactor
cancellationPeriodQuantity
cancellationPeriodUnit
extensionQuantity
extensionUnit
cancellationNotification
cancellationNotificationQuantity
cancellationNotificationUnit
lastCancellationNotificationDate
notificationChannels
notificationTargets
inApp
email
task
opportunity
lastInvoicedAt
Timestamp of last billing/invoice creation
billingConfig
Automatic billing configuration
nextBillingDate
Next billing date (calculated from lastInvoicedAt + billingCycle)
billingFrequency
Billing frequency for license contracts
monatlichjährlichno_billingweclappCustomerId
weclapp ERP customer ID
linkedEntities
Linked entities (assets, tickets, etc.)
ticketRules
Activated ticket-generation rules (ADR 0439). Each entry binds a tenant-wide contract_ticket_rule to this contract, usually to one position, with its own due-date cursor.
id
Activation UUID (stable key, used in generated tickets’ sourceRef).
ruleId
The contract_ticket_rule this activation executes.
positionId
items[].id or licensePositions[].uuid this activation is bound to; null = manual activation without a position.
positionSource
Which position array positionId refers to — the two stay separate models (ADR 0357). null when positionId is null.
ITEMLICENSEnullstartDate
First due date, chosen at activation. The UI prevents past dates; the server tolerates them (sweep creates exactly one ticket, then continues from the next future occurrence).
nextDueDate
Cursor: next due date (initially = startDate). Advanced by the sweep.
nextCreateDate
Derived scan key: nextDueDate minus the rule’s leadDays. The sweep creates the ticket when nextCreateDate <= today.
lastTicketDate
Due date of the most recently generated ticket.
lastTicketId
Id of the most recently generated ticket.
isActive
Paused activations are skipped by the sweep but stay documented on the contract.
Keine Felder passen zum Filter.
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/contracts— Liste, paginiert + filterbarGET /api/v1/contracts/<id>— Einzelne EntityPOST /api/v1/contracts— AnlegenPATCH /api/v1/contracts/<id>— Teil-UpdateDELETE /api/v1/contracts/<id>— Soft-DeleteGET /api/v1/contracts/<id>/timeline— Audit + Aktivitäten