azra-l / festival-fanatic

1 stars 0 forks source link

added way to add new artists and match them with festivals #36

Closed StanfordLin closed 2 years ago

StanfordLin commented 2 years ago

Rn, it's hardcoded with a userId, change it for testing and we can change it to use req.user.session after integrating this with front end

Make a POST request to: http://localhost:3001/matchFestivalsWithListOfSpotifyArtists

with body params:

{
    "listOfArtists": [
        {
            "external_urls": {
                "spotify": "https://open.spotify.com/artist/0Y0QSi6lz1bPik5Ffjr8sd"
            },
            "followers": {
                "href": null,
                "total": 138449
            },
            "genres": [
                "canadian electronic",
                "edm",
                "electro house",
                "electronic trap",
                "electropop",
                "future bass",
                "melodic dubstep",
                "pop dance",
                "pop edm",
                "vapor twitch"
            ],
            "href": "https://api.spotify.com/v1/artists/0Y0QSi6lz1bPik5Ffjr8sd",
            "id": "0Y0QSi6lz1bPik5Ffjr8sd",
            "images": [
                {
                    "height": 640,
                    "url": "https://i.scdn.co/image/ab6761610000e5eb5944586f169166ac0a03735e",
                    "width": 640
                },
                {
                    "height": 320,
                    "url": "https://i.scdn.co/image/ab676161000051745944586f169166ac0a03735e",
                    "width": 320
                },
                {
                    "height": 160,
                    "url": "https://i.scdn.co/image/ab6761610000f1785944586f169166ac0a03735e",
                    "width": 160
                }
            ],
            "name": "Ekali",
            "popularity": 48,
            "type": "artist",
            "uri": "spotify:artist:0Y0QSi6lz1bPik5Ffjr8sd"
        },
        {
            "external_urls": {
                "spotify": "https://open.spotify.com/artist/45eNHdiiabvmbp4erw26rg"
            },
            "followers": {
                "href": null,
                "total": 1279410
            },
            "genres": [
                "edm",
                "melodic dubstep",
                "pop",
                "pop dance",
                "tropical house"
            ],
            "href": "https://api.spotify.com/v1/artists/45eNHdiiabvmbp4erw26rg",
            "id": "45eNHdiiabvmbp4erw26rg",
            "images": [
                {
                    "height": 640,
                    "url": "https://i.scdn.co/image/ab6761610000e5eb6b5fbf615ada187ce5e425c8",
                    "width": 640
                },
                {
                    "height": 320,
                    "url": "https://i.scdn.co/image/ab676161000051746b5fbf615ada187ce5e425c8",
                    "width": 320
                },
                {
                    "height": 160,
                    "url": "https://i.scdn.co/image/ab6761610000f1786b5fbf615ada187ce5e425c8",
                    "width": 160
                }
            ],
            "name": "ILLENIUM",
            "popularity": 72,
            "type": "artist",
            "uri": "spotify:artist:45eNHdiiabvmbp4erw26rg"
        }
    ]
}

Response at the end should be a 200 with:

{
    "message": "Successfully added 2 new artists and 28 new festivals"
}