Skip to content

Let-s-Jam/letsjamBE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

127 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Flask Heroku Visual Studio Code Slack GitHub Git CircleCI

Python 3.10

Let's Jam - BE

The RESTful API for Let's Jam

Visit the frontend repo

Deployed Site


Local Setup

Assuming you have a mac/unix machine with postgres 14.5, python 3.10.8 and pip 22.2.2 installed:

  • run pip3 install virtualenv then python3 -m venv env to create a local environment for the project
  • run source env/bin/activate to connect to your local environment
  • pip3 install -r requirements.txt to install the required packages
  • python3 run.py to start up the server. By default it will run on http://localhost:8000
  • You're all set to start making some requests!
Database Schema Database Schema
Create, Drop, and Seed the Database

After Local Setup is complete:

  • type flask dbcreate to create the database
  • type flask dbdrop to drop the database
  • type flask dbseed to seed the database
Testing

After Local Setup is complete:

  • type pytest to run tests
  • type coverage run -m pytest to generate % coverage
  • type coverage report to print the coverage report

Endpoints

Show User
Get https://letusjam.herokuapp.com/api/v1/users/1/

{
    "data": {
        "type": "user",
        "id": "1",
        "attributes": {
            "name": "Cory",
            "display_email": "test@test.com",
            "about": "All about me",
            "zipcode": "00001",
            "picture_url": "picture.jpg",
            "instruments": [
                {
                    "id": "1",
                    "name": "piano"
                },
                {
                    "id": "2",
                    "name": "guitar"
                }
            ],
            "needs_instruments": [
                {
                    "id": "1",
                    "name": "piano"
                },
                {
                    "id": "2",
                    "name": "guitar"
                }
            ],
            "genres": [
                {
                    "id": "1",
                    "name": "rock"
                },
                {
                    "id": "2",
                    "name": "jazz"
                }
            ]
        }
    }
}
User Connections
GET https://letusjam.herokuapp.com/api/v1/users/2/connections
{
    "data": {
        "type": "user",
        "id": "2",
        "attributes": {
            "connections_pending": [
                {
                    "id": "3",
                    "name": "333CoryUpdate",
                    "about": "333All about me babyyy",
                    "picture_url": "333asjdlaj.jpg",
                    "instruments": [
                        {
                            "name": "guitar",
                            "id": "2"
                        }
                    ],
                    "needs_instruments": [],
                    "genres": [
                        {
                            "name": "rock",
                            "id": "1"
                        }
                    ]
                }
            ],
            "requests_pending": [],
            "connections": [
                {
                    "id": "1",
                    "name": "333CoryUpdate",
                    "display_email": "333test@test.com",
                    "about": "333All about me babyyy",
                    "zipcode": "00001 edit",
                    "picture_url": "333asjdlaj.jpg",
                    "instruments": [
                        {
                            "name": "piano",
                            "id": "1"
                        },
                        {
                            "name": "guitar",
                            "id": "2"
                        }
                    ],
                    "needs_instruments": [
                        {
                            "name": "piano",
                            "id": "1"
                        },
                        {
                            "name": "guitar",
                            "id": "2"
                        }
                    ],
                    "genres": [
                        {
                            "name": "rock",
                            "id": "1"
                        },
                        {
                            "name": "jazz",
                            "id": "2"
                        }
                    ]
                }
            ]
        }
    }
}
Edit User
PATCH https://letusjam.herokuapp.com/api/v1/users/1/
Content-Type: application/json
Accept: application/json
body:
{
    "name": "Cory",
    "display_email": "email2@email.com",
    "picture_url": "anotherurl.com",
    "about": "about cory",
    "zipcode": "12345"
}
User updated
Create User Connections
POST https://letusjam.herokuapp.com/api/v1/users/<user id>/connections/<friend id>
connection added
Edit User Connections
PATCH https://letusjam.herokuapp.com/api/v1/users/<user id>/connections/<friend id>
Content-Type: application/json
Accept: application/json
body:
{
    "status": ["APPROVED", "REJECTED"]
}
connection updated
Search
Get https://letusjam.herokuapp.com/api/v1/users/1/search?radius=50&instrument=theremin
Optional Query Params: radius, name, instrument, genre

