he/him
- Java Learner,
- Kotlin Learner,
- Problem Solver,
- Music Lover,
- Coffee Drinker,
- Human being;
- Proud UnB graduate
- Former Let's Code student
- May I help you with something?
Contact me at WhatsApp, Telegram, Linkedin or [email protected]
he/him
Contact me at WhatsApp, Telegram, Linkedin or [email protected]
Usar DTOs no lugar de DAOs nos controllers (tanto para request, quanto para response se fizer sentido). Você também criou uns objetos de Request, mas poderia adicionar Annotations para validar os campos (notBlank, notNull, Min, Max, JsonFormat, etc...)
Quando usamos v1/ num endpoint, geralmente usamos ele antes do domain, pois é o versionamento da API ou do endpoint.
Exemplo: No lugar de /api/ingredient/v1
costumamos usar v1/api/ingredient
ou api/v1/ingredient
(talvez nem seja necessário usar api
aqui).
No WizardService, você está usando diretamente ingredientRepository, recipeIngredientRepository, recipeRepository e potionRepository. Isso não é recomendado segundo o Single Responsibility Principle (S do SOLID) pois várias classes de Service poderiam alterar dados da mesma entidade no banco de dados, o que pode dificultar manutenção do código e troubleshooting.
Em Kotlin, no lugar de usar assim:
if (potion == null) {
throw RequiredObjectIsNullException()
}
Da para usar diretamente:
potion?: throw RequiredObjectIsNullException()
forEach
com listas / collections no lugar de:for (wizard in wizards) {
val withSelfRel = linkTo(WizardController::class.java).slash(wizard.id).withSelfRel()
wizard.add(withSelfRel)
}
Da para usar assim:
wizards.forEach {
it.add(linkTo(WizardController::class.java).slash(it.id).withSelfRel())
}
Na classe RecipeIngredientRepository
não me parece que era necessário receber o objeto Ingredient inteiro para fazer a consulta, só o nome do ingredient (se único) ou o id deveria ser suficiente e tornaria o código mais simples.
Adicionar uns Dockerfile e docker-compose.yaml para subir o projeto e o banco de dados já populado para testar.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.