Skip to content
Snippets Groups Projects
Commit 5272f0dc authored by taegyu jeong's avatar taegyu jeong
Browse files

add delete favorite

parent 432a75eb
No related branches found
No related tags found
No related merge requests found
Pipeline #8390 failed
......@@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -49,4 +50,9 @@ public class MyWebController {
return service.saveFavorite(favorite);
}
@DeleteMapping("/likes/{id}")
@Transactional
public void deleteFavorite(@PathVariable String id){
service.deleteFavorite(id);
}
}
......@@ -8,5 +8,7 @@ import kr.ajousw.myspringweb.entity.FavoriteMusic;
public interface FavoriteRepository extends JpaRepository<FavoriteMusic, String> {
List<FavoriteMusic> findAll();
void deleteById(String id);
}
......@@ -57,4 +57,8 @@ public class MusicService {
return 0;
}
}
public void deleteFavorite(String id){
albumsRepo.deleteById(id);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment