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

Create default entities - mk3058 #14

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from
Open

Create default entities - mk3058 #14

wants to merge 19 commits into from

Conversation

mk3058
Copy link
Member

@mk3058 mk3058 commented Aug 22, 2023

올려주신 pr 참고해서 기본 엔티티를 추가했습니다.

@mk3058 mk3058 added the feat label Aug 22, 2023
@mk3058 mk3058 requested a review from ckyeon August 22, 2023 03:44
@mk3058 mk3058 self-assigned this Aug 22, 2023
@mk3058 mk3058 linked an issue Aug 22, 2023 that may be closed by this pull request
Copy link
Member

@ckyeon ckyeon left a 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) {
Copy link
Member

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에 의존하지 않는 것이 좋습니다!

Copy link
Member

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) {
Copy link
Member

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에 의존하지 않는 것이 좋습니다!

Comment on lines 45 to 49
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");

Copy link
Member

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 {
Copy link
Member

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 {
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

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

presentation 패키지의 위치가 잘못된 것 같습니다!

Comment on lines 24 to 33
@Column(nullable = false)
private String title;

@Column(columnDefinition = "TEXT", nullable = false)
private String introduce;

private String appeal;

@Enumerated(EnumType.STRING)
private MatchPostStatus status;
Copy link
Member

Choose a reason for hiding this comment

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

@Column(length= <number>)를 통해 각 컬럼의 길이를 지정해주면 좋을 것 같습니다!

Comment on lines 58 to 63
public void updateMatchPost(MatchPostUpdateDto dto) {
this.title = dto.getTitle();
this.introduce = dto.getIntroduce();
this.appeal = dto.getAppeal();
this.status = dto.getStatus();
}
Copy link
Member

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에 의존하지 않는 것이 좋습니다!

Comment on lines 7 to 16
public class MatchPostUpdateDto {

private String title;

private String introduce;

private String appeal;

private MatchPostStatus status;
}
Copy link
Member

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 생성자를 임의로 만들어주는 것이 좋습니다!

@mk3058 mk3058 requested a review from ckyeon August 26, 2023 03:58
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");
Copy link
Member

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 {
Copy link
Member

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

@mk3058 mk3058 requested a review from ckyeon August 27, 2023 04:09
Comment on lines +1 to +13
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;
}
Copy link
Member

Choose a reason for hiding this comment

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

UserMatchPost, UserTag와 같이 ManyToMany를 풀어내기 위한 클래스들은 ControllerService가 필요없는 경우가 많습니다!

그러므로 나중에 구현하다 필요하실 때 만들어주시면 좋을 것 같습니다~

Comment on lines +1 to +13
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;
}
Copy link
Member

Choose a reason for hiding this comment

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

UserMatchPost, UserTag와 같이 ManyToMany를 풀어내기 위한 클래스들은 ControllerService가 필요없는 경우가 많습니다!

그러므로 나중에 구현하다 필요하실 때 만들어주시면 좋을 것 같습니다~

Comment on lines +1 to +13
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;
}
Copy link
Member

Choose a reason for hiding this comment

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

UserMatchPost, UserTag와 같이 ManyToMany를 풀어내기 위한 클래스들은 ControllerService가 필요없는 경우가 많습니다!

그러므로 나중에 구현하다 필요하실 때 만들어주시면 좋을 것 같습니다~

Comment on lines +1 to +14
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;
}
Copy link
Member

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;
Copy link
Member

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을 달아주셔야 합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create default entities
2 participants