-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
공지사항 작성 api #9
공지사항 작성 api #9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰가 늦어 죄송합니다! 온라인 미팅 시간때 하려다가 너무 많아져서 코멘트로 남깁니다.
} | ||
|
||
@PostMapping | ||
public NoticeDTO writeNotice(@RequestBody @Valid WriteNoticeRequest notice){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saveNotice로 변경하는게 좋아보입니다!
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
@ManyToOne(fetch = FetchType.LAZY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LAZY를 쓴 이유가 있을까요?
|
||
public static Notice newNoticeFromReq(WriteNoticeRequest req, List<NoticeImage> images){ | ||
return Notice.builder() | ||
.id(req.getId()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id를 리퀘스트에서 받나요?
this.updatedAt = updatedAt; | ||
} | ||
|
||
public static Notice newNoticeFromReq(WriteNoticeRequest req, List<NoticeImage> images){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
req를 직접 받는 것은 req에 너무 �종속되는 것 같습니다! id, content, images 등등 직접 param을 받는게 더 좋아보입니다.
@Override | ||
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException { | ||
String uri = request.getRequestURI(); | ||
return FilterUtil.excludeUrlPatterns.contains(uri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Util로 쓰려면 상수보다는 method로 만들어 FilterUtil.isExcludePatterns(uri); 요런 방식이 더 좋아보입니다!
@Table(name = "notice") | ||
public class Notice { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Id들을 Long타입이 아닌, Id객체로 만드는 것이 좋아보입니다! 어떻게 하면 될까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id만 따로 객체로 관리해야하는 거라면 @embeddable, @EmbeddedId를 사용하면 될 것 같습니다!
No description provided.