Skip to content

Mango-WorldWide/Mango-Music

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mango Music

Please visit our website at:

mango-music-4c4k.onrender.com

For more info about this project please check out our wiki!

Home Page

image

Albums

Screen Shot 2023-05-13 at 1 00 04 PM

Individual Album

Screen Shot 2023-05-13 at 1 02 23 PM

Current User's Albums

Screen Shot 2023-05-13 at 1 32 01 PM

Individual Album Owned by User

Screen Shot 2023-05-13 at 1 30 09 PM

Current User's Playlists

Screen Shot 2023-05-13 at 1 00 36 PM

Individual Playlist

Screen Shot 2023-05-13 at 1 01 14 PM

Routes

~Users~

POST api/auth/signup

Sign up and automatically log in user.

Request:

  • Headers:

    • Content-Type: application/json
  • Body ("artist" field not required):

    {
        "email": "[email protected]",
        "password": "password",
        "username": "DemoUser1",
        "first_name": "Demo",
        "last_name": "User",
        "artist": true
    }

Successful Response Body:

{
    "artist": true,
    "artist_id": 1,
    "email": "[email protected]",
    "first_name": "Demo",
    "id": 1,
    "last_name": "User",
    "playlists": [],
    "username": "DemoUser1"
}

POST api/auth/login

Log in a user.

Request:

  • Headers:

    • Content-Type: application/json
  • Body (all fields required):

    {
        "email": "[email protected]",
        "password": "password"
    }

Successful Response Body:

{
    "artist": true,
    "artist_id": 1,
    "email": "[email protected]",
    "first_name": "Demo",
    "id": 1,
    "last_name": "User",
    "playlists": [
        {
            "cover": "https://filmdaily.co/wp-content/uploads/2020/08/fitness-2.jpg",
            "description": "Gym Music",
            "id": 1,
            "title": "DemoUser1 Jammy Jams",
            "user_id": 1
        }
    ],
    "username": "DemoUser1"
}

GET api/auth/logout

Log out user.

Successful Response Body:

{
    "message": "User logged out",
}

~Albums~

GET api/albums

Returns all the albums from the database.

Successful Response Body:

{
    "Albums": [
        {
        "id": 1,
        "title": "Greatest Hit" ,
        "description": "The first greatest hits album released by American boy band, the Backstreet Boys. The album   features 15 songs by the group, as well as a new song, 'Drowning'" ,
        "cover": "https://lastfm.freetls.fastly.net/i/u/ar0/9ad371267e3a4889a7cf9b436ba17297.jpg" ,
        "genre": "Pop",
        "year": 2001,
        "artist_id": 1,
        "artist": "Backstreet Boys",
        },
        {
        "id": 2,
        "title": "Un Verano Sin Ti" ,
        "description": "The fourth solo studio album, and fifth overall, by Puerto Rican rapper and singer Bad Bunny." ,
        "cover": "https://media.pitchfork.com/photos/627425dbc85171592b8a6e6a/1:1/w_600/Bad-Bunny-Un-Verano-Sin-Ti.jpg" ,
        "genre": "Reggaeton",
        "year": 2022,
        "artist_id": 2,
        "artist": "Bad Bunny",
        }
    ]
}

GET api/albums/:albumId

Returns one album and all of its songs from the database.

Successful Response Body:

{
    "Album": {
        "artist": "Backstreet Boys",
        "artist_id": 4,
        "cover": "https://lastfm.freetls.fastly.net/i/u/ar0/9ad371267e3a4889a7cf9b436ba17297.jpg",
        "description": "The first greatest hits album released by American boy band, the Backstreet Boys. The album features 15 songs by the group, as well as a new song, \"Drowning\".",
        "genre": "Pop",
        "id": 1,
        "title": "Greatest Hit",
        "year": 2001
    },
    "Songs": [
        {
            "album_id": 1,
            "artist_id": 4,
            "duration": null,
            "genre": "Pop",
            "id": 24,
            "lyrics": null,
            "mp3": "",
            "title": "I Want It That Way"
        },
        {
            "album_id": 1,
            "artist_id": 4,
            "duration": null,
            "genre": "Pop",
            "id": 25,
            "lyrics": null,
            "mp3": "",
            "title": "Everybody (Backstreet's Back)"
        }
    ]
}

