micheldrescher / cw-project-radar

A re-implementation of the ThoughtWorks TechnologyRadar
MIT License
2 stars 5 forks source link

Add data validator #22

Closed 0xdfc closed 4 years ago

0xdfc commented 4 years ago

As of now, we can pass a valid new budget such as 332322 to the API, although the API responds with success, we have no updates going through to the actual data. No errors are logged to stdout, leading me to believe that they are not bubbling up.

"version": "0.6.0"

API responses are correct. Illegal request & response:

{
    "cw_id": 5,
    "name": "AARC2-Test",
    "title": "Test title",
    "teaser": "Test teaser",
    "type": "RIA",
    "budget": "323233dsadas",
    "startDate": "2016-05-01T00:00:00.000Z",
    "endDate": "2019-04-30T00:00:00.000Z",
    "cwurl": "https://cyberwatching.eu/projects/929/aarc-2"
}

{
    "status": "fail",
    "message": "Invalid budget: 323233dsadas."
}

Legal request & response:

{
    "cw_id": 5,
    "name": "AARC2-Test",
    "title": "Test title",
    "teaser": "Test teaser",
    "type": "RIA",
    "budget": "3234324",
    "startDate": "2016-05-01T00:00:00.000Z",
    "endDate": "2019-04-30T00:00:00.000Z",
    "cwurl": "https://cyberwatching.eu/projects/929/aarc-2"
}

{
    "status": "success",
    "data": {
        "data": {
            "hasClassifications": true,
            "hasScores": true,
            "tags": [
                "assuranceAuditCertification",
                "cryptology",
                "dataSecurityPrivacy",
                "educationTraining",
                "humanAspects",
                "identityManagement",
                "chemical",
                "defense",
                "digital",
                "energy",
                "financial",
                "foodDrink",
                "government",
                "health",
                "ai",
                "bigData",
                "blockchain",
                "cloud",
                "cip",
                "publicSpaces",
                "disasterResilience",
                "crimeTerrorism",
                "borders",
                "surveillance",
                "hardware",
                "hpc",
                "hmi",
                "iiot",
                "is",
                "iot",
                "mobile",
                "os",
                "quantum"
            ],
            "rcn": 3920288,
            "name": "AARC2-Test",
            "title": "Test title",
            "teaser": "Test teaser",
            "startDate": "2016-05-01T00:00:00.000Z",
            "endDate": "2019-04-30T00:00:00.000Z",
            "cw_id": 265,
            "budget": 3234324,
            "cwurl": "https://cyberwatching.eu/projects/929/aarc-2",
            "type": "RIA",
        }
    }
}

(Pruned [ '_id', 'id', '_v'])

It does not seem to be an issue of format or niche behavior, attempted: 3332.00, 332432, number > budget.