Giter VIP home page Giter VIP logo

alma_project's Introduction

Instruction

  1. Set up pyenv and pipenv with python 3.12.0
  2. pipenv shell
  3. pipenv install
  4. fastapi run

Test

Preparation

  1. 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
  1. 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
  1. 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"
}

alma_project's People

Contributors

junho7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.