GET api/albums/artist

Returns all the albums for the logged in artist*

* Login REQUIRED and User MUST be artist

Successful Response Body:

[
    {
        "cover": "https://i.pinimg.com/originals/f6/28/59/f6285960dafff1ff62f24515459cdabe.jpg",
        "description": "Graduation is the third studio album by American rapper and producer Kanye West, released on September 11, 2007, through Def Jam Recordings and Roc-A-Fella Records.",
        "genre": "Hip Hop",
        "id": 7,
        "title": "Graduation",
        "year": 2007
    }
]

Error Response 403: Unauthorized

{
    "message": "Must be an artist to access this page"
}

POST api/albums

Create an album*

* Login REQUIRED and User MUST be artist

Request:

  • Headers:

    • Content-Type: application/json
  • Body (all fields required):

    {
        "cover": "https://i.pinimg.com/originals/f6/28/59/f6285960dafff1ff62f24515459cdabe.jpg",
        "description": "Graduation is the third studio album by American rapper and producer Kanye West, released on September 11, 2007, through Def Jam Recordings and Roc-A-Fella Records.",
        "genre": "Hip Hop",
        "title": "Graduation",
        "year": 2007,
        "artist_id": 1
    }

Successful Response Body:

    {
        "cover": "https://i.pinimg.com/originals/f6/28/59/f6285960dafff1ff62f24515459cdabe.jpg",
        "description": "Graduation is the third studio album by American rapper and producer Kanye West, released on September 11, 2007, through Def Jam Recordings and Roc-A-Fella Records.",
        "genre": "Hip Hop",
        "id": 7,
        "title": "Graduation",
        "year": 2007,
        "artist_id": 1
    }

Error Response 403: Unauthorized

{
    "message": "Must be an artist"
}

PUT api/albums/:albumId/edit

Update an album*

* Login REQUIRED and User MUST be artist who owns the album

Request:

  • Headers:

    • Content-Type: application/json
  • Body (all fields required):

    {
        "cover": "https://i.pinimg.com/originals/f6/28/59/f6285960dafff1ff62f24515459cdabe.jpg",
        "description": "Graduation is the third studio album by American rapper and producer Kanye West, released on September 11, 2007, through Def Jam Recordings and Roc-A-Fella Records.",
        "genre": "Hip Hop",
        "title": "Graduation",
        "year": 2007
    }

Successful Response Body:

    {
        "cover": "https://i.pinimg.com/originals/f6/28/59/f6285960dafff1ff62f24515459cdabe.jpg",
        "description": "Graduation is the third studio album by American rapper and producer Kanye West, released on September 11, 2007, through Def Jam Recordings and Roc-A-Fella Records.",
        "genre": "Hip Hop",
        "id": 7,
        "title": "Graduation",
        "year": 2007
    }

Error Response 403: Unauthorized

{
    "message": "Must be an artist and own album to access this page"
}

DELETE api/albums/:albumId

Deletes an album*

* Login REQUIRED and User MUST be artist who owns the album

Successful Response Body:

{
    "Album": {
        "artist": "Backstreet Boys",
        "artist_id": 4,
        "cover": "https://lastfm.freetls.fastly.net/i/u/ar0/9ad371267e3a4889a7cf9b436ba17297.jpg",
        "description": "The first greatest hits album released by American boy band, the Backstreet Boys. The album features 15 songs by the group, as well as a new song, \"Drowning\".",
        "genre": "Pop",
        "id": 1,
        "title": "Greatest Hit",
        "year": 2001
    },
    "Songs": [
        {
            "album_id": 1,
            "artist_id": 4,
            "duration": null,
            "genre": "Pop",
            "id": 24,
            "lyrics": null,
            "mp3": "",
            "title": "I Want It That Way"
        },
        {
            "album_id": 1,
            "artist_id": 4,
            "duration": null,
            "genre": "Pop",
            "id": 25,
            "lyrics": null,
            "mp3": "",
            "title": "Everybody (Backstreet's Back)"
        }
    ]
}

