package com.tourguide.api.guide; import com.tourguide.common.api.ApiResponse; import com.tourguide.modules.system.dto.GuideNotificationResponse; import com.tourguide.modules.system.service.GuideNotificationService; import com.tourguide.security.AppUserPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/api/guide/notifications") public class GuideNotificationController { private final GuideNotificationService notificationService; public GuideNotificationController(GuideNotificationService notificationService) { this.notificationService = notificationService; } @GetMapping public ApiResponse> list(@AuthenticationPrincipal AppUserPrincipal principal) { return ApiResponse.success(notificationService.list(principal.getUserId())); } @PutMapping("/{id}/read") public ApiResponse markRead(@AuthenticationPrincipal AppUserPrincipal principal, @PathVariable String id) { notificationService.markRead(principal.getUserId(), id); return ApiResponse.success(); } }