Computadores-Para-Todos / computers-4-all-manager

Gestor de equipamentos, pessoas e processos do projeto "Computadores para todos"
4 stars 1 forks source link

Criar endpoint de dashboard #12

Open TiagoGouvea opened 4 years ago

TiagoGouvea commented 4 years ago

Tarefas

Devices

TiagoGouvea commented 4 years ago

Utilizei os relacionamentos do sequelize, como são e o retorno é:

[
    {
        "id": 2,
        "title": "Validando",
        "displayOrder": 2,
        "showOnGrid": true,
        "use": "device",
        "createdAt": "2020-03-17T18:38:19.000Z",
        "updatedAt": "2020-03-17T18:38:21.000Z",
        "devices": [
            {
                "id": 1,
                "title": "Notebook Acer",
                "type": "computer",
                "serial": null,
                "collectedAt": null,
                "createdAt": "2020-03-17T18:41:05.000Z",
                "updatedAt": "2020-03-17T18:41:06.000Z",
                "StatusId": 2,
                "userId": null,
                "statusId": 2,
                "donationId": 1,
                "DonationId": 1,
                "donatorId": 1,
                "donation": {
                    "id": 1,
                    "quantity": 1,
                    "description": null,
                    "collect_type": null,
                    "collect_time": null,
                    "collectedAt": null,
                    "createdAt": "2020-03-17T18:46:17.000Z",
                    "updatedAt": "2020-03-17T18:46:19.000Z",
                    "donatorId": 1,
                    "statusId": 4
                },
                "donator": {
                    "id": 1,
                    "name": "Tiago",
                    "email": "tiago@tiago.com",
                    "document": "06804501659",
                    "phone": null,
                    "notify_by": "whatsapp",
                    "type": "person",
                    "address_line_1": "NULL",
                    "address_line_2": "NULL",
                    "address_city": "NULL",
                    "address_state": "NULL",
                    "address_country": "Brazil",
                    "createdAt": "2020-03-17T18:44:49.000Z",
                    "updatedAt": "2020-03-17T18:44:49.000Z"
                }
            }
        ]
    },
    {
        "id": 1,
        "title": "Validar",
        "displayOrder": 1,
        "showOnGrid": true,
        "use": "device",
        "createdAt": "2020-03-17T18:37:51.000Z",
        "updatedAt": "2020-03-17T18:38:00.000Z",
        "devices": []
    },
    {
        "id": 3,
        "title": "Renovar",
        "displayOrder": 3,
        "showOnGrid": true,
        "use": "device",
        "createdAt": "2020-03-17T18:39:39.000Z",
        "updatedAt": "2020-03-17T18:39:39.000Z",
        "devices": []
    },
    {
        "id": 4,
        "title": "Coletado",
        "displayOrder": 1,
        "showOnGrid": true,
        "use": "donation",
        "createdAt": "2020-03-17T18:45:53.000Z",
        "updatedAt": "2020-03-17T18:45:54.000Z",
        "devices": []
    }
]