Skip to content
Snippets Groups Projects
Commit 5f2298ff authored by 김영훈's avatar 김영훈
Browse files

Merge branch 'master' into 'main'

Add delete Favorite

See merge request !6
parents 7c519ae5 303a6983
No related branches found
No related tags found
1 merge request!6Add delete Favorite
......@@ -44,4 +44,10 @@ public class MyWebController {
public int postLikes(@RequestBody FavoriteMusicRequestDto favorite) {
return service.saveFavorite(favorite);
}
@DeleteMapping(value="/likes/{id}")
@Transactional
public int deleteById(@PathVariable String id) {
return service.deleteFavorite(id);
}
}
......@@ -7,4 +7,8 @@ import java.util.List;
public interface FavoriteRepository extends JpaRepository<FavoriteMusic, String> {
List<FavoriteMusic> findAll();
@Override
void deleteById(String id);
}
......@@ -71,6 +71,19 @@ public class MusicService {
}
}
public int deleteFavorite(@PathVariable String id) {
try {
albumsRepo.deleteById(id);
return 1;
} catch (Exception e) {
System.out.println(e.toString());
return 0;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment