Skip to content
Snippets Groups Projects
Commit ac118926 authored by 준하 김's avatar 준하 김
Browse files

Merge branch 'master' into 'main'

Add delete Favorite

See merge request !6
parents 6b653af9 8800608f
No related branches found
No related tags found
1 merge request!6Add delete Favorite
...@@ -40,4 +40,9 @@ public class MyWebController { ...@@ -40,4 +40,9 @@ public class MyWebController {
return service.saveFavorite(favorite); return service.saveFavorite(favorite);
} }
@DeleteMapping(value="/likes/{id}")
public void deleteById(@PathVariable String id){
service.deleteFavorite(id);
}
} }
...@@ -7,4 +7,6 @@ import java.util.List; ...@@ -7,4 +7,6 @@ import java.util.List;
public interface FavoriteRepository extends JpaRepository<FavoriteMusic, String> { public interface FavoriteRepository extends JpaRepository<FavoriteMusic, String> {
List<FavoriteMusic> findAll(); List<FavoriteMusic> findAll();
void deleteByCollectionId(String id);
} }
...@@ -54,4 +54,13 @@ public class MusicService { ...@@ -54,4 +54,13 @@ public class MusicService {
return 0; return 0;
} }
} }
public void deleteFavorite(String id){
try{
albumsRepo.deleteByCollectionId(id);
}
catch(Exception e){
System.out.println(e.toString());
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment