Skip to content

Feature/cachaca#7

Open
ViniciusTei wants to merge 10 commits into
mainfrom
feature/cachaca
Open

Feature/cachaca#7
ViniciusTei wants to merge 10 commits into
mainfrom
feature/cachaca

Conversation

@ViniciusTei
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor Author

@ViniciusTei ViniciusTei left a comment

Choose a reason for hiding this comment

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

Me chama pra resolver isso @LTaka @LTaka7

Comment thread src/routes/index.ts Outdated

route.post('/webhooks', WebhookController.webhook)

route.post('/cachaca',CachacaController.index)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Se a função dessa rota é trazer a lista atual (pelo ano) de moradores o certo é ser um GET mesmo. Você pode usar query params para receber o ano. Ficaria algo do tipo route.get('/cachaca',CachacaController.index). E usaria .../cachaca?ano=2023

const CachacaController = {
async index(req: Request, res: Response) {
try {
const body: ChachacaDTO = AnoSchema.parse(req.body)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mudar para receber de req.query

}
}

const AnoSchema = z.object({
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Aqui é só uma bilbioteca pra validar a entrada do usuário. Assim a gente traz erros melhores quando for obrigatório algum tipo de dado. Aqui acho que vai precisar só tirar o .object e deixar o number

Comment thread src/models/cachaca.ts
Comment thread src/repository/moradorRepository.ts Outdated

const cachacaService = {

async addMoradorAoRank(ano: number) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Esse método faz coisa de mais

0,
ano,
)
await CachacaRepository.addMoradorAoRankCachaca(toInsert)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

só funciona na primeira vez, depois (com um ano diferente) vai tentar inserir o mesmo Id e vai dar erro

Comment thread src/service/cachacaService.ts Outdated
0,
ano,
)
//verifica se o calouro tomou todas as cachaca para se tornar veterano se nao so na proxima vez que criar
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deveria estar no método que atualiza o morador, e se estiver tentanto atualizar ele pra veterano fazer essa verificação

@LTaka LTaka marked this pull request as ready for review March 26, 2024 12:43
@LTaka LTaka force-pushed the feature/cachaca branch from 49f886b to 298dccb Compare March 26, 2024 13:14
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.

3 participants