ICIJ / prophecies

An ICIJ app to conduct data validation and cleaning.
https://icij.gitbook.io/prophecies
GNU Affero General Public License v3.0
19 stars 4 forks source link

feat: media record api #169

Closed pirhoo closed 10 months ago

pirhoo commented 10 months ago

PR Description

This PR adds to the API:

Preview

TaskRecordMedia endpoint

GET /api/v1/task-record-media/3/
{
    "data": {
        "type": "TaskRecordMedia",
        "id": "3",
        "attributes": {
            "uid": "5414ac75076a45f662a4df07e7373e434cb0bc1ae289d12dbb0341fc64e5d8da2fb7d99c1d6b99143ec3b0dbf30beea3",
            "taskId": "4",
            "taskRecordId": "11008",
            "file": "http://localhost:9009/task/4/5414ac75076a45f662a4df07e7373e434cb0bc1ae289d12dbb0341fc64e5d8da2fb7d99c1d6b99143ec3b0dbf30beea3_FzmtBWi.jpeg"
        },
        "links": {
            "self": "http://localhost:9009/api/v1/task-record-media/3/"
        }
    }
}

TaskRecordMedia include in TaskRecordReview serializer

GET /api/v1/task-record-reviews/7756/
{
    "data": {
        "type": "TaskRecordReview",
        "id": "7756",
        "attributes": {
            "choiceId": null,
            "status": "PENDING",
            "note": null,
            "noteCreatedAt": null,
            "noteUpdatedAt": null,
            "alternativeValue": null,
            "taskId": "4"
        },
        "relationships": {
            "checker": {
                "data": {
                    "type": "User",
                    "id": "2"
                }
            },
            "choice": {
                "data": null
            },
            "taskRecord": {
                "data": {
                    "type": "TaskRecord",
                    "id": "11008"
                }
            },
            "history": {
                "data": [
                    {
                        "type": "TaskRecordReview",
                        "id": "7756"
                    }
                ],
                "meta": {
                    "count": 1
                }
            }
        },
        "links": {
            "self": "http://localhost:9009/api/v1/task-record-reviews/7756/"
        },
        "meta": {
            "stats": null
        }
    },
    "included": [
        {
            "type": "TaskRecord",
            "id": "11008",
            "attributes": {
                "uid": "5414ac75076a45f662a4df07e7373e434cb0bc1ae289d12dbb0341fc64e5d8da2fb7d99c1d6b99143ec3b0dbf30beea3",
                "originalValue": "January 7 2002",
                "predictedValue": "2002",
                "link": "",
                "embeddableLink": "",
                "locked": false,
                "rounds": 1,
                "status": "ASSIGNED",
                "bookmarked": false
            },
            "relationships": {
                "task": {
                    "data": {
                        "type": "Task",
                        "id": "4"
                    }
                },
                "lockedBy": {
                    "data": null
                },
                "medias": {
                    "meta": {
                        "count": 1
                    },
                    "data": [
                        {
                            "type": "TaskRecordMedia",
                            "id": "3"
                        }
                    ]
                }
            },
            "links": {
                "self": "http://localhost:9009/api/v1/task-records/11008/"
            }
        },
        {
            "type": "TaskRecordMedia",
            "id": "3",
            "attributes": {
                "uid": "5414ac75076a45f662a4df07e7373e434cb0bc1ae289d12dbb0341fc64e5d8da2fb7d99c1d6b99143ec3b0dbf30beea3",
                "taskId": "4",
                "taskRecordId": "11008",
                "file": "http://localhost:9009/task/4/5414ac75076a45f662a4df07e7373e434cb0bc1ae289d12dbb0341fc64e5d8da2fb7d99c1d6b99143ec3b0dbf30beea3_FzmtBWi.jpeg"
            },
            "links": {
                "self": "http://localhost:9009/api/v1/task-record-media/3/"
            }
        }
    ]
}