-
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
Create default entities - mk3058 #14
base: dev
Are you sure you want to change the base?
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.
중복되는 부분 몇 개는 리뷰를 추가하지 않았습니다!
리뷰가 없더라도 다른 리뷰를 토대로 수정해보시면 좋을 것 같아요~~
this.location = location; | ||
} | ||
|
||
public void updateName(CollegeUpdateDto dto) { |
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.
domain layer는 presentation layer에 속한 dto에 의존하지 않는 것이 좋습니다!
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.
아래의 아티클을 확인해보시면 좋을 것 같습니다.
https://techblog.woowahan.com/2647
this.college = college; | ||
} | ||
|
||
public void updateName(DepartmentUpdateDto dto) { |
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.
domain layer는 presentation layer에 속한 dto에 의존하지 않는 것이 좋습니다!
private Invite(User inviter, User invitee, InviteKind kind, InviteStatus status) { | ||
Preconditions.checkArgument(inviter != null, "inviter must be provided"); | ||
Preconditions.checkArgument(invitee != null, "invitee must be provided"); | ||
Preconditions.checkArgument(kind != null, "kind must be provided"); | ||
|
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.
status에 대한 검증 로직도 추가해주시면 좋을 것 같습니다~
import org.springframework.data.geo.Point; | ||
|
||
@Getter | ||
public class CollegeUpdateDto { |
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.
RequestDto는 유저의 request body를 매핑하는 용도로만 사용하기 때문에 다른 클래스에서 접근이 불가능하도록 public 생성자가 아닌 protected 생성자를 임의로 만들어주는 것이 좋습니다!
import lombok.Getter; | ||
|
||
@Getter | ||
public class DepartmentUpdateDto { |
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.
RequestDto는 유저의 request body를 매핑하는 용도로만 사용하기 때문에 다른 클래스에서 접근이 불가능하도록 public 생성자가 아닌 protected 생성자를 임의로 만들어주는 것이 좋습니다!
@@ -0,0 +1,12 @@ | |||
package com.sequence.anonymous.college.domain.presentation.dto; |
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.
presentation 패키지의 위치가 잘못된 것 같습니다!
@Column(nullable = false) | ||
private String title; | ||
|
||
@Column(columnDefinition = "TEXT", nullable = false) | ||
private String introduce; | ||
|
||
private String appeal; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private MatchPostStatus status; |
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.
@Column(length= <number>)
를 통해 각 컬럼의 길이를 지정해주면 좋을 것 같습니다!
public void updateMatchPost(MatchPostUpdateDto dto) { | ||
this.title = dto.getTitle(); | ||
this.introduce = dto.getIntroduce(); | ||
this.appeal = dto.getAppeal(); | ||
this.status = dto.getStatus(); | ||
} |
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.
domain layer는 presentation layer에 속한 dto에 의존하지 않는 것이 좋습니다!
src/main/java/com/sequence/anonymous/matchPost/domain/MatchPost.java
Outdated
Show resolved
Hide resolved
public class MatchPostUpdateDto { | ||
|
||
private String title; | ||
|
||
private String introduce; | ||
|
||
private String appeal; | ||
|
||
private MatchPostStatus status; | ||
} |
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.
RequestDto는 유저의 request body를 매핑하는 용도로만 사용하기 때문에 다른 클래스에서 접근이 불가능하도록 public 생성자가 아닌 protected 생성자를 임의로 만들어주는 것이 좋습니다!
Preconditions.checkArgument(gender != null, "gender must be provided."); | ||
Preconditions.checkArgument(college != null, "college must be provided."); | ||
Preconditions.checkArgument(department != null, "department must be provided."); | ||
Preconditions.checkArgument(age >= 20, "age must be at least 20"); |
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.
나이가 3~40 이상인 경우도 체크할 수 있을 것 같습니다!
import org.springframework.data.geo.Point; | ||
|
||
@Getter | ||
public class UpdateDto { |
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.
해당 DTO
가 서버에 요청되는 Request
인지 응답에 이용되는 Response
인지 구분할 수 있게 네이밍되면 좋을 것 같습니다!
ex) UpdateRequest
, UpdateResponse
package com.sequence.anonymous.user.presentation; | ||
|
||
import com.sequence.anonymous.user.application.UserMatchPostService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/user-match-posts") | ||
public class UserMatchPostController { | ||
private final UserMatchPostService userMatchPostService; | ||
} |
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.
UserMatchPost
, UserTag
와 같이 ManyToMany
를 풀어내기 위한 클래스들은 Controller
나 Service
가 필요없는 경우가 많습니다!
그러므로 나중에 구현하다 필요하실 때 만들어주시면 좋을 것 같습니다~
package com.sequence.anonymous.user.presentation; | ||
|
||
import com.sequence.anonymous.user.application.UserTagService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/user-tags") | ||
public class UserTagController { | ||
private final UserTagService userTagService; | ||
} |
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.
UserMatchPost
, UserTag
와 같이 ManyToMany
를 풀어내기 위한 클래스들은 Controller
나 Service
가 필요없는 경우가 많습니다!
그러므로 나중에 구현하다 필요하실 때 만들어주시면 좋을 것 같습니다~
package com.sequence.anonymous.user.presentation; | ||
|
||
import com.sequence.anonymous.user.application.UserChatService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/user-chats") | ||
public class UserChatController { | ||
private final UserChatService userChatService; | ||
} |
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.
UserMatchPost
, UserTag
와 같이 ManyToMany
를 풀어내기 위한 클래스들은 Controller
나 Service
가 필요없는 경우가 많습니다!
그러므로 나중에 구현하다 필요하실 때 만들어주시면 좋을 것 같습니다~
package com.sequence.anonymous.user.presentation; | ||
|
||
import com.sequence.anonymous.user.application.AttachmentService; | ||
import com.sequence.anonymous.user.domain.repository.AttachmentRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/attachments") | ||
public class AttachmentController { | ||
private final AttachmentService attachmentService; | ||
} |
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.
Attachment
는 엔드포인트가 필요없을 것 같습니다!
(MatchPost나 User에 종속되기 때문) (독립적으로 존재 x)
@Column(length = 20, nullable = false, unique = true) | ||
private String name; | ||
|
||
private Point location; |
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.
Point
와 같은 Value Object
를 사용하시려면 사용하는 엔티티 프로퍼티에 @Embedded
를 달아주시고,
Point
클래스에 @Embeddable
을 달아주셔야 합니다.
올려주신 pr 참고해서 기본 엔티티를 추가했습니다.