HabitRPG / habitica

A habit tracker app which treats your goals like a Role Playing Game.
https://habitica.com
Other
12.03k stars 4.1k forks source link

Always prune __v and add id for GET tasks #15301

Closed SabreCat closed 2 months ago

SabreCat commented 3 months ago

Previously, our efforts to pare down the database output of fetching tasks resulted in the id field (which copies the internal _id) being excluded when the request included the type=completedTodos query parameter.

Now, logic to add the id and strip the internal __v are moved earlier in the code, executed regardless of whether the user is requesting active tasks or completed To Do's.

phillipthelen commented 3 months ago

Good catch! I missed the return a few lines above my change. Looks good to me