Are we really talking about the same class? Of course you have to project the count into a new Class, the critic class.
A Codec is not a data container class like User or Critic (“Coder-Decoder”), a codec decodes that creates the Critic object from the Json. You have to declare the critic codec in the users-dto. Yet there is no word about it in the class or todo.
With the count pipeline you construct a new Json with id,numVotes. This information would help a lot. The new Json is not a User Class anymore.
Instead, the todo says one should retrieve the top 20 ‘Users’, which is misleading. Just saying I solved it that way but it was not as elegant as the real solution.
Regarding the migrations, sure, it is in fact an update. But I needed stackoverflow for solving that one and it took me at least 1 hour and two resets of the db.
There we’re too many places you had to introduce changes, not all had a todo there and most changes (update model) were never discussed.
With the migration you only had one chance - with no test upfront making sure the migration code is correct. The test just made sure the database was correct. So it was a “my dB is garbage now”
Or “yay you’ve guessed the right solution”.
So it would be good if the class description or todos would better describe what techniques one should use and the test should be testing the migration code, not just the outcome.