Skip to content

Commit

Permalink
fix: 알림 등록 API Request Body 로 받도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Lim-Changi committed Jan 25, 2025
1 parent cb7e339 commit 5580e3a
Showing 1 changed file with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package sopt.org.homepage.notification;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import sopt.org.homepage.notification.dto.GetNotificationListRequestDto;
import sopt.org.homepage.notification.dto.GetNotificationListResponseDto;
import sopt.org.homepage.notification.dto.RegisterNotificationRequestDto;
Expand All @@ -16,22 +23,25 @@
@RequestMapping("notification")
@Tag(name = "Notification")
public class NotificationController {
private final NotificationService notificationService;
private final NotificationService notificationService;

@PostMapping("register")
public ResponseEntity<RegisterNotificationResponseDto> registerNotification(
@Valid @RequestBody @ModelAttribute RegisterNotificationRequestDto registerNotificationRequestDto
) {
RegisterNotificationResponseDto result = notificationService.registerNotification(
registerNotificationRequestDto);
return ResponseEntity.status(HttpStatus.CREATED).body(result);
}

@PostMapping("register")
public ResponseEntity<RegisterNotificationResponseDto> registerNotification (
@ParameterObject @ModelAttribute RegisterNotificationRequestDto registerNotificationRequestDto
) {
RegisterNotificationResponseDto result = notificationService.registerNotification(registerNotificationRequestDto);
return ResponseEntity.status(HttpStatus.CREATED).body(result);
}
@GetMapping("/list")
public ResponseEntity<GetNotificationListResponseDto> getAllProject (
@ParameterObject @ModelAttribute GetNotificationListRequestDto getNotificationListRequestDto
) {
GetNotificationListResponseDto result = notificationService.getNotificationEmailList(getNotificationListRequestDto.getGeneration());
return ResponseEntity.status(HttpStatus.OK).body(result);
}
@GetMapping("/list")
public ResponseEntity<GetNotificationListResponseDto> getAllProject(
@ParameterObject @ModelAttribute GetNotificationListRequestDto getNotificationListRequestDto
) {
GetNotificationListResponseDto result = notificationService.getNotificationEmailList(
getNotificationListRequestDto.getGeneration());
return ResponseEntity.status(HttpStatus.OK).body(result);
}
}


0 comments on commit 5580e3a

Please sign in to comment.