OS2iot / OS2iot-backend

This repository contains the backend to the project OS2iot.
Mozilla Public License 2.0
10 stars 7 forks source link

Allow null numbers and validate them correctly #182

Closed AramAlsabti closed 2 years ago

AramAlsabti commented 2 years ago

This is a supplementary fix to this PR.

The issue with the class-transformer library is that it mutates the parameter deeply inside a private property. We need to default its value if none is passed; otherwise. it must be validated and sanitized.

In cases with editing a payload decoder, we want to fetch all applications. This PR updates the check by allowing null or "null" values, if it has been explicitly allowed. If it's allowed, then the decorator doesn't force it to a number if null or "null" is passed.

AramAlsabti commented 2 years ago

To keep the changes low-impact, I've moved the changes to the list applications dto and re-defined limit and offset. The dto is only used and validated on the application controller.