Skip to content

This is an Java implementation of the backend for a Music Application similar to spodify. Assumptions were made that songs and users are stored in different database. Java Spring Framework was used and thwo databases were communicating through REST-api calls.

Notifications You must be signed in to change notification settings

HaoLiangPao/SpotifyLikeBackend-Microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

SpotifyLikeBackend-Microservice

Backend for Six Degrees of Kevin Bacon

Keywords: Spring Framework, Neo4j, MongoDB, Microservice, GitFlow

1. Descriptions

This is an Java implementation of the backend for a Music Application similar to spodify. Assumptions were made that songs and users are stored in different database. Java Spring Framework was used and thwo databases were communicating through REST-api calls.

  • The backend is running on port 8080.
  • ProfileMicroservice:
    • database connect to: 7687;
    • Neo4j Username: neo4j;
    • Password: password;
  • SongMicroservice:
    • MongoDB name: csc301-test;
    • collection name: songs;

2. Project/IDE Setup

  • Command Line:
    • Install maven
    • To compile your code simply run mvn compile in the root directory (the folder that has pom.xml)
    • To run your code run mvn exec:java
  • Eclipse:
    • File → Import → Maven → Existing Maven Projects
    • Navigate to the project location
    • Right click the project → Maven Build…
    • Input compile exec:java in the Goals input box
    • Click apply then run/close
    • You can now run the project by pressing the green play button
  • Intellij:
    • Import project
    • Navigate to the project location
    • Import project from external model → Maven
    • Next → Next → Next → Finish
    • Add Configuration → + Button → Maven
    • Name the configuration and input exec:java in the Command Line box
    • Apply → Ok
    • You can now run the project by pressing the green play button

3. Node/Relationship Property

  • Song Microservice:

    • Song Schema
      • _id - The ObjectId of the document (i.e. a unique identifier for each document). The id is auto-generated by Mongo when a document is inserted into the database
      • songName - The name of the song
      • songArtistFullName - The full name of the artist of the song
      • songAlbum - The album the song belongs to
      • songAmountFavourites - The amount of Profiles that have favourited the Song
    • DB Methods
      • DbQueryStatus addSong(Song songToAdd) - Adds the specified song to the Mongo DB
      • DbQueryStatus findSongById(String songId) - Returns the specified Song that matches the songId
      • DbQueryStatus getSongTitleById(String songId) - Returns the song title which matches the songId
      • DbQueryStatus deleteSongById(String songId) - Deletes the specified song from the Mongo DB
      • DbQueryStatus updateSongFavouritesCount(String songId, boolean shouldDecrement) - Increments/decrements a Song’s like count
  • Profile Microservice:

    • Node schema:
      • “profile”
      • “song”
      • “playlist”
    • The relationships:
      • (:profile)-[:created]->(:playlist)
      • (profile)-[:follows]->(:profile)
      • (:playlist)-[:includes]->(:song)
    • DB Methods to Implement
      • DbQueryStatus likeSong(String userName, String songId) - Adds the songId to the Profile’s favourites list
      • DbQueryStatus unlikeSong(String userName, String songId) - Removes the songId from the Profile’s favourites list
      • DbQueryStatus deleteSongFromDb(String songId) - Deletes the songId from all favourites playlist
      • DbQueryStatus createUserProfile(String userName, String fullName, String password) - Creates the Profile and adds it to the Neo4J DB
      • DbQueryStatus followFriend(String userName, String frndUserName) - Allows the userName Profile to follow the frndUserName Profile
      • DbQueryStatus unfollowFriend(String userName, String frndUserName) - Allows the userName Profile to unfollow the frndUserName Profile
      • DbQueryStatus getAllSongFriendsLike(String userName)

4. Testing

About

This is an Java implementation of the backend for a Music Application similar to spodify. Assumptions were made that songs and users are stored in different database. Java Spring Framework was used and thwo databases were communicating through REST-api calls.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published