{
    "data": [
        {
            "type": "user",
            "id": "9",
            "attributes": {
                "name": "Bory Cethune",
                "about": "!!!MOAR COWBELL!!!",
                "picture_url": "https://user-images.githubusercontent.com/98188684/197365266-ac37398a-f168-4768-8476-5e36b9a068aa.png",
                "instruments": [
                    {
                        "name": "Piano",
                        "id": "2"
                    },
                    {
                        "name": "Theremin",
                        "id": "9"
                    }
                ],
                "needs_instruments": [],
                "genres": [
                    {
                        "name": "Rock",
                        "id": "2"
                    }
                ],
                "distance": 0.0,
                "connection_status": "nun"
            }
        },
        {
            "type": "user",
            "id": "8",
            "attributes": {
                "name": "Hared Jardinger",
                "about": "Classically trained baroque pianist who is baroque. :') I need some gigs y'all. ",
                "picture_url": "https://user-images.githubusercontent.com/98188684/197365099-0e35cd61-7448-4e62-9005-087404014c99.png",
                "instruments": [
                    {
                        "name": "Guitar",
                        "id": "1"
                    },
                    {
                        "name": "Piano",
                        "id": "2"
                    },
                    {
                        "name": "Drums",
                        "id": "3"
                    },
                    {
                        "name": "Flute",
                        "id": "4"
                    },
                    {
                        "name": "Clarinet",
                        "id": "5"
                    },
                    {
                        "name": "Bass",
                        "id": "6"
                    },
                    {
                        "name": "Triangle",
                        "id": "7"
                    },
                    {
                        "name": "Cowbell",
                        "id": "8"
                    },
                    {
                        "name": "Theremin",
                        "id": "9"
                    },
                    {
                        "name": "Saxophone",
                        "id": "10"
                    }
                ],
                "needs_instruments": [],
                "genres": [
                    {
                        "name": "Rock",
                        "id": "2"
                    },
                    {
                        "name": "Jazz",
                        "id": "10"
                    }
                ],
                "distance": 13.54047013081921,
                "connection_status": "pending"
            }
        },
        {
            "type": "user",
            "id": "7",
            "attributes": {
                "name": "Bichael Monini",
                "about": "Music is my life </3",
                "picture_url": "https://user-images.githubusercontent.com/98188684/197365068-74fc732a-eb69-4a45-826c-6ff39a0af77d.png",
                "instruments": [
                    {
                        "name": "Theremin",
                        "id": "9"
                    }
                ],
                "needs_instruments": [],
                "genres": [
                    {
                        "name": "Pop",
                        "id": "1"
                    },
                    {
                        "name": "Rock",
                        "id": "2"
                    },
                    {
                        "name": "Blues",
                        "id": "3"
                    },
                    {
                        "name": "Electronic",
                        "id": "4"
                    },
                    {
                        "name": "Jam",
                        "id": "5"
                    },
                    {
                        "name": "Rap",
                        "id": "6"
                    },
                    {
                        "name": "Indie",
                        "id": "7"
                    },
                    {
                        "name": "Americana",
                        "id": "8"
                    },
                    {
                        "name": "Folk",
                        "id": "9"
                    },
                    {
                        "name": "Jazz",
                        "id": "10"
                    }
                ],
                "distance": 15.563325869097204,
                "connection_status": "nun"
            }
        },
        {
            "type": "user",
            "id": "1",
            "attributes": {
                "name": "Bna Aennett",
                "about": "I love Angular!",
                "picture_url": "https://user-images.githubusercontent.com/98188684/197364951-4468b500-d855-4436-adad-5f46ccf363f0.png",
                "instruments": [
                    {
                        "name": "Theremin",
                        "id": "9"
                    }
                ],
                "needs_instruments": [],
                "genres": [
                    {
                        "name": "Rock",
                        "id": "2"
                    }
                ],
                "distance": 22.93208462415554,
                "connection_status": "nun"
            }
        }
    ]
}

Backend Team

Frontend Team

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •