JuhoBjn / online-store

An online store made for a course project.
0 stars 1 forks source link

Fix getAllUsers controller #87

Closed vaasuu closed 10 months ago

vaasuu commented 10 months ago

It does not support getting all users (or even a single one), which is the main thing it should do.

If you look at the code: https://github.com/JuhoBjn/online-store/blob/ac40b8300d31edbbf46d890418933173faf04607/backend/controllers/users.js#L38-L56

you can see that it's not handling the array that is coming from the model correctly so response in always 200 OK and an empty JSON object.

Easy way to fix is just limit what the SQL query returns (SELECT specific fields) and return that array via the API.