Given five files,
SongController.javaSongRepository.javaSongJpaService.javaSongJpaRepository.javaSong.java
And also given a database file songs which contains playlist table.
| Columns | Type |
|---|---|
| songId | INTEGER |
| songName | TEXT |
| lyricist | TEXT |
| singer | TEXT |
| musicDirector | TEXT |
Use only `playlist` as a table name in your code while writing queries and while using in model class.
-
Song.java: TheSongclass should contain the following attributes.Attribute Type songId int songName String lyricist String singer String musicDirector String -
SongRepository.java: Create an interface containing required methods. -
SongJpaService.java: Update the service class with logic for managing song data. -
SongController: Create the controller class to handle HTTP requests. -
SongJpaRepository.java: Create an interface which implements theJpaRepositoryinterface.
Implement the following APIs.
Returns a list of all songs in the playlist.
[
{
"songId": 1,
"songName": "Butta Bomma",
"lyricist": "Ramajogayya Sastry",
"singer": "Armaan Malik",
"musicDirector": "Thaman S"
},
...
]
Creates a new song in the playlist. songId is auto-incremented.
{
"songName": "Bala",
"lyricist": "Siddharth-Garima",
"singer": "Sachin-Jigar",
"musicDirector": "Sachin-Jigar"
}
{
"songId": 6,
"songName": "Bala",
"lyricist": "Siddharth-Garima",
"singer": "Sachin-Jigar",
"musicDirector": "Sachin-Jigar"
}
Returns a song based on a songId. If the given songId is not found in the playlist, raise ResponseStatusException with HttpStatus.NOT_FOUND.
{
"songId": 3,
"songName": "Tum Hi Ho",
"lyricist": "Mithoon",
"singer": "Arijit Singh",
"musicDirector": "Mithoon"
}
Updates the details of a song in the playlist based on the songId and return the updated song details.
If the given songId is not found in the playlist, raise ResponseStatusException with HttpStatus.NOT_FOUND.
{
"singer": "Atif Aslam"
}
{
"songId": 3,
"songName": "Tum Hi Ho",
"lyricist": "Mithoon",
"singer": "Atif Aslam",
"musicDirector": "Mithoon"
}
Deletes a song from the playlist based on the songId. If the given songId is not found in the playlist, raise ResponseStatusException with HttpStatus.NOT_FOUND.
Do not modify the code in the SongApplication.java.
Do not modify anything in the application.properties file
Do not add any Sql files