Category β‘οΈ Software
Subcategory β‘οΈ Python Backend Developer
Difficulty β‘οΈ Easy
In a digital era where local businesses are increasingly moving online, the demand for efficient and user-friendly digital platforms is higher than ever. A local commerce initiative has launched a challenge to develop a basic API library, aiming to streamline their online presence and enhance user interaction. This challenge, centered around backend development, focuses on creating a functional and reliable API for handling authors and books, along with a secure login system.
The objectives are fourfold. The first two involve setting up CRD (Create, Read, Delete) capabilities for authors and books, requiring modifications in author.py and book.py respectively. The third objective intricately links books to their authors, ensuring that deleting an author also removes all their corresponding books, reflecting real-world data dependencies. The final and crucial objective is developing a robust login system, which includes user registration, login, and JWT token extraction. This feature, modifying the auth.py file, is fundamental for creating a secure and user-friendly online shop.
A repository tree is provided below and should not be modified. Everything you need to develop the challenge is already included.
nuwe-backend-py-api1/
βββ flaskr
β βββ author.py
β βββ auth.py
β βββ book.py
β βββ config.py
β βββ db.py
β βββ __init__.py
β βββ schema.sql
βββ Makefile
βββ postman
β βββ infojobs-gnupg.postman_collection.json
βββ pyproject.toml
βββ README.md
βββ requirements.txt
βββ results.json
βββ tests
βββ conftest.py
βββ README.md
βββ test_nuwe.py
It is necessary to modify only the files proposed in the objectives.
This challenge has 4 objectives and is all about creating a basic API library for a local commerce:
Task 1: Create an authors endpoint that allows for basic CRD capabilities such as CREATE, READ and DELETE. For this modify the author.py
file. Follow the function signatures and make sure all tests of Objective 1 passes.
Task 2: Create a books endpoint that allows for basic CRD capabilities such as CREATE, READ and DELETE. For this modify the book.py
file. Follow the function signatures and make sure all tests of Objective 2 passes.
Task 3: Now, make sure each book is correctly linked to an author. If an author is deleted, all its corresponding books should be deleted too.
Task 4: In order to create a shop it is mandatory to have a login system implement. Create a login system allowing users to register, login and extract their JWT token. For this modify the auth.py
file. Follow the function signatures and make sure all tests of Objective 1 passes.
In all objectives make sure to create a sql
file to create the tables. This file is called schema.sql
, make sure to keep it up to date.
There is a postman collection in the /postman/
directory. You can import it so testing becomes easier!
To test the the objectives run make init
in the root folder and then make test
.
Solve the proposed objectives.
Push the changes you have made.
Click on Submit Challenge.
Wait for the results.
The final score will be given according to whether or not the objectives have been met.
In this case, the challenge will be evaluated on 900 points which are distributed as follows:
Task 1: 225 points
Task 2: 225 points
Task 3: 225 points
Task 4: 225 points
In this case, as can be seen in /tests, the tests to be performed are given, so no I/O example will be given. Based on these tests, you should be able to complete all objectives.
It is not allowed to modify the basic functionality of the tests provided. Complementary tests may be added, but these will not be evaluated.
Timeline
01
Start the challenge & clone the repository
02
Solve the challenge & submit your solution
Next action: