Skip to content

Commit

Permalink
Merge pull request #31 from Central-MakeUs/feature/9
Browse files Browse the repository at this point in the history
Feature/9: Swagger API λͺ…μ„Έ ꡬ체화 및 μ „λ°˜μ μΈ API μˆ˜μ •
  • Loading branch information
yxhwxn authored Aug 9, 2024
2 parents 322ded8 + 0e65f3d commit 5c74f6f
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 91 deletions.
28 changes: 11 additions & 17 deletions src/main/java/com/cmc/suppin/event/crawl/controller/CommentApi.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.cmc.suppin.event.crawl.controller;

import com.cmc.suppin.event.crawl.controller.dto.CommentRequestDTO;
import com.cmc.suppin.event.crawl.controller.dto.CommentResponseDTO;
import com.cmc.suppin.event.crawl.service.CommentService;
import com.cmc.suppin.global.response.ApiResponse;
import com.cmc.suppin.global.security.reslover.Account;
import com.cmc.suppin.global.security.reslover.CurrentAccount;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

Expand All @@ -30,31 +30,25 @@ public class CommentApi {

@GetMapping("/list")
@Operation(summary = "크둀링된 전체 λŒ“κΈ€ 쑰회 API",
description = "주어진 이벀트 ID와 URL의 λŒ“κΈ€μ„ νŽ˜μ΄μ§€λ„€μ΄μ…˜ν•˜μ—¬ 이벀트의 endDate 전에 μž‘μ„±λœ λŒ“κΈ€λ“€λ§Œ μ‘°νšŒν•©λ‹ˆλ‹€.<br><br>" +
"Request: eventId: μ‘°νšŒν•  이벀트의 ID, url: λŒ“κΈ€μ„ μ‘°νšŒν•  유튜브 URL, page: μ‘°νšŒν•  νŽ˜μ΄μ§€ 번호 (1λΆ€ν„° μ‹œμž‘), " +
"size: ν•œ νŽ˜μ΄μ§€λ‹Ή λŒ“κΈ€ 수, Authorization: JWT 토큰을 ν¬ν•¨ν•œ 인증 헀더<br>" +
"Response: totalCommentCount: 전체 λŒ“κΈ€ 수, participantCount: ν˜„μž¬ νŽ˜μ΄μ§€μ—μ„œ κ°€μ Έμ˜¨ λŒ“κΈ€ 수, crawlTime: λŒ“κΈ€ 쑰회(크둀링) μš”μ²­ μ‹œκ°„, comments: 각 λŒ“κΈ€μ˜ 상세 정보 λ°°μ—΄" +
"author: λŒ“κΈ€ μž‘μ„±μž, commentText: λŒ“κΈ€ λ‚΄μš©, commentDate: λŒ“κΈ€ μž‘μ„± μ‹œκ°„")
description = "주어진 이벀트 ID와 URL의 λŒ“κΈ€μ„ νŽ˜μ΄μ§€λ„€μ΄μ…˜ν•˜μ—¬ 이벀트의 endDate 전에 μž‘μ„±λœ λŒ“κΈ€λ“€λ§Œ μ‘°νšŒν•©λ‹ˆλ‹€. μžμ„Έν•œ μš”μ²­ 및 응닡 ν˜•μ‹μ€ λ…Έμ…˜ API λ¬Έμ„œλ₯Ό μ°Έκ³ ν•΄μ£Όμ„Έμš”.")
public ResponseEntity<ApiResponse<CommentResponseDTO.CrawledCommentListDTO>> getComments(
@RequestParam Long eventId,
@RequestParam String url,
@Parameter(description = "μ‘°νšŒν•  νŽ˜μ΄μ§€ 번호 (1λΆ€ν„° μ‹œμž‘)")
@RequestParam int page,
@Parameter(description = "ν•œ νŽ˜μ΄μ§€λ‹Ή λŒ“κΈ€ 수")
@RequestParam int size,
@CurrentAccount Account account) {
CommentResponseDTO.CrawledCommentListDTO comments = commentService.getComments(eventId, url, page, size, account.userId());
return ResponseEntity.ok(ApiResponse.of(comments));
}

