Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame^] | 1 | package com.example.myproject.controller; |
| 2 | |
| 3 | import com.example.myproject.service.SeedRatingService; |
| 4 | import org.springframework.web.bind.annotation.*; |
| 5 | |
| 6 | import java.util.Map; |
| 7 | |
| 8 | @RestController |
| 9 | @RequestMapping("/echo/ratings") |
| 10 | public class SeedRatingController { |
| 11 | |
| 12 | private final SeedRatingService ratingService; |
| 13 | |
| 14 | public SeedRatingController(SeedRatingService ratingService) { |
| 15 | this.ratingService = ratingService; |
| 16 | } |
| 17 | |
| 18 | @PostMapping |
| 19 | public Map<String, Object> submitRating( |
| 20 | @RequestParam("userId") Long userId, |
| 21 | @RequestParam("seedId") Long seedId, |
| 22 | @RequestParam("score") Integer score |
| 23 | ) { |
| 24 | return ratingService.rateSeed(userId, seedId, score); |
| 25 | } |
| 26 | } |