magicalpotionbrewery's Issues
Sugestões
-
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 usarv1/api/ingredient
ouapi/v1/ingredient
(talvez nem seja necessário usarapi
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()
- Outro uso comum em Kotlin é de
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.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.