- IDE / code editor
- SQLite compatible database GUI
- API testing client tool (Postman, HTTPie, ...)
npm install
npm prisma:generate
npm run dev
open http://localhost:3000
npm test
Defaulted in watch mode
Important
- Please turn off any AI helping tool.
- For the entire test, you are asked to improve the architecture of the codebase to enhance readability and provide the best solutions for each exercise.
- We don't expect you to know prisma (ORM), feel free to ask whatever you want about it.
- For simplicity purpose, we don't expect any operation to be transactional.
Add rules to validate the format of the provided input before persisting it.
a. A Recipe
must have at least 1 ingredient.
b.prepTime
cannot be null or 0.
c.cookingTime
cannot be null but can be 0.
Implement a unit test to verify recipe creation and persistence.
The test should not rely on any prisma related code.
The tested module should be the createRecipeUseCase
, do not bother calling the endpoint.
Feel free to refactor createRecipeUseCase
if it can help you build your test.
We want to add a totalTime
property to each recipe
.
This property should be a computation such as
totalTime = prepTime + cookingTime
.
Build a Recipe
class, so each instance are valid recipes (with valid values).
- Implement the class and include
totalTime
computation. - This rule should be tested.
- Update the code base so every time we manipulate a valid recipe, it manipulates an instance of the Recipe class.