Skip to content

[#22] Feature : 목표 생성, 수정, 완료, 삭제, 목록 조회 및 완료 목록 조회 API#33

Open
yumi530 wants to merge 7 commits intodevelopfrom
feature/22
Open

[#22] Feature : 목표 생성, 수정, 완료, 삭제, 목록 조회 및 완료 목록 조회 API#33
yumi530 wants to merge 7 commits intodevelopfrom
feature/22

Conversation

@yumi530
Copy link

@yumi530 yumi530 commented Sep 4, 2023

Issue

Description

  • 사용자 목표 생성, 수정, 완료, 조회 기능 입니다.

Todo

  • 달력 생성

ETC

  • Goal entity의 builder에 id 추가하는 걸로 수정 했는데 괜찮을까요..?

@yumi530 yumi530 added the 💪 feature 새로운 feature 추가 및 작업 후 추가 label Sep 4, 2023
@yumi530 yumi530 self-assigned this Sep 4, 2023
@yumi530 yumi530 linked an issue Sep 4, 2023 that may be closed by this pull request
return GoalUpdateResponse.of(completedGoal);
}

public boolean deleteGoal(Long id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. 삭제 처리도 예외가 있으면 어떨까요?
  2. 삭제 실패하고 return true 되는 케이스가 있을수도 있을까요...?

private String name;
private int amount;
private int currentAmount;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
Copy link
Contributor

Choose a reason for hiding this comment

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

목표 입력 및 수정할 때 받는 Time이 사용되는 곳이 있나요?!

Copy link
Author

Choose a reason for hiding this comment

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

목표 시작일, 종료일 수정하는 경우가 있다고 생각해서 사용했습니다 ..! 수정이 필요할까요 ? !

Comment on lines +25 to +30
// Optional<Member> optionalMember = memberRepository.findByOauthId(request.getOauthId());
// if (!optionalMember.isPresent()) {
// throw new RuntimeException("id not found.");
// }
//
// Member member = optionalMember.get();
Copy link
Contributor

Choose a reason for hiding this comment

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

주석은 지워주세요!


public GoalUpdateResponse updateGoal(GoalUpdateRequest request, Long id) {

// Member member = memberRepository.findByOauthId(oauthId).orElseThrow(() -> new RuntimeException("Id not found"));
Copy link
Contributor

Choose a reason for hiding this comment

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

여기도 주석 지워주세요!

Comment on lines +67 to +81
Long goalId = goalRepository.findById(id).orElseThrow(() -> new RuntimeException("Goal not found"))
.getId();

Goal updatedGoal = Goal.builder()
.id(goalId)
.member(member)
.amount(request.getAmount())
.currentAmount(request.getCurrentAmount())
.name(request.getName())
.startDate(request.getStartDate())
.endDate(request.getEndDate())
.isCompleted(false)
.build();

goalRepository.save(updatedGoal);
Copy link
Contributor

Choose a reason for hiding this comment

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

이렇게 진행하시면 업데이트가 아니라 새로운 데이터가 추가될거 같네요
한번 확인해보심이 좋을듯 합니다!

Copy link
Author

Choose a reason for hiding this comment

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

넵 이 부분 수정했습니다 !

public List<GoalListResponse> getAllGoals(String oauthId) {


List<Goal> goalList = goalRepository.findAllByMemberId_OauthIdAndIsCompletedFalse(oauthId);
Copy link
Contributor

Choose a reason for hiding this comment

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

goalRepository 변경부분이 없어 에러가 뜨네요!
커밋 확인해보셔야할거 같아요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 feature 새로운 feature 추가 및 작업 후 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

목표 추가하기

3 participants