package rd.controller.score;

import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.stp.StpUtil;
import rd.data.dto.score.StudentScore;
import rd.data.model.response.Response;
import rd.service.score.ScoreService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student/score")
public class StudentScoreController {

    private final ScoreService scoreService;

    public StudentScoreController(ScoreService scoreService) {
        this.scoreService = scoreService;
    }

    @SaCheckRole("STUDENT")
    @RequestMapping("/all")
    public Response<List<StudentScore>> getAll() {
        var uid = StpUtil.getLoginIdAsLong();
        var result = scoreService.getStudentAllScore(uid, null);

        return Response.success(result);
    }
}
