nowcommunity / nowdatabase

Rebuild of the nowdatabase application for luomus
MIT License
3 stars 1 forks source link

`fixBigInt` transforms some `GET` request `res.body`s to string. #293

Open iritmaximus opened 1 month ago

iritmaximus commented 1 month ago

https://github.com/nowcommunity/nowdatabase/blob/64fe98f7488bc7e084d235d3c7fc7ffa354a3fb1/backend/src/utils/common.ts#L3-L5 It seems there is no particular need to implement fixBigInt this way.

In fact, few services that utilize the fixBigInt parse the returned string back to object. https://github.com/nowcommunity/nowdatabase/blob/64fe98f7488bc7e084d235d3c7fc7ffa354a3fb1/backend/src/services/species.ts#L70

iritmaximus commented 1 month ago

Also this transformation is made for only some paths: https://github.com/nowcommunity/nowdatabase/blob/64fe98f7488bc7e084d235d3c7fc7ffa354a3fb1/backend/src/routes/species.ts#L13 but not https://github.com/nowcommunity/nowdatabase/blob/64fe98f7488bc7e084d235d3c7fc7ffa354a3fb1/backend/src/routes/species.ts#L20

ShootingStar91 commented 1 month ago

Indeed, best to do it in one level, I probably meant to refactor it into services but forgot some of it.