~Songs~

GET api/songs

Returns all the songs from the database.

Successful Response Body:

{
"Songs":  [
		{
		"album":  "Un Verano Sin Ti",
		"album_cover":  "https://media.pitchfork.com/photos/627425dbc85171592b8a6e6a/1:1/w_600/Bad-Bunny-		Un-Verano-Sin-Ti.jpg",
		"album_id":  2,
		"artist_id":  9,
		"artist_name":  "Bad Bunny",
		"duration":  null,
		"genre":  "Reggaeton",
		"id":  1,
		"lyrics":  null,
		"mp3":  "",
		"title":  "Moscow Mule"
		},
		{
		"album":  "WASTELAND",
		"album_cover":  "https://upload.wikimedia.org/wikipedia/en/5/51/Brent_Faiyaz_-_Wasteland.jpeg",
		"album_id":  4,
		"artist_id":  6,
		"artist_name":  "Brent Faiyaz",
		"duration":  null,
		"genre":  "R&B",
		"id":  60,
		"lyrics":  null,
		"mp3":  "",
		"title":  "DEAD MAN WALKING"
		},
		...
	]
}

GET api/songs/:songId

Returns one song with a valid mp3 file from the database.

Successful Response Body:

{
	"album_id":  4,
	"artist_id":  6,
	"duration":  null,
	"genre":  "R&B",
	"id":  50,
	"lyrics":  null,
	"mp3":  "http://mango-music.s3.amazonaws.com/eb74af047f5d4442889791d08df23687.mp3",
	"title":  "GRAVITY (FEAT. TYLER, THE CREATOR)"
}

POST api/songs/new

Create a song for a specific album*

* Login REQUIRED and User MUST be artist

Request:

  • Headers:

    • Content-Type: application/json
  • Body (all fields required):

    {
        "title": "I Wonder",
        "genre": "Hip Hop",
        "mp3": ".../my-music/songs/I Wonder.mp3",
        "album_id": 7
    }

Successful Response Body:

{
	"album":  "Graduation",
	"album_cover":  "https://i.pinimg.com/originals/f6/28/59/f6285960dafff1ff62f24515459cdabe.jpg",
	"album_id":  7,
	"artist_id":  8,
	"artist_name":  "Kanye West",
	"duration":  null,
	"genre":  "Hip Hop",
	"id":  132,
	"lyrics":  null,
	"mp3":  "",
	"title":  "I Wonder"
}

Error Response 403: Unauthorized

{
    "message": "Must be an artist"
}

PUT api/songs/:songId

Update a song

* Login REQUIRED and User MUST be artist who owns the song

Request:

  • Headers:
    • Content-Type: application/json
  • Body (all fields required):
{
	"title":  "new Title",
	"genre":  "new Genre",
}

Successful Response Body:

{
	"album":  "Graduation",
	"album_cover":  "https://i.pinimg.com/originals/f6/28/59/f6285960dafff1ff62f24515459cdabe.jpg",
	"album_id":  7,
	"artist_id":  8,
	"artist_name":  "Kanye West",
	"duration":  null,
	"genre":  "new Genre",
	"id":  132,
	"lyrics":  null,
	"mp3":  "",
	"title":  "new Title"
}

Error Response 403: Unauthorized

{
    "message": "You are not the artist"
}

DELETE api/songs/:songId

Delete a song

* Login REQUIRED and User MUST be artist who owns the song

Successful Response Body:

{
	"album":  "Graduation",
	"album_cover":  "https://i.pinimg.com/originals/f6/28/59/f6285960dafff1ff62f24515459cdabe.jpg",
	"album_id":  7,
	"artist_id":  8,
	"artist_name":  "Kanye West",
	"duration":  null,
	"genre":  "Hip Hop",
	"id":  98,
	"lyrics":  null,
	"mp3":  "",
	"title":  "Good Morning"
}

Error Response 403: Unauthorized

{
    "message": "You are not the artist"
}

~Playlists~


GET api/playlists/current

Returns all the playlists for the user*

* Login REQUIRED

Successful Response Body:

