- Users can create account with just email and password
- Authenticated users can create profile, providing username, followers count and bio
- One user is liable to have a single profile, that means a user cannot create multiple profiles
- visitors can use the search endpoint to search text in username and bio, minimum followers count and maximum followers count
- search result returns a list of profiles that meets the search criterial
API allows visitors to search for profile username and bio, and profile counts which can either be minimum or maximum followers count, and also allows only authorized users to create profile.
field | data_type | constraints | validation |
---|---|---|---|
id | Object | required | None |
string | required | unique, email must conform to email (example: [email protected]) | |
password | string | required | pasword must contain at least one uppercase, one lowercase, one number, and must be at least 8 characters |
created_at | timestamp | automatically set | None |
field | data_type | constraints | validation |
---|---|---|---|
id | integer | required | None |
username | string | required | None |
followers | Integer | required | None |
bio | String(100) | optional, default value set to None | None |
created_at | timestamp | required, automatically set | None |
owner_id | Integer | required, ForeignKey, Unique | None |
- Route: /
- Method: GET
- Header
- Authorization: None
- Response: Success
{
"message": "Welcome to Instagram Influencer search portal"
}
- Route: /account/signup
- Method: POST
- Header
- Authorization: None
- Body:
{
"email": "[email protected]",
"password": "Password123"
}
- Response: Success
{
"id": 1,
"email": "[email protected]",
"created_at": "2023-02-05T15:29:24.712Z"
}
- Route: /login
- Method: POST
- Body:
{
"email": "[email protected]",
"password": "Password123"
}
- Response: Success
{
"email":"[email protected]",
"access_token": "accesstokenexample&8ofiwhb.fburu276r4ufhwu4.o82uy3rjlfwebj",
"token_type": "Bearer"
}
- Route: /profile
- Method: POST
- Header
- Authorization: Bearer {token}
- Body:
{
"username": "string",
"followers": 100,
"bio": "I am a software developer"
}
- Response: Success
{
"username": "string",
"followers": 100,
"bio": "I am a software developer",
"id": 1,
"created_at": "2023-02-05T19:02:41.204Z",
"owner": {
"id": 1,
"email": "[email protected]",
}
}
-
Route: /search
-
Method: GET
-
Header
- Authorization: None
-
Body:
-
Response: Success
[
{
"username": "string",
"followers": 100,
"bio": "I am a software developer",
"id": 1,
"created_at": "2023-02-05T19:02:41.204Z",
"owner": {
"id": 1,
"email": "[email protected]",
}
},
{
"username": "user",
"followers": 10,
"bio": "I am a devOps Engineer",
"id": 2,
"created_at": "2023-02-05T19:02:41.204Z",
"owner": {
"id": 2,
"email": "[email protected]",
}
},
{
"username": "example",
"followers": 100,
"bio": "I am a Technical writer",
"id": 3,
"created_at": "2023-02-05T19:02:41.204Z",
"owner": {
"id": 3,
"email": "[email protected]",
}
},
]
-
Route: /search?text=Engineer&min_followers=100
-
Method: GET
-
Header
- Authorization: None
-
Body:
-
Response: Success
[
{
"username": "string",
"followers": 100,
"bio": "I am a software developer",
"id": 1,
"created_at": "2023-02-05T19:02:41.204Z",
"owner": {
"id": 1,
"email": "[email protected]",
}
}
]
In order to run this project locally, you would need to have the following installed on your local machine.
- Python ^3.10,
- PostgreSQL
- Docker (Optional)
- Clone this repository
git clone [https://github.com/Nkasi-e/instagram-influencer.git]
- update env with .env.example.txt
- Download all dependecies using
pip install -r requirements.txt
orpoetry install
that's if you have poetry installed already on your machine
- run
uvicorn app.main:app --reload
- run
docker-compose -f decker-compose-dev.yml up -d