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

[BE] 행사 생성 기능 구현 #41

Merged
merged 2 commits into from
Jul 18, 2024
Merged

[BE] 행사 생성 기능 구현 #41

merged 2 commits into from
Jul 18, 2024

Conversation

3Juhwan
Copy link
Contributor

@3Juhwan 3Juhwan commented Jul 18, 2024

issue

구현 사항

행사 생성 API 구현

중점적으로 리뷰받고 싶은 부분(선택)

리뷰 시에 커밋의 규모가 적당했는지 궁금합니다.

논의하고 싶은 부분(선택)

행사 token 생성 전략에 대하여, 임의로 UUID를 선택했습니다. 이후, 변경을 고려하여 EventTokenProvider.class로 분리했습니다. 추후 논의가 필요할 것 같습니다.

@3Juhwan 3Juhwan added ⌨️ BE Backend ⚙️ feat feature labels Jul 18, 2024
@3Juhwan 3Juhwan added this to the lev3 milestone Jul 18, 2024
@3Juhwan 3Juhwan requested review from Arachneee and khabh July 18, 2024 06:05
Copy link
Contributor

@Arachneee Arachneee left a comment

Choose a reason for hiding this comment

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

커밋 단위는 괜찮은 것 같아요.

Comment on lines +22 to +24
return ResponseEntity.ok()
.location(URI.create("events/" + eventAppResponse.token()))
.build();
Copy link
Contributor

@Arachneee Arachneee Jul 18, 2024

Choose a reason for hiding this comment

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

[R] create()를 사용해서 status code를 201로 하는 것은 어떨까요?
201이 아니면 location 헤더가 있는지 예측하기 어려울것 같습니다.

Comment on lines +6 to +12
@Component
public class EventTokenProvider {

public String createToken() {
return UUID.randomUUID().toString();
}
}
Copy link
Contributor

@Arachneee Arachneee Jul 18, 2024

Choose a reason for hiding this comment

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

[R] EventTokenProvider 생성 정책이 바뀔 가능성이 있을 것 같은데 인터페이스로 하는 것은 어떨까요?
test에서도 모킹을 하지 않고 함수형 인터페이스를 활용할 수 있을 것 같아요.

Copy link
Contributor

@khabh khabh left a comment

Choose a reason for hiding this comment

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

👍

private final EventTokenProvider eventTokenProvider;

public EventAppResponse saveEvent(EventAppRequest request) {
String token = eventTokenProvider.createToken();
Copy link
Contributor

Choose a reason for hiding this comment

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

[R] 중복된 토큰이 생성될 수 있으니 저장 전에 검증을 한 번 해 주면 좋을 것 같습니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

매 초 100만개의 UUID를 100년동안 생성할때 0.00009% 확률로 중복이 발생합니다. 라고 하는데 굳이 검증을 해야할까요?
DB에서 unique 조건을 한 번 걸어주는 것만으로 충분하다고 생각합니다.

@kunsanglee kunsanglee changed the title feat: 행사 생성 기능 구현 [BE] feat: 행사 생성 기능 구현 Jul 18, 2024
@kunsanglee kunsanglee changed the title [BE] feat: 행사 생성 기능 구현 [BE] 행사 생성 기능 구현 Jul 18, 2024
@3Juhwan 3Juhwan merged commit bd1b976 into develop Jul 18, 2024
1 check passed
Copy link
Contributor

@Arachneee Arachneee left a comment

Choose a reason for hiding this comment

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

리뷰 확인해주세요.

Comment on lines +24 to +27
public Event(String name, String token) {
this.name = name;
this.token = token;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

[R] : name 검증이 없는 것 같아요.

private final EventService eventService;

@PostMapping("/api/events")
public ResponseEntity<Void> saveEvent(EventSaveRequest request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[R] : @RequestBody 를 안붙여도 잘 동작하나요?
명시적으로 붙이는 것이 어떨까요?

@khabh khabh deleted the feature/#15 branch August 4, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[BE] 행사 생성 기능 구현
4 participants