Skip to content
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

Merged
merged 5 commits into from
Oct 24, 2024
Merged

공지사항 작성 api #9

merged 5 commits into from
Oct 24, 2024

Conversation

5upportPark
Copy link
Collaborator

No description provided.

Copy link

@f-lab-Tailor f-lab-Tailor left a 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){

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)

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())

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){

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);

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id들을 Long타입이 아닌, Id객체로 만드는 것이 좋아보입니다! 어떻게 하면 될까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id만 따로 객체로 관리해야하는 거라면 @embeddable, @EmbeddedId를 사용하면 될 것 같습니다!

@5upportPark 5upportPark merged commit 134bbd2 into dev Oct 24, 2024
1 check passed
@5upportPark 5upportPark deleted the feature/write_notice branch October 24, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants