This application is designed to store user data, including information such as first name, last name, and address (street, city, state, and zip). The application supports two types of users: Parent and Child. Parents can have a full address, while children cannot have an address and must belong to a parent. The application provides APIs to perform CRUD operations on user data, including deleting, creating, and updating user data.
All endpoints are relative to the following base URL: http://localhost:8000
This API follows the OpenAPI 3.1.0 specification. API Doc : http://localhost:8000/docs
- Supports two user types: Parent and Child
- Stores user data including first name, last name, and address
- Provides APIs for CRUD operations on user data
- Ensures that children are associated with a parent and cannot have an address
- Language: Python (version 3.12)
- Database: SQLite (can be easily changed to other databases)
- Framework: FastAPI (for building APIs)
- Testing: Pytest (for testing the application)
- Clone the repository from GitHub:
git clone https://github.com/shahidx0x/User-Data-Storage-Application.git
- Navigate to the project directory:
cd User-Data-Storage-Application
- Run the following command to create a virtual environment named 'venv':
python3 -m venv venv
- On Windows:
venv\Scripts\activate
- On Linux:
source venv/bin/activate
7.Install the required dependencies: pip install -r requirements.txt
- Ensure that you have Python installed on your system (version 3.12)
- Navigate to the project directory
- Run the application using the following command:
uvicorn main:app --reload
- The application will start running on
http://localhost:8000
- To run the tests, navigate to the project directory
- Run the tests using the following command:
pytest
- Code follows PEP 8 guidelines for Python
- Linting is performed using Flake8 and autopep8
- Testing is done using Pytest
- Method: POST
- URL:
/parents
- Summary: Create a new parent.
- Request Body:
ParentSchema
- Method: GET
- URL:
/parents
- Summary: Get a list of parents.
- Query Parameters:
search
(optional): Search by parent's first name.page
(optional): Page number.limit
(optional): Number of items to display per page.
- Method: PATCH
- URL:
/parents/{parent_id}
- Summary: Update an existing parent.
- Path Parameters:
parent_id
: ID of the parent to update.
- Request Body:
ParentUpdateSchema
- Method: DELETE
- URL:
/parents/{parent_id}
- Summary: Delete an existing parent.
- Path Parameters:
parent_id
: ID of the parent to delete.
- Method: GET
- URL:
/children
- Summary: Get a list of children.
- Query Parameters:
search
(optional): Search by child's first name.page
(optional): Page number.limit
(optional): Number of items to display per page.
- Method: POST
- URL:
/children
- Summary: Create a new child.
- Request Body:
ChildSchema
- Method: PATCH
- URL:
/children/{children_id}
- Summary: Update an existing child.
- Path Parameters:
children_id
: ID of the child to update.
- Request Body:
ChildrenUpdateSchema
- Method: DELETE
- URL:
/children/{children_id}
- Summary: Delete an existing child.
- Path Parameters:
children_id
: ID of the child to delete.
ParentSchema
ParentUpdateSchema
ChildSchema
ChildrenUpdateSchema
HTTPValidationError
ValidationError