Aman-Mittal opened a new issue, #680:
URL: https://github.com/apache/fineract-backoffice-ui/issues/680
A small ADR 0006 domain with a real defect behind it, which is the bar the
ADR sets for adding a contract.
## The defect
`staff-form.component.ts` reads the joining date off `GET /staff/{id}` like
this:
```ts
if (data.joiningDate) {
this.joiningDate.set(formatArrayDate(data.joiningDate));
}
```
`formatArrayDate()` returns the literal string `'-'` for anything that is
not a `[y, m, d]` array. Verified against a running `apache/fineract` — this
endpoint sends a **string**:
```
GET /staff/1 → "joiningDate":"2020-01-01" ← string
GET /offices → "openingDate":[2009,1,1] ← array
```
So on the staff **edit** form the joining date renders as `'-'` rather than
the staff member's actual date. Scope of the damage, checked rather than
assumed: the control is `[disabled]="isEditMode"` and `onSubmit()` sends only
`externalId` and `isLoanOfficer` in edit mode, so **nothing is persisted
wrongly** — it is a display defect, not data loss.
The reason nobody noticed is the part worth keeping: the existing spec
passes because its fixture invents an array the endpoint never sends.
```ts
of({ joiningDate: [2026, 1, 5] }) as unknown as
ReturnType<StaffService['getStaffStaffId']>
```
That is exactly the failure mode ADR 0006 describes — a fixture built from a
generated type inheriting the spec's blind spots. `StaffData` declares
`joiningDate?: string`, which is *correct here*, and the component distrusted
it anyway.
Note what this means more generally: two endpoints in the same Organization
area serialise dates two different ways. A screen cannot tell from the type
which convention it is getting, which is the thing a mapper should settle once.
## Scope
Six files, all of which stop importing the generated client once `STAFF_API`
exists alongside the `OFFICE_API` that is already there:
```
src/app/features/organization/staff/staff-list.component.ts
src/app/features/organization/staff/staff-list.component.test.ts
src/app/features/organization/staff/staff-form.component.ts
src/app/features/organization/staff/staff-form.component.test.ts
src/app/features/organization/offices/office-view.component.ts
src/app/features/products/savings-officer-dialog.component.ts
```
Four of those also need `OFFICE_API` to gain `get`/`create`/`update` — see
the companion issue. Done together, offices and staff clear **10 files** from
the `local/no-generated-api-import` baseline; staff alone clears 4.
Staff and offices are one domain in Fineract's model — staff are scoped by
office, `GET /staff?officeId=N` — so a single PR covering both reads better
than two halves.
## What the contract needs
`list(officeId?)`, `get(id)`, `create`, `update`. `Staff.joiningDate` should
be an ISO `YYYY-MM-DD` string or `null`, converted through the shared
`toIsoFineractDate()` in `core/adapters/api/fineract-date.ts`, which already
accepts both the array and the string form — so a platform that changes its
mind needs no change here.
## Acceptance
- `joiningDate` renders the real date on the staff edit form.
- Fixtures in the new mapper spec are payloads captured from a running
instance, not built from `StaffData`.
- The six files above are gone from `eslint-suppressions.json` after `npm
run lint:prune`.
- A mutation test: break the date conversion and show the spec fails.
Background: `DOCS/adr/0006-generated-api-boundary.md`,
`DOCS/ADAPTERS.md#the-generated-api-client`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]