Skip to content

♻️ refactor: nullable PATCH fields via VoidableProps (sdk#139) [skip ci] - #372

Merged
arturasmckwcz merged 3 commits into
mainfrom
139-voidable-patch-types
Nov 21, 2026
Merged

arturasmckwcz merged 3 commits into
mainfrom
139-voidable-patch-types

Conversation

@arturasmckwcz

@arturasmckwcz arturasmckwcz commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #139

PATCH types built with plain Partial<> couldn't express clearing a nullable column with null.

  • ApiAppreciationPatch: unchanged. dateDue/dateDelivery already accept null; opportunityId is a nullable:false relation in be
  • ApiPersonPatch (and ApiRepresentativePatch via it): avatarUrl, middleName, phone, landline, email accept null (nullable columns in be person.entity.ts); lastName stays non-null to match ApiAgentContactPatch; id dropped from the body type (it's the route param)
  • ApiAgentContactPatch: optional fields accept null; firstName, lastName, role don't
  • ApiActivityLogPatch: unchanged — date/hours are required, null is meaningless

Uses the existing Partial<VoidableProps<T, K>> pattern (organization/communication) rather than blanket VoidableProps<T>, so clients can't null a NOT NULL column (which would 500 on write).

be follow-up needed (not in this PR): be's generated/hand-written Ajv schemas coerce null to ""/0 and update-agent-contact.ts ignores falsy address clears, so be must accept and store real NULLs before clients rely on these clears. Out of scope: address on person stays non-clearable; ApiPersonGet still types nullable columns as string.

Type tests: src/types/api/patch-voidable.test.ts.

[skip ci] in the title: merge without triggering the publish workflow.

🤖 Generated with Claude Code

ApiAppreciationPatch, ApiPersonPatch (and ApiRepresentativePatch through it)
and ApiAgentContactPatch now accept null on fields backed by nullable
columns; required fields stay Partial-only. ApiActivityLogPatch has no
nullable fields and stays Partial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arturasmckwcz arturasmckwcz self-assigned this Nov 21, 2026
arturasmckwcz and others added 2 commits November 21, 2026 23:30
…ch, revert format churn (sdk#139)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l fields in tests (sdk#139)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@need4deed need4deed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arturasmckwcz
arturasmckwcz merged commit 30b369b into main Nov 21, 2026
1 check passed
@arturasmckwcz
arturasmckwcz deleted the 139-voidable-patch-types branch November 21, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: replace Partial<> with VoidableProps<> for PATCH types

2 participants