Created
January 16, 2021 13:58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.webtutsplus.ecommerce.service; | |
import java.util.List; | |
import javax.transaction.Transactional; | |
import com.webtutsplus.ecommerce.model.WishList; | |
import com.webtutsplus.ecommerce.repository.WishListRepository; | |
import org.springframework.stereotype.Service; | |
@Service | |
@Transactional | |
public class WishListService { | |
private final WishListRepository wishListRepository; | |
public WishListService(WishListRepository wishListRepository) { | |
this.wishListRepository = wishListRepository; | |
} | |
//Create Wishlist | |
public void createWishlist(WishList wishList) { | |
wishListRepository.save(wishList); | |
} | |
//ReadWishlist | |
public List<WishList> readWishList(Integer userId) { | |
return wishListRepository.findAllByUserIdOrderByCreatedDateDesc(userId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment