booster icon indicating copy to clipboard operation
booster copied to clipboard

[Question] How to get the event date in a reducer

Open LaiaPerez88 opened this issue 4 years ago • 2 comments

Goal: createdAt, updatedAt fields on an entity & read model.

LaiaPerez88 avatar Jul 27 '21 16:07 LaiaPerez88

@thomas-advantitge, You can create a "createdAt" field on the event and call "new Date().toISOString()" each time you register it.

LaiaPerez88 avatar Jul 27 '21 16:07 LaiaPerez88

This is indeed how we solve it right now. Nevertheless, it might be a nice feature to access the event metadata (like creation date) from reducers?

In the particular case of createdAt and updatedAt: this is something which could be added to most read models as most read models are linked to a "detail page" in a web application, typically showing a name and a date as basic information of the object.

thomas-advantitge avatar Jul 28 '21 13:07 thomas-advantitge