nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.1k stars 541 forks source link

$in with null value is not working #774

Open GustavoContreiras-Feegow opened 2 years ago

GustavoContreiras-Feegow commented 2 years ago

1st Example for s parameter

{
    "bandeiras": {
        "$in": [
            "|ALL|",
            "||",
            "",
            null
        ]
    },
    "unidades": {
        "$in": [
            "|ALL|",
            "||",
            "",
            null
        ]
    },
    "procedimentos": {
        "$in": [
            "|ALL|",
            "||",
            "",
            null
        ]
    }
}

1st Response

{
    "data": [],
    "count": 0,
    "total": 0,
    "page": 1,
    "pageCount": 1
}

2nd Example for s parameter

{
    "unidades": {
        "$in": [
            "|ALL|",
            "||",
            "",
            null
        ]
    },
    "procedimentos": {
        "$in": [
            "|ALL|",
            "||",
            "",
            null
        ]
    }
}

2nd response

{
    "data": [
        {
            "id": 655,
            "procedimentos": "|ALL|",
            "bandeiras": null,
            "unidades": "|ALL|",
            "unidadesExcecao": null,
            "metodoPagamento": {
                "id": 8,
                "name": "Cartão de Crédito"
            }
        }
    ],
    "count": 1,
    "total": 1,
    "page": 1,
    "pageCount": 1
}
GustavoContreiras-Feegow commented 2 years ago

Actually, even if I do a transformation with @AfterLoad to change null to |ALL| it doesn't work. Very weird behavior.