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

[feat] 모델 적합도 조회 api 및 스웨거 설명 추가 #35

Merged
merged 7 commits into from
Mar 8, 2024

Conversation

j2noo
Copy link
Contributor

@j2noo j2noo commented Mar 8, 2024

🗃 Issue

🔥 Task

  • 모델 적합도 조회 api 추가
  • 스웨거 설명 추가

Model 조회 시 ModelProduct가 생성되고, ModelProduct 생성 시 ModelFitness row가 추가되게 했습니다.
기업은 LG 하나밖에 없고 텍스트와 점수이미지는 사람 당 하나의 이미지로 들어갈 예정입니다.

📄 Reference

  • None

@j2noo j2noo self-assigned this Mar 8, 2024
@lsm-del
Copy link
Contributor

lsm-del commented Mar 8, 2024

modelproduct가 productModel인가요?

Copy link
Member

@sominyun sominyun 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 1 to 15
//package com.backend.soullive_a.dto.response;
//
//import com.backend.soullive_a.entity.model.Model;
//import jakarta.persistence.Column;
//import jakarta.persistence.FetchType;
//import jakarta.persistence.JoinColumn;
//import jakarta.persistence.ManyToOne;
//import lombok.Builder;
//
//@Builder
//public record ModelImageKeywordResponse(
// String keyord
//// Model model //필요한가?
//) {
//}
Copy link
Member

Choose a reason for hiding this comment

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

클래스 지워도 됩니다!

.code(200)
.message("모델 적합도 조회에 성공했습니다.")
.isSuccess(true)
.data(modelFitnessService.getModelFitness(new ModelFitnessRequest(modelName, productId)))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.data(modelFitnessService.getModelFitness(new ModelFitnessRequest(modelName, productId)))
.data(modelFitnessService.getModelFitness(String modelName, Long productId))

혹시 ModelFitnessRequest를 쓰는 이유가 있을까요..? 두개만 받는거면 그냥 인자로 넣어주면 service에서 getModelName 같은거 안해도 되니까 이렇게 하는게 코드가 좋을것같아요~
그리고 RequestDto를 쓰고 싶으면
public BaseResponse<ModelFitnessResponse> getModelFitness( @RequestBody ModelFitness modelFitenessRequest )
이런식으로 쓰면 좋을것같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오 requestbody에 dto가 되는줄 몰랏어요 대박 ,, ,, 지금 시간이 없어서 오늘 밤에 수정할게요 이거는


@Override
@Transactional
public ModelResponse getModel(String modelName,Long productId) {
System.out.println(modelName);
Model model = modelRepository.findByModelName(modelName)
.orElseThrow(() -> new NotFoundUserException());

System.out.println(model.getModelName()+productId);
Copy link
Member

Choose a reason for hiding this comment

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

이거 필요한 코드인가용...? 필요없으면 지워주세요!

Copy link
Contributor

Choose a reason for hiding this comment

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

그리고 출력 값 혹시 필요하면 저희 slf4j 사용하니깐 @slf4j 사용해서 log 찍는거 추천드립니다.

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 58 to 60
if (productModel.getModel().getId() == 1) {
aiComment = "김희애의 우아하고 고급스러운 이미지와 함께 가족적인 이미지가 어우러져 lg 시그니처 브랜드의 프리미엄적인 이미지와 고품질 제품에 잘 어울릴 것이라고 판단 됩니다.";
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (productModel.getModel().getId() == 1) {
aiComment = "김희애의 우아하고 고급스러운 이미지와 함께 가족적인 이미지가 어우러져 lg 시그니처 브랜드의 프리미엄적인 이미지와 고품질 제품에 잘 어울릴 것이라고 판단 됩니다.";
}
if (productModel.getModel().getId() == 1) {
aiComment = "김희애의 우아하고 고급스러운 이미지와 함께 가족적인 이미지가 어우러져 lg 시그니처 브랜드의 프리미엄적인 이미지와 고품질 제품에 잘 어울릴 것이라고 판단 됩니다.";
scoreUrl="https://soullive-bucket.s3.ap-northeast-2.amazonaws.com/hanjimin_modelFitness_score.png";
}

scoreUrl이랑 aiComment를 합치면 좋을 것 같아 보여요!

Copy link
Member

Choose a reason for hiding this comment

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

모델 이미지 키워드, 목표 기업 이미지, 목표 상품 이미지 도 다 넣어 주세요~

Comment on lines 153 to 156
-- 모델 적합도
-- INSERT INTO soullive.model_fitness (model_fitenss_id, product_model_id, ai_comment, score_url)
-- VALUES
-- (1, 1, '김희애의 우아하고 고급스러운 이미지와 함께 가족적인 이미지가 어우러져 lg 시그니처 브랜드의 프리미엄적인 이미지와 고품질 제품에 잘 어울릴 것이라고 판단 됩니다.', 'image.png');
Copy link
Member

Choose a reason for hiding this comment

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

필요없으면 지워주세여~

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 interface ModelFitnessRepository extends JpaRepository<ModelFitness, Long> {

// public ModelFitness findById
Copy link
Member

Choose a reason for hiding this comment

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

지워용


@Override
@Transactional
public ModelResponse getModel(String modelName,Long productId) {
System.out.println(modelName);
Model model = modelRepository.findByModelName(modelName)
.orElseThrow(() -> new NotFoundUserException());

System.out.println(model.getModelName()+productId);
Copy link
Contributor

Choose a reason for hiding this comment

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

그리고 출력 값 혹시 필요하면 저희 slf4j 사용하니깐 @slf4j 사용해서 log 찍는거 추천드립니다.

@lsm-del lsm-del merged commit 03c57e5 into develop Mar 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 모델 적합도 조회 api 생성
3 participants