a0b32b4e - Expose order timestamps in the Safe activity history - #4448
Conversation
The order history DTO carried no timestamp at all, so a client had no way to date an entry. Pass both the creation date and the valuta timestamp separately rather than collapsing them: an order only gets completedAt once it completes, and the distinction between when an order was recorded and when it was valuated is exactly what a reader needs.
The valuta timestamp is only ever set once an order completes. A later refactoring that collapses it onto the creation date would claim a valuta that never happened, so assert the undefined case explicitly.
|
Two review passes, no changes required to the diff. Two neighbouring observations came up that are deliberately not addressed here, both in code this PR does not touch:
|
What
CustodyOrderHistoryDtocarried no timestamp at all — only type, status and the amount/asset pairs. A client rendering the account activity had no way to date an entry.The DTO now carries both timestamps of the order, passed through separately:
created— when the order was recorded, always present.completedAt— the valuta timestamp, present only once the order has completed.Why not a single field
Collapsing the two (
completedAt ?? created) would hand the client a date without telling it what that date means, and would quietly claim a valuta for orders that never completed — including orders stuck inCreated, where the gap between the two is precisely the interesting part. The choice of which one to display belongs to the caller.CustodyOrderHistoryDtoMapperhad no test coverage; the added spec pins the pass-through and, in particular, that an unfinished order keepscompletedAtundefined rather than inheriting the creation date.Consumers
Both history endpoints go through the same mapper, so
GET /custody/account/:id/orderand the user-scoped history gain the fields together. Purely additive — no existing field changes shape.The UI side is DFXswiss/services#1207, which needs this deployed first; without it the rows simply show no date.