This is the backend engine Selector, a web application that connects users with Spotify and Discogs, for a seamless, music browsing (and eventually "purchasing") experience. The application is built with service oriented architecture. The backend communicates with the frontend using our choice of "stretch technology" for this project, as a single GraphQL endpoint, which supplies data from multiple other endpoints the Back End is interacting with. The database currently stores "Favorites", but there are plans for much more, starting with users.
- Reggie Thompson | LinkedIn
- Max Bregman | LinkedIn
- Marika Shanahan | LinkedIn
- Megan Gonzales | LinkedIn
- Adam J. Bowers | LinkedIn
- Jordan Beck | LinkedIn
https://turing-selector.herokuapp.com/
To explore the full web application, please visit the built out front end application that hooks into this engine and its endpoints.
This project was tested with:
- [RSpec] version 3.10
- [Postman] (https://www.postman.com/) Explore and test the API endpoints using Postman, and use Postman’s CLI to execute collections directly from the command-line.
- [pry] https://github.com/pry/pry
- [VCR] https://github.com/vcr/vcr
- Getting Started
- Endpoints
- Project Architecture
- Database Schema
- Application Features
- Testing
- How to Contribute
- Roadmap
- Contributors
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. Endpoints can be added to GraphQL, if you plan to use this Back End engine with the frontend web application, however if the endpoints are changed subsequent updates will be necessary on the Frontend repository code.
-
Ruby
- The project is built with rubyonrails using ruby version 2.5.3p105, you must install ruby on your local machine first. Please visit the ruby home page to get set up. Please ensure you install the version of ruby noted above.
-
Rails
gem install rails --version 5.2.5
-
Postgres database
- Visit the postgresapp homepage and follow their instructions to download the latest version of Postgres app.
- Clone the repo
$ git clone https://github.com/selector-turing/back_end
- Bundle Install
$ bundle install
- Create, migrate and seed rails database
$ rails db:{create,migrate}
| /graphql |
All endpoints use a POST method.
All endpoints rely on GraphQL to perform queries and mutations of data.
- The following queries rely on the third-party APIs from Discogs and Spotify: album, randomAlbum, artistAlbums, and spotifyAlbumID.
- The follwoing queries and mutation rely on the the internal database of the app: favorites and createFavorite.
{
album(title: "The Payback"){
id
title
artists {
name
}
year
genres
coverImage
resourceUrl
styles
year
tracklist {
position
title
duration
}
uri
}
}
Required arguments: title.
{
randomAlbum {
id
title
artists {
name
}
year
genres
coverImage
resourceUrl
styles
year
tracklist {
position
title
duration
}
uri
randomAlbumSpotifyId
}
}
{
artistAlbums(artist: "James Brown"){
artist
title
id
coverImage
format
year
label
}
}
Required arguments: artist.
query {
favorites {
id
albumId
title
artists
year
genres
coverImage
tracklist
uri
}
}
Required returned fields: id, title, artists, year, and genres.
{
spotifyAlbumId(title: "The Payback"){
id
}
}
Required arguments: title.
mutation {
createFavorite(input: {
albumId: 33990,
title: "The Payback",
artists: "James Brown",
year: 1973,
genres: "Funk / Soul",
coverImage: "https://img.discogs.com/MUELn9ObTL-ZpxyUgF5M9D_Kumc=/fit-in/600x591/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-719877-1247870750.jpeg.jpg",
tracklist: "tracklist",
uri: "uri"
}) {
favorite {
albumId
title
artists
year
genres
tracklist
uri
}
errors
}
}
Required fields: albumId, title, artists, and year.
- To run an example postman endpoint, start the Selector Back End engine in locally then in post man run (GET https://api.discogs.com/masters/33990)
In addition to favorites, the team has plans to add users, merchants and registration/login with authorization.
A few examples of things we are testing.
- To run the full test suite run the below in your terminal:
$ bundle exec rspec
- To run an individual test file run the below in tour terminal:
$ bundle exec rspec <file path>
for example: bundle exec rspec spec/features/host/dashboard/index_spec.rb
In the spirit of collaboration, things done together are better than done on our own. If you have any amazing ideas or contributions on how we can improve this API they are greatly appreciated. To contribute:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
See the open issues for a list of proposed features (and known issues). Please open an issue ticket if you see an existing error or bug.




