The project is a read-only interface for a company database.
In the database, there is some 'static' data about departments, in a Departments
table.
The value of these fields don't change with time (eg. DepartmentID
, DepartmentName
, DepartmentDescription
, HistoryTableName
, etc.).
There is also some timestamped data. The historical data for each department is stored in a dedicated table (named HistoryTableName
, with fields such as timestamp
, numberOfEmployees
, Energy Consumption
, ...). As you can guess, the layout of the data is not something that can be changed is this scope.
The point of the interface is to be able to access the data for all departments, at any time.
I have the 'static' part figured out: there is a company
controller, which returns an object with a departments
property, with their IDs, descriptions, etc.
I am however confused about how to handle the historical data:
Should it be a part of the 'static' data? I would alter the
department
class with properties for the historical data. (And therefore, I would return the entire configuration every time new data is requested).Shoud I create a parallel flow (new controller
companyHistory
, new class, etc. which returns only the ID of the departments and their history, and the binding is done in the UI?)...
I have little doubt that this has been studied before, and that there is a well-known pattern to handle such cases, but I have not been able to find any reference to it.
Could you point me to such a pattern?