@GetMapping("/draft-winners")
@Operation(summary = "쑰건별 λ‹Ήμ²¨μž 좔첨 API", description = "주어진 쑰건에 따라 이벀트의 λ‹Ήμ²¨μžλ₯Ό μΆ”μ²¨ν•©λ‹ˆλ‹€.")
@PostMapping("/draft-winners")
@Operation(summary = "쑰건별 λ‹Ήμ²¨μž 좔첨 API(λŒ“κΈ€ 이벀트)", description = "주어진 쑰건에 따라 이벀트의 λ‹Ήμ²¨μžλ₯Ό μΆ”μ²¨ν•©λ‹ˆλ‹€.")
public ResponseEntity<ApiResponse<CommentResponseDTO.WinnerResponseDTO>> drawWinners(
@RequestParam Long eventId,
@RequestParam String startDate,
@RequestParam String endDate,
@RequestParam int winnerCount,
@RequestParam List<String> keywords,
@RequestBody @Valid CommentRequestDTO.WinnerRequestDTO request,
@CurrentAccount Account account) {
CommentResponseDTO.WinnerResponseDTO winners = commentService.drawWinners(eventId, startDate, endDate, winnerCount, keywords, account.userId());
CommentResponseDTO.WinnerResponseDTO winners = commentService.drawWinners(request, account.userId());
return ResponseEntity.ok(ApiResponse.of(winners));
}

