Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add dashboard endpoints #131

Merged
merged 19 commits into from
May 28, 2024

Conversation

LeonardoSantosBR
Copy link
Contributor

@LeonardoSantosBR LeonardoSantosBR commented May 16, 2024

🤔 O que foi feito?

Foi feito o endpoint de dashboard trabalhando em conjunto com o front-end

📗 Checklist do desenvolvedor

  • Foi testado localmente?

  • Foi adicionado documentação necessária (swagger, testes e etc)? Sim, no swagger.

👀 Checklist do revisor

Revisor 1️⃣

  • Você entendeu o propósito desse PR?

  • Você entendeu o fluxo de negócio?

  • Você entendeu o que e como foi desenvolvido tecnicamente a solução?

  • Você analisou se os testes estão cobrindo a maioria dos casos?

🔗 Referênia

Issue #111

Front-end: #121

Em conjunto com @M4rcxs

@HbLuca
Copy link

HbLuca commented May 16, 2024

Correlacionado ao (SOS-RS/frontend#121)

@M4rcxs
Copy link
Contributor

M4rcxs commented May 16, 2024

Correlacionado ao (SOS-RS/frontend#121)

Opa valeu! vamos colocar a referencia na descrição do PR também

constructor(private readonly prismaService: PrismaService) {}

async index() {
const allShelters = await this.prismaService.shelter.findMany({ include: { shelterSupplies: true }});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não é nada indicado buscar todos os dados do banco assim e fazer processamento em memória, o correto é fazer a consulta SQL já trazendo as informações necessárias

src/modules/dashboard/entities/dashboard.entity.ts Outdated Show resolved Hide resolved
@M4rcxs
Copy link
Contributor

M4rcxs commented May 22, 2024

REFACT

  • Acabei de realizar o refact da lógica dos endpoints do dashboard, favor revisar o PR.

@LeonardoSantosBR
Copy link
Contributor Author

@rodrigooler @iagxferreira @AndersonCRocha favor revisar o PR após o refactor feito pelo @M4rcxs por favor

Copy link
Contributor

@rodrigooler rodrigooler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisei aqui, só ajustar a parte mencionada! 👍🏻

@M4rcxs
Copy link
Contributor

M4rcxs commented May 27, 2024

output:

{
  "statusCode": 200,
  "message": "Successfully get dashboard",
  "data": {
    "allShelters": 20,
    "allPeopleSheltered": 700,
    "shelterAvaliable": 0,
    "shelterFull": 3,
    "shelterWithoutInformation": 0,
    "categoriesWithPriorities": [
      {
        "categoryId": "5c9b6767-5310-461b-977b-906fe16370ae",
        "categoryName": "Medicamentos",
        "priority100": 64,
        "priority10": 81,
        "priority1": 7
      },
      {
        "categoryId": "03fdb0f2-6b50-4895-b970-5793cad80c86",
        "categoryName": "Cuidados com Animais",
        "priority100": 45,
        "priority10": 65,
        "priority1": 5
      },
      {
        "categoryId": "b3a81a9d-a964-4413-9a33-974a3b4673d1",
        "categoryName": "Especialistas e Profissionais",
        "priority100": 9,
        "priority10": 6,
        "priority1": 0
      },
      {
        "categoryId": "60d6808e-9d13-484d-84a4-2ca35d42b3a6",
        "categoryName": "Acomodações e Descanso",
        "priority100": 47,
        "priority10": 54,
        "priority1": 1
      },
      {
        "categoryId": "fd1f74c4-6723-4ffe-8657-773a943e65c4",
        "categoryName": "Equipamentos de Emergência",
        "priority100": 22,
        "priority10": 27,
        "priority1": 0
      },
      {
        "categoryId": "6e6aaf88-b9fb-4a38-ab92-0db63c30e3f8",
        "categoryName": "Voluntariado",
        "priority100": 45,
        "priority10": 30,
        "priority1": 1
      },
      {
        "categoryId": "037ac262-4f35-42e0-83e1-4cdcceedb39c",
        "categoryName": "Itens Descartáveis",
        "priority100": 41,
        "priority10": 51,
        "priority1": 1
      },
      {
        "categoryId": "718d5be3-69c3-4216-97f1-12b690d0eb97",
        "categoryName": "Higiene Pessoal",
        "priority100": 60,
        "priority10": 114,
        "priority1": 14
      },
      {
        "categoryId": "a3e3bdf8-0be4-4bdc-a3b0-b40ba931be5f",
        "categoryName": "Alimentos e Água",
        "priority100": 87,
        "priority10": 118,
        "priority1": 7
      },
      {
        "categoryId": "5d50d3cf-4e36-4639-813d-d43de8886ac8",
        "categoryName": "Material de Limpeza",
        "priority100": 55,
        "priority10": 76,
        "priority1": 1
      },
      {
        "categoryId": "bf8b5e09-544f-4eff-9bb7-6220aaa34a85",
        "categoryName": "Vestuário",
        "priority100": 72,
        "priority10": 92,
        "priority1": 11
      },
      {
        "categoryId": "05583098-5f2e-44e2-b874-452ec86d9d3e",
        "categoryName": "Veículos de Resgate e Transporte",
        "priority100": 6,
        "priority10": 3,
        "priority1": 0
      },
      {
        "categoryId": "4f95853f-d5e1-487d-8086-6ddfaf2bbab7",
        "categoryName": "Eletrodomésticos e Eletrônicos",
        "priority100": 18,
        "priority10": 13,
        "priority1": 0
      },
      {
        "categoryId": "be0e4018-ca46-44cd-b814-7681ba98c51a",
        "categoryName": "Mobílias",
        "priority100": 16,
        "priority10": 17,
        "priority1": 0
      },
      {
        "categoryId": "c117dd37-82ab-43a6-bf66-d97acef97f6e",
        "categoryName": "Jogos e Passatempo",
        "priority100": 3,
        "priority10": 15,
        "priority1": 0
      },
      {
        "categoryId": "8200759f-067f-4fda-8947-ff5896929fcd",
        "categoryName": "Cosméticos",
        "priority100": 0,
        "priority10": 0,
        "priority1": 0
      },
      {
        "categoryId": "80111414-1c1d-4566-ba6f-1373a53997ac",
        "categoryName": "Serviços",
        "priority100": 1,
        "priority10": 0,
        "priority1": 0
      },
      {
        "categoryId": "d7627977-1c42-48a8-abe5-45422ddc97df",
        "categoryName": "Proteção para crianças",
        "priority100": 9,
        "priority10": 4,
        "priority1": 1
      },
      {
        "categoryId": "ad0b5516-3eba-4368-8724-5cfb6a3ea2d3",
        "categoryName": "Outros",
        "priority100": 23,
        "priority10": 23,
        "priority1": 2
      }
    ]
  }
}

@rodrigooler rodrigooler merged commit 38da306 into SOS-RS:develop May 28, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants