Skip to content

Commit 9cda368

Browse files
committed
fix(objectql): set the refusal's field and amount from the first hit after the message builder split
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
1 parent 9ee0152 commit 9cda368

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
fix(objectql): a following amount whose parent code field is no longer served is refused with a message that says so
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A `record`-mode amount that follows its parent's currency (`currencyField: 'MASTER_DETAIL.CODE'`) is still refused `ERR_CURRENCY_CODE_REQUIRED` / 400 when the parent object, as served at the write, no longer declares the code field (the package that contributed it was disabled or uninstalled). The message used to say the parent's code was blank and asked for a code to be written into that field, which is not there. It now says the parent does not serve the field, names the disabled package when the registry still holds its contribution, and says the amount has no code to follow until the field is served again, or that the amount can be left empty. The code, status, `field` and `amountField` are unchanged, and so is the message for a served code field that is blank.

‎packages/objectql/src/validation/record-currency-code.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,9 @@ export class RecordCurrencyCodeRequiredError extends Error {
433433
super(codeRequiredMessage(object, operation, hits, recordId, unserved));
434434
this.name = 'RecordCurrencyCodeRequiredError';
435435
this.object = object;
436-
this.field = first.codeField;
436+
this.field = hits[0].codeField;
437437
this.fields = [...new Set(hits.map((h) => h.codeField))];
438-
this.amountField = first.amountField;
438+
this.amountField = hits[0].amountField;
439439
}
440440
}
441441

0 commit comments

Comments
 (0)