challenge-api icon indicating copy to clipboard operation
challenge-api copied to clipboard

Enhance the Audit Logs Endpoint

Open rootelement opened this issue 4 years ago • 1 comments

AuditLogs endpoint uses unpaginated Dynamo scan to get data, so it doesn't return everything.

I ran this:

curl --location --request GET 'https://api.topcoder-dev.com/v5/challenge-audit-logs?challengeId=6008631e-48e5-45d7-8025-2758374a7d9d' \
--header 'Authorization: Bearer [my jwt]' \
--header 'Content-Type: application/json' \
--data-raw ''

And get one object returned:

[
    {
        "challengeId": "6008631e-48e5-45d7-8025-2758374a7d9d",
        "newValue": "\"2021-02-22T11:06:31.000Z\"",
        "created": "2021-02-19T11:08:14.486Z",
        "memberId": "40029484",
        "fieldName": "endDate",
        "id": "5fabad53-5ff5-4f3c-bbce-bd945a917a7e",
        "createdBy": "jcori",
        "oldValue": "\"2021-03-24T15:06:31.000Z\""
    }
]

But in the UI, i get 14 rows returned:

Screen Shot 2021-02-19 at 11 38 20 AM

Update the endpoint to use better dynamo query logic (adding challenge id as a range key and fieldName as a hash key would probably be a good start)

rootelement avatar Feb 19 '21 16:02 rootelement