Skip to content

Crud expedicoes - #540

Open
JordanBonfim wants to merge 12 commits into
532-cadastro-expedicoesfrom
crud-expedicoes
Open

JordanBonfim wants to merge 12 commits into
532-cadastro-expedicoesfrom
crud-expedicoes

Conversation

@JordanBonfim

Copy link
Copy Markdown

CRUD das expedições: Implementação dos 5 endpoints da API v2 (POST, GET lista paginada, GET por ID, PUT e DELETE).

@JordanBonfim JordanBonfim self-assigned this Sep 21, 2026

@EduTiyo EduTiyo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Revisão em duas frentes (Standards e Spec) das mudanças de CRUD de Expedição. Dois achados de gravidade alta: mapeamento de erro invertido (falha de banco virando 404 ou 400 em vez de 500) em quatro controllers. O resto são gaps de cobertura de teste e judgement calls de estilo — nenhum scope creep contra o combinado.

Comment thread src/application/expedicao/BuscaExpedicaoController.ts

const result = await this.deletaExpedicaoUseCase.execute(Number(expedicaoId))

if (result.left()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Standards] Mesmo problema do Busca: result.left() vira 404 incondicionalmente, escondendo falhas reais de banco atrás de um "não encontrado".

Comment thread src/application/expedicao/DeletaExpedicaoController.ts
rotas: rotas ?? []
})

if (result.left()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Standards] Mapeamento de erro incorreto (sentido oposto ao de Busca/Deleta): aqui qualquer left vira 400, inclusive falha de infraestrutura do create no adapter. Um erro de banco em POST /expedicoes hoje reporta como pedido inválido do cliente.

updated_by
})

if (result.left()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Standards] Mesmo problema do Cadastra: left do update vira 400 mesmo quando a causa é CollectionError (infra), não validação.

Comment thread src/application/expedicao/ListaExpedicoesController.ts Outdated
Comment thread src/domain/expedicao/ExpedicaoCollection.ts
Comment thread test/integration/expedicao/expedicao-collection.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants