package com.xunwang.education.controller;


import com.xunwang.commonutils.JwtUtils;
import com.xunwang.commonutils.R;
import com.xunwang.education.entity.vo.FavoriteCourseVo;
import com.xunwang.education.service.MyFavoriteCoursesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Long
 * @since 2023-01-04
 */
@RestController
@RequestMapping("/education/my-favorite-courses")
public class MyFavoriteCoursesController {

    @Autowired
    private MyFavoriteCoursesService myFavoriteCoursesService;

    @GetMapping("/getFavoriteCourse")
    public R getFavoriteCourse(HttpServletRequest request){
        String id = JwtUtils.getUIdByJwtToken(request);
        List<FavoriteCourseVo>  favoriteCourseVo= myFavoriteCoursesService.getFavoriteCourseInfo(id);
        return R.ok().data("FavoriteCourseVo",favoriteCourseVo);
    }
}