Expand Down
14 changes: 10 additions & 4 deletions src/main/java/com/cmc/suppin/event/crawl/controller/CrawlApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ public class CrawlApi {
@GetMapping("/comments/checkUrl")
@Operation(summary = "크둀링 쀑볡 검증 API",
description = "주어진 URLκ³Ό eventId둜 μ€‘λ³΅λœ λŒ“κΈ€ μˆ˜μ§‘ 이λ ₯이 μžˆλŠ”μ§€ ν™•μΈν•©λ‹ˆλ‹€.<br><br>" +
"Request: url: 쀑볡 검증할 URL, eventId: 쀑볡 검증할 이벀트 ID, Authorization: JWT 토큰을 ν¬ν•¨ν•œ 인증 헀더<br>" +
"Response: μ€‘λ³΅λœ λŒ“κΈ€ μˆ˜μ§‘ 이λ ₯이 μžˆμ„ 경우 message 좜λ ₯, 없을 경우 null")
"Request<br>" +
"- url: 쀑볡 검증할 URL<br>" +
"- eventId: λŒ“κΈ€ 이벀트 생성 ν›„ μž…λ ₯ 받은 eventId<br><br>" +
"Response<br>" +
"- μš”μ²­λœ URLκ³Ό μ€‘λ³΅λœ λŒ“κΈ€ μˆ˜μ§‘ 이λ ₯이 μžˆμ„ 경우 '검증 및 ν™•μΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€.' 좜λ ₯<br>" +
"- μš”μ²­λœ URLκ³Ό μ€‘λ³΅λœ λŒ“κΈ€ μˆ˜μ§‘ 이λ ₯이 없을 경우 'μˆ˜μ§‘ 이λ ₯이 μ—†μŠ΅λ‹ˆλ‹€.' 좜λ ₯")
public ResponseEntity<ApiResponse<String>> checkExistingComments(@RequestParam String url, @RequestParam Long eventId, @CurrentAccount Account account) {
String message = crawlService.checkExistingComments(url, eventId, account.userId());
if (message != null) {
Expand All @@ -40,9 +44,11 @@ public ResponseEntity<ApiResponse<String>> checkExistingComments(@RequestParam S
// 유튜브 λŒ“κΈ€ 크둀링(DB μ €μž₯)
@PostMapping("/crawling/comments")
@Operation(summary = "유튜브 λŒ“κΈ€ 크둀링 API",
description = "주어진 URL의 유튜브 λŒ“κΈ€μ„ ν¬λ‘€λ§ν•˜μ—¬ DB에 μ €μž₯ν•©λ‹ˆλ‹€.<br><br>" +
description = "주어진 URL의 유튜브 λŒ“κΈ€μ„ ν¬λ‘€λ§ν•˜μ—¬ ν•΄λ‹Ή λŒ“κΈ€ 데이터λ₯Ό DB에 μ €μž₯ν•©λ‹ˆλ‹€.<br><br>" +
"Request: url: 크둀링할 URL, eventId: λŒ“κΈ€μ„ μˆ˜μ§‘ν•  eventId, forceUpdate: λŒ“κΈ€μ„ κ°•μ œλ‘œ μ—…λ°μ΄νŠΈν• μ§€ μ—¬λΆ€(Boolean), Authorization: JWT 토큰을 ν¬ν•¨ν•œ 인증 헀더 <br><br>" +
"forceUpdate μž…λ ₯ 값이 false일 λ•Œ μ„€λͺ… <br> " +
"<forceUpdate μž…λ ₯ 값이 true일 λ•Œ> <br> " +
"- λ™μΌν•œ URL에 λŒ€ν•œ λŒ“κΈ€ 크둀링 μš”μ²­μ΄μ§€λ§Œ, κ°•μ œλ‘œ μ—…λ°μ΄νŠΈν•˜κ² λ‹€λŠ” 의미이기 λ•Œλ¬Έμ—, κΈ°μ‘΄ λŒ“κΈ€ 데이터λ₯Ό μ‚­μ œν•˜κ³  μƒˆλ‘œ λ“±λ‘ν•©λ‹ˆλ‹€. <br><br>" +
"<forceUpdate μž…λ ₯ 값이 false일 λ•Œ> <br> " +
"- DB에 κΈ°μ‘΄ λŒ“κΈ€μ΄ μ‘΄μž¬ν•˜λŠ” 경우: 크둀링을 μ€‘μ§€ν•˜κ³  μ˜ˆμ™Έλ₯Ό λ˜μ§‘λ‹ˆλ‹€. <br>" +
"- DB에 κΈ°μ‘΄ λŒ“κΈ€μ΄ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” 경우: μƒˆλ‘œμš΄ λŒ“κΈ€μ„ ν¬λ‘€λ§ν•˜κ³  이λ₯Ό DB에 μ €μž₯ν•©λ‹ˆλ‹€.")
public ResponseEntity<ApiResponse<String>> crawlYoutubeComments(@RequestParam String url, @RequestParam Long eventId, @RequestParam boolean forceUpdate, @CurrentAccount Account account) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cmc.suppin.event.crawl.controller.dto;

import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -26,9 +27,14 @@ public static class CommentListRequestDTO {
@Builder
public static class WinnerRequestDTO {
private Long eventId;
private int winnerCount;
private int minLength;

@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String startDate;
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String endDate;
private int winnerCount;

private List<String> keywords;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static class CommentDetailDTO {
@Builder
public static class WinnerResponseDTO {
private int winnerCount;
private int minLength;
private String startDate;
private String endDate;
private List<CommentDetailDTO> winners;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cmc.suppin.event.crawl.converter;

import com.cmc.suppin.event.crawl.controller.dto.CommentRequestDTO;
import com.cmc.suppin.event.crawl.controller.dto.CommentResponseDTO;
import com.cmc.suppin.event.crawl.domain.Comment;
import com.cmc.suppin.event.events.domain.Event;
Expand Down Expand Up @@ -42,15 +43,16 @@ public static CommentResponseDTO.CrawledCommentListDTO toCommentListDTO(List<Com
.build();
}

public static CommentResponseDTO.WinnerResponseDTO toWinnerResponseDTO(List<Comment> winners, int winnerCount, String startDate, String endDate) {
public static CommentResponseDTO.WinnerResponseDTO toWinnerResponseDTO(List<Comment> winners, CommentRequestDTO.WinnerRequestDTO request) {
List<CommentResponseDTO.CommentDetailDTO> winnerDetails = winners.stream()
.map(CommentConverter::toCommentDetailDTO)
.collect(Collectors.toList());

return CommentResponseDTO.WinnerResponseDTO.builder()
.winnerCount(winnerCount)
.startDate(startDate)
.endDate(endDate)
.winnerCount(request.getWinnerCount())
.minLength(request.getMinLength())
.startDate(request.getStartDate())
.endDate(request.getEndDate())
.winners(winnerDetails)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cmc.suppin.event.crawl.service;

import com.cmc.suppin.event.crawl.controller.dto.CommentRequestDTO;
import com.cmc.suppin.event.crawl.controller.dto.CommentResponseDTO;
import com.cmc.suppin.event.crawl.converter.CommentConverter;
import com.cmc.suppin.event.crawl.domain.Comment;
Expand All @@ -18,9 +19,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -49,41 +48,36 @@ public CommentResponseDTO.CrawledCommentListDTO getComments(Long eventId, String

int totalComments = commentRepository.countByEventIdAndUrl(eventId, url);

String crawlTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
String crawlTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy. MM. dd HH:mm"));

return CommentConverter.toCommentListDTO(comments.getContent(), crawlTime, totalComments);
}

// λ‹Ήμ²¨μž 쑰건별 랜덀 좔첨
public CommentResponseDTO.WinnerResponseDTO drawWinners(Long eventId, String startDate, String endDate, int winnerCount, List<String> keywords, String userId) {
// λ‹Ήμ²¨μž 쑰건별 랜덀 좔첨(λŒ“κΈ€ 이벀트)
public CommentResponseDTO.WinnerResponseDTO drawWinners(CommentRequestDTO.WinnerRequestDTO request, String userId) {
Member member = memberRepository.findByUserIdAndStatusNot(userId, UserStatus.DELETED)
.orElseThrow(() -> new IllegalArgumentException("Member not found"));

Event event = eventRepository.findByIdAndMemberId(eventId, member.getId())
Event event = eventRepository.findByIdAndMemberId(request.getEventId(), member.getId())
.orElseThrow(() -> new IllegalArgumentException("Event not found"));

// String을 LocalDate둜 λ³€ν™˜ν•˜κ³  LocalDateTime으둜 λ³€ν™˜
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate start = LocalDate.parse(startDate, dateFormatter);
LocalDate end = LocalDate.parse(endDate, dateFormatter);

// LocalDateTime으둜 λ³€ν™˜
LocalDateTime startDateTime = start.atStartOfDay();
LocalDateTime endDateTime = end.atTime(LocalTime.MAX);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy. MM. dd HH:mm");
LocalDateTime startDateTime = LocalDateTime.parse(request.getStartDate(), dateTimeFormatter);
LocalDateTime endDateTime = LocalDateTime.parse(request.getEndDate(), dateTimeFormatter);

// λ‹Ήμ²¨μž 좔첨 둜직
List<Comment> comments = commentRepository.findByEventIdAndCommentDateBetween(event.getId(), startDateTime, endDateTime);

// ν‚€μ›Œλ“œ 필터링(OR 둜직)
// ν‚€μ›Œλ“œ 필터링(OR 둜직) 및 minLength 필터링 μΆ”κ°€
List<Comment> filteredComments = comments.stream()
.filter(comment -> keywords.stream().anyMatch(keyword -> comment.getCommentText().contains(keyword)))
.filter(comment -> request.getKeywords().stream().anyMatch(keyword -> comment.getCommentText().contains(keyword)))
.filter(comment -> comment.getCommentText().length() >= request.getMinLength())
.collect(Collectors.toList());

// 랜덀 좔첨
Collections.shuffle(filteredComments);
List<Comment> winners = filteredComments.stream().limit(winnerCount).collect(Collectors.toList());
List<Comment> winners = filteredComments.stream().limit(request.getWinnerCount()).collect(Collectors.toList());

return CommentConverter.toWinnerResponseDTO(winners, winnerCount, startDate, endDate);
return CommentConverter.toWinnerResponseDTO(winners, request);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,22 @@ public class EventApi {
private final EventService eventService;

@GetMapping("/all")
@Operation(summary = "전체 이벀트 쑰회 API", description = "λ‘œκ·ΈμΈν•œ μ‚¬μš©μžμ˜ λͺ¨λ“  μ΄λ²€νŠΈμ™€ μ„€λ¬Έ 및 λŒ“κΈ€ 수λ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€., JWT ν† ν°λ§Œ μ£Όμ‹œλ©΄ λ©λ‹ˆλ‹€.")
@Operation(summary = "전체 이벀트 쑰회 API", description = "μ‚¬μš©μžμ˜ λͺ¨λ“  μ΄λ²€νŠΈμ™€ μ„€λ¬Έ 및 λŒ“κΈ€ 수λ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€.")
public ResponseEntity<ApiResponse<List<EventResponseDTO.EventInfoDTO>>> getAllEventsWithCounts(@CurrentAccount Account account) {
List<EventResponseDTO.EventInfoDTO> events = eventService.getAllEvents(account.userId());
return ResponseEntity.ok(ApiResponse.of(events));
}

@PostMapping("/new/comment/crawling")
@Operation(summary = "λŒ“κΈ€ 이벀트 생성 API",
description = "Request : type(ENUM νƒ€μž…μœΌλ‘œ, 'COMMENT와 SURVEY' λ‘˜ 쀑 ν•˜λ‚˜λ₯Ό μž…λ ₯ν•΄μ£Όμ‹œλ©΄ λ©λ‹ˆλ‹€), " +
"title, description, url, startDate(yyyy-MM-dd), endDate(yyyy-MM-dd), announcementDate(yyyy-MM-dd)<br><br>" +
"Response둜 μ œκ³΅λ˜λŠ” eventIdλ₯Ό μ΄μš©ν•˜μ—¬ 타 API듀을 ν˜ΈμΆœν•΄μ£Όμ‹œλ©΄ λ©λ‹ˆλ‹€.")
@Operation(summary = "λŒ“κΈ€ 이벀트 생성 API", description = "λŒ“κΈ€ 이벀트λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€. μžμ„Έν•œ μš”μ²­ 및 응닡 ν˜•μ‹μ€ λ…Έμ…˜ API λ¬Έμ„œλ₯Ό μ°Έκ³ ν•˜μ‹œλ©΄ λ©λ‹ˆλ‹€.")
public ResponseEntity<ApiResponse<EventResponseDTO.EventInfoDTO>> createCommentEvent(@RequestBody @Valid EventRequestDTO.CommentEventCreateDTO request, @CurrentAccount Account account) {
Event event = eventService.createCommentEvent(request, account.userId());
EventResponseDTO.EventInfoDTO response = EventConverter.toEventInfoDTO(event);
return ResponseEntity.ok(ApiResponse.of(response));
}

@PostMapping("/new/survey")
@Operation(summary = "섀문쑰사 이벀트 생성 API",
description = "Request : type(ENUM νƒ€μž…μœΌλ‘œ, 'COMMENT와 SURVEY' λ‘˜ 쀑 ν•˜λ‚˜λ₯Ό μž…λ ₯ν•΄μ£Όμ‹œλ©΄ λ©λ‹ˆλ‹€), " +
"title, description, startDate(yyyy-MM-dd), endDate(yyyy-MM-dd), announcementDate(yyyy-MM-dd)<br><br>" +
"Response둜 μ œκ³΅λ˜λŠ” eventIdλ₯Ό μ΄μš©ν•˜μ—¬ 타 API듀을 ν˜ΈμΆœν•΄μ£Όμ‹œλ©΄ λ©λ‹ˆλ‹€.")
@Operation(summary = "μ„€λ¬Έ 이벀트 생성 API", description = "μ„€λ¬Έ 이벀트λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€. μžμ„Έν•œ μš”μ²­ 및 응닡 ν˜•μ‹μ€ λ…Έμ…˜ API λ¬Έμ„œλ₯Ό μ°Έκ³ ν•˜μ‹œλ©΄ λ©λ‹ˆλ‹€.")
public ResponseEntity<ApiResponse<EventResponseDTO.EventInfoDTO>> createSurveyEvent(@RequestBody @Valid EventRequestDTO.SurveyEventCreateDTO request, @CurrentAccount Account account) {
Event event = eventService.createSurveyEvent(request, account.userId());
EventResponseDTO.EventInfoDTO response = EventConverter.toEventInfoDTO(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.cmc.suppin.global.enums.EventType;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -17,17 +18,23 @@ public class EventRequestDTO {
public static class CommentEventCreateDTO {
@NotNull
private EventType type;

@NotEmpty
private String title;
@NotEmpty

private String description;

@NotEmpty
private String url;

@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String startDate;
@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String endDate;
@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String announcementDate;
}

Expand All @@ -38,15 +45,21 @@ public static class CommentEventCreateDTO {
public static class SurveyEventCreateDTO {
@NotNull
private EventType type;

@NotEmpty
private String title;

@NotEmpty
private String description;

@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String startDate;
@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String endDate;
@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String announcementDate;
}

Expand All @@ -60,8 +73,15 @@ public static class EventUpdateDTO {
private String title;
private String description;
private String url;

@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String startDate;
@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String endDate;
@NotEmpty
@Pattern(regexp = "\\d{4}\\. \\d{2}\\. \\d{2} \\d{2}:\\d{2}", message = "λ‚ μ§œ ν˜•μ‹μ€ yyyy. MM. dd HH:mm 이어야 ν•©λ‹ˆλ‹€.")
private String announcementDate;
}
}
Loading

0 comments on commit 5c74f6f

Please sign in to comment.