I have an app that collects data points throughout the day.
Each data point is stored in a
DataPoint object (that is persisted in the
I also have a
DataPointRepository with basic CRUD operations, but also methods to get average, min & max datapoints.
At the end of each day I want to compress the data in
DATA_POINTS to a
DataPointsDay entity that only contains the average, max and min values, and then persist it to the
(But for the current day I also want to be able to retrieve the
DataPointsDay object at any time without persisting it yet)
What is a good way to do this? I initially wanted to pass the
DataPointsRepository to the
DataPointsDay constructor, but I assume it violates clean architecture since the entity should not know about the repository?
Would it make sense to create a
DataPointsDayFactory so that I can get the object at any time, and also a
CreateDataPointsDayInteractor that creates the
DataPointsDay object and then persists it to the database?