[
    {
        "cover": "https://filmdaily.co/wp-content/uploads/2020/08/fitness-2.jpg",
        "description": "Gym Music",
        "id": 1,
        "num_songs": 1,
        "songs": [
            {
                "id": 1,
                "songs": {
                    "album_id": 2,
                    "album_title": "Un Verano Sin Ti",
                    "artist_id": 9,
                    "artist_name": "Bad Bunny",
                    "cover": "https://media.pitchfork.com/photos/627425dbc85171592b8a6e6a/1:1/w_600/Bad-Bunny-Un-Verano-Sin-Ti.jpg",
                    "duration": null,
                    "genre": "Reggaeton",
                    "id": 1,
                    "lyrics": null,
                    "mp3": "",
                    "title": "Moscow Mule"
                }
            }
        ],
        "title": "DemoUser Jammy Jams",
        "user_id": 1
    }
]

Error Response 403: Unauthorized

{
    "message": "Must be logged in to access this page"
}

GET api/playlist/:playlistId

Returns a single playlist from the database.

Successful Response Body:

{
        "cover": "https://filmdaily.co/wp-content/uploads/2020/08/fitness-2.jpg",
        "description": "Gym Music",
        "id": 1,
        "num_songs": 1,
        "songs": [
            {
                "id": 1,
                "songs": {
                    "album_id": 2,
                    "album_title": "Un Verano Sin Ti",
                    "artist_id": 9,
                    "artist_name": "Bad Bunny",
                    "cover": "https://media.pitchfork.com/photos/627425dbc85171592b8a6e6a/1:1/w_600/Bad-Bunny-Un-Verano-Sin-Ti.jpg",
                    "duration": null,
                    "genre": "Reggaeton",
                    "id": 1,
                    "lyrics": null,
                    "mp3": "",
                    "title": "Moscow Mule"
                }
            }
        ],
        "title": "DemoUser Jammy Jams",
        "user_id": 1
}

POST api/playlists

Create a playlist*

* Login REQUIRED

Request:

  • Headers:

    • Content-Type: application/json
  • Body (all fields required):

    {
        "cover": "https://filmdaily.co/wp-content/uploads/2020/08/fitness-2.jpg",
        "description": "Coding Music",
        "title": "DemoUser Jammy Jams 2",
    }

Successful Response Body:

    {
        "cover": "https://filmdaily.co/wp-content/uploads/2020/08/fitness-2.jpg",
        "description": "Coding Music",
        "title": "DemoUser Jammy Jams 2",
        "id": 2
    }

Error Response 403: Unauthorized

{
    "message": "Must be logged in to access this page"
}

PUT api/playlist/:playlistId/edit

Update a playlist*

* Login REQUIRED and User MUST own the playlist

Request:

  • Headers:

    • Content-Type: application/json
  • Body (all fields required):

    {
        "cover": "https://filmdaily.co/wp-content/uploads/2020/08/fitness-2.jpg",
        "description": "Coding Music",
        "title": "DemoUser Jammy Jams 2",
    }

Successful Response Body:

    {
        "cover": "https://filmdaily.co/wp-content/uploads/2020/08/fitness-2.jpg",
        "description": "Coding Music",
        "title": "DemoUser Jammy Jams 2",
        "id": 2
    }

Error Response 403: Unauthorized

{
    "message": "Must own playlist to access this page"
}

POST api/playlist/:playlistId/song

Add song to a playlist*

* Login REQUIRED and User MUST own the playlist

Request:

  • Headers:

    • Content-Type: application/json
  • Body (all fields required):

    {
        "song_id": 1
    }

Successful Response Body:

    {
        "message": "success"
    }

Error Response 403: Unauthorized

{
    "message": "Must own playlist to access this page"
}

DELETE api/playlists/:playlistId

Deletes a playlist*

* Login REQUIRED and User MUST own the playlist

Successful Response Body:

    {
        "cover": "https://filmdaily.co/wp-content/uploads/2020/08/fitness-2.jpg",
        "description": "Coding Music",
        "title": "DemoUser Jammy Jams 2",
        "id": 2
    }

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages