- Set up pyenv and pipenv with python 3.12.0
pipenv shell
pipenv install
fastapi run
- Setup MongoDB
- database: alma
- collections: users, leads
- If your MongoDB has different url than
mongodb://localhost:27017
, you need to specify it in .env
- Here is a sample
.env
- SMTP should use SSL
[email protected]
[email protected]
SECRET_KEY=W@ueKuV+diK]M|%*7nzzhm+Ap4N&uBz!%.,lDPwbho[Ut/:ZjNVHRl/<DKU#4s!
DATABASE_URL=mongodb://localhost:27017
SMTP_SERVER_URL=smtp.mail.yahoo.com
SMTP_SERVER_PORT=465
[email protected]
SMTP_APP_PASSWORD=YOUR_APP_PASSWORD
- Signup to test Auth
- In Postman,
POST http://127.0.0.1:8000/signup
- In Body, set form-data with following format
username:[email protected]
password:random_password
- Get token to test Auth
- In Postman,
POST http://127.0.0.1:8000/token
- In Body, set form-data with the same credential when you signed up above.
- Then you will get the token as follows
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhdHRvcm5leV9ncm91cEBhbG1hLmNvbSIsImV4cCI6MTcxNjQ0Mjg5Mn0.hQX0pL5saaWrXOcbw2j0eVQuDup59kGGMdoQUXlBM20",
"token_type": "bearer"
}
How to test "Creating a lead"
- In Postman,
POST http://127.0.0.1:8000/submit_lead
- In Body, set form-data with following format
first_name:John
last_name:Doe
email:[email protected]
resume: Pick file
- When you submit the request, you will get the email.
How to test Getting leads
- In Postman,
GET http://127.0.0.1:8000/get_leads
- In Authorization, select Bearer Token as Auth Type.
- Set Token with the one you got above
- Here is a sample response. You need
_id
for the next test
{
"leads": [
{
"_id": "664e155425407fc84f3ecf1a",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"state": "PENDING",
"resume_filename": "Resume_JunhoPark_SWE_2024_v1.pdf",
"resume_contents": "JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PC9UaXRsZSAoUmVzdW1lX0p1bmhvUGFya19TV0VfMjAyNF92MSkKL1Byb2R1Y2VyIChTa2lhL1BERiBtMTI1IEdvb2dsZSBEb2NzIFJlbmRlcmVyKT4+CmVuZG9iagozIDAgb2JqCjw8L2NhIDEKL0JNIC9Ob3JtYWw+PgplbmRvYmoKOSAwIG9iago8PC9DQSAxCi9jYSAxCi9MQyAwCi9MSiAwCi9MVyAxLjMzMzMzMzM3Ci9NTCAxMAovU0EgdHJ1ZQovQk0gL05vcm1hbD4..."
},
How to test Updating state of lead
- In Postman,
PUT http://127.0.0.1:8000/reach_out/664e155425407fc84f3ecf1a
- In Authorization, select Bearer Token as Auth Type.
- Set Token with the one you got above
- Make sure you put the
_id
you got above into the url
- Here is a sample response
{
"message": "Lead 664eba5ae23803add29056cd marked as REACHED_OUT"
}