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

[TNT-217] feat: 트레이니 - 식단 등록 기능 구현 #57

Merged
merged 11 commits into from
Feb 11, 2025

Conversation

fakerdeft
Copy link
Contributor

📋 Checklist

  • 🔀 PR 제목의 형식을 잘 작성했나요? (e.g. [APP2-77] feat: 회원 인증 Filter 구현)
  • 💯 테스트는 잘 통과했나요?
  • 🏗️ 빌드에 성공했나요?
  • 🧹 불필요한 코드는 제거했나요?

🎟️ Issue

✅ Tasks

트레이니 식단 등록 API

  • S3에 식단 사진 먼저 업로드합니다. 이때 사진 데이터 없으면 업로드 전에 ""가 리턴됩니다.
  • S3에 올린 이미지 URL 포함해서 저장합니다.

이미지 회전되어서 저장되는 버그

  • 라이브러리로 회전 방향 정상화 진행했습니다.
  • 앞으로 저장하는 사진부터 방향 정상적으로 저장됩니다.

🙋🏻 More

  • 참고 내용

@fakerdeft fakerdeft added ✨ feature 새로운 기능 개발 ✅ test 테스트 코드 수정 labels Feb 11, 2025
@fakerdeft fakerdeft requested a review from ymkim97 February 11, 2025 03:26
@fakerdeft fakerdeft self-assigned this Feb 11, 2025
Copy link
Contributor

@ymkim97 ymkim97 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!!~🔥🔥🔥🔥🔥🔥
수정할 거 반영 후 말해주세요!

@@ -153,8 +158,8 @@ public GetActiveTraineesResponse getActiveTrainees(Long memberId) {
.toList();

return new TraineeInfo(trainee.getId(), trainee.getMember().getName(),
ptTrainerTrainee.getFinishedPtCount(), ptTrainerTrainee.getTotalPtCount(), trainee.getCautionNote(),
ptGoals);
trainee.getMember().getProfileImageUrl(), ptTrainerTrainee.getFinishedPtCount(),
Copy link
Contributor

Choose a reason for hiding this comment

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

메모 부분은 추후에 넣어주어야 하니까 나중을 위해 위에다가 주석 하나 달아주세요!
ex) // Memo 추가 구현

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 반영하겠습니다 !


public static final int DIET_IMAGE_URL_LENGTH = 255;
public static final int MEMO_LENGTH = 100;
public static final int DIET_TYPE_LENGTH = 5;
Copy link
Contributor

Choose a reason for hiding this comment

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

BREAKFAST가 5를 넘습니다!
넉넉하게 20 정도 어떨까요??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

좋습니다~ 반영하겠습니다 !

}

private String validateDietImageUrl(String dietImageUrl) {
if (dietImageUrl.length() > DIET_IMAGE_URL_LENGTH) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isBlank()가 빠진거 같아요!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

사진 없으면 디폴트를 "" 로 저장하고 싶은데 isBlank가 막더라구요 그래서 뺐습니다 !

Comment on lines 45 to 49
@Column(name = "date", nullable = false)
private LocalDate date;

@Column(name = "time", nullable = false)
private LocalTime time;
Copy link
Contributor

Choose a reason for hiding this comment

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

따로 받도록 구현하신 이유가 있을까요!?
시간과 날짜는 한번에 LocalDateTime으로 받는건 어떨까요??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이것도 수정해서 반영하겠습니다 !

Comment on lines 15 to 21
@Schema(description = "식사 날짜", example = "2025-01-01", nullable = true)
@PastOrPresent(message = "식사 날짜는 현재거나 과거 날짜여야 합니다.")
LocalDate date,

@Schema(description = "식사 시간", example = "19:30", nullable = true)
@PastOrPresent(message = "식사 시간은 현재거나 과거 시간이어야 합니다.")
LocalTime time,
Copy link
Contributor

Choose a reason for hiding this comment

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

여기도 Entity 쪽 참고 부탁드려요!
그리고 기획쪽에서 이전 날짜는 안되도록 하지는 않았던걸로 기억해서,,
한번 확인 부탁드립니다. 사용자가 이전 시간 날짜에 기록 못하는 것이 어색한거 같아요.

DietType dietType,

@Schema(description = "메모", example = "아 배부르다.", nullable = false)
@NotBlank(message = "메모는 필수입니다.")
Copy link
Contributor

Choose a reason for hiding this comment

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

100자 이하로 받기 때문에
@Size(min = 1, max = 100, message = "메모는 100자 이하여야 합니다.") 추가 부탁드려요~!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 반영하겠습니다 !


import com.tnt.domain.trainee.Diet;

public interface DietRepository extends JpaRepository<Diet, Integer> {
Copy link
Contributor

Choose a reason for hiding this comment

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

JpaRepository<Diet, Long>으로 수정해야할 거 같아요!


@Operation(summary = "트레이니 식단 등록 API")
@ResponseStatus(CREATED)
@PostMapping(value = "/create-diet", consumes = MULTIPART_FORM_DATA_VALUE)
Copy link
Contributor

Choose a reason for hiding this comment

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

RESTful API 규칙에 더 따르자면 /diets는 어떠신가요!?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

제가 까먹고 안 바꿔놨네요 수정하겠습니다 !

Copy link
Contributor

@ymkim97 ymkim97 left a comment

Choose a reason for hiding this comment

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

LGTM
좋습니다 고생하셨어요!!!~~!

@fakerdeft fakerdeft merged commit d0f7d3d into develop Feb 11, 2025
2 checks passed
@fakerdeft fakerdeft deleted the feature/TNT-217 branch February 11, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature 새로운 기능 개발 ✅ test 테스트 코드 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

트레이니 식단 등록 기능 구현
2 participants