Skip to content

Commit

Permalink
[hotfix] MemeService 잘못된 변수명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
JunRain2 committed May 6, 2024
1 parent c42f6ca commit 5500239
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 94 deletions.
Original file line number Diff line number Diff line change
@@ -1,59 +1,61 @@
package com.example.memetory.domain.memes.dto;

import java.time.LocalDateTime;

import com.example.memetory.domain.memes.entity.Memes;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Getter
@NoArgsConstructor
@Schema(description = "밈스 정보")
public class MemesInfo {

@Schema(description = "밈스 아이디")
private Long memesId;

@Schema(description = "밈스를 생성한 멤버 아이디")
private Long memberId;

@Schema(description = "밈스로 보여줄 밈의 S3 주소")
private String memeUrl;

@Schema(description = "밈스 제목")
private String title;

@Schema(description = "댓글 수")
private int commentCount;

@Schema(description = "좋아요 수")
private int likeCount;

@Schema(description = "밈스 생성 시각")
private LocalDateTime createdAt;

@Builder
public MemesInfo(Long memesId, Long memberId, String memeUrl, String title, int commentCount, int likeCount, LocalDateTime createdAt) {
this.memesId = memesId;
this.memberId = memberId;
this.memeUrl = memeUrl;
this.title = title;
this.commentCount = commentCount;
this.likeCount = likeCount;
this.createdAt = createdAt;
}

public static MemesInfo of(Memes memes) {
return MemesInfo.builder()
.memesId(memes.getId())
.memberId(memes.getMember().getId())
.memeUrl(memes.getMeme().getS3Url())
.title(memes.getTitle())
.commentCount(memes.getCommentCount())
.likeCount(memes.getLikeCount())
.createdAt(memes.getCreatedAt())
.build();
}
@Schema(description = "밈스 아이디")
private Long memesId;

@Schema(description = "밈스를 생성한 멤버 아이디")
private Long memberId;

@Schema(description = "밈스로 보여줄 밈의 S3 주소")
private String memeUrl;

@Schema(description = "밈스 제목")
private String title;

@Schema(description = "댓글 수")
private Long commentCount;

@Schema(description = "좋아요 수")
private Long likeCount;

@Schema(description = "밈스 생성 시각")
private LocalDateTime createdAt;

@Builder
public MemesInfo(Long memesId, Long memberId, String memeUrl, String title, Long commentCount, Long likeCount,
LocalDateTime createdAt) {
this.memesId = memesId;
this.memberId = memberId;
this.memeUrl = memeUrl;
this.title = title;
this.commentCount = commentCount;
this.likeCount = likeCount;
this.createdAt = createdAt;
}

public static MemesInfo of(Memes memes) {
return MemesInfo.builder()
.memesId(memes.getId())
.memberId(memes.getMember().getId())
.memeUrl(memes.getMeme().getS3Url())
.title(memes.getTitle())
.commentCount(memes.getCommentCount())
.likeCount(memes.getLikeCount())
.createdAt(memes.getCreatedAt())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,70 +1,72 @@
package com.example.memetory.domain.memes.dto.response;

import java.time.LocalDateTime;
import java.util.List;

import com.example.memetory.domain.comment.dto.CommentInfo;
import com.example.memetory.domain.memes.entity.Memes;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

@Getter
@NoArgsConstructor
@Schema(description = "밈스 단일 조회 반환 형식")
public class MemesResponse {
@Schema(description = "밈스 아이디")
private Long memesId;
@Schema(description = "밈스 아이디")
private Long memesId;

@Schema(description = "밈스를 생성한 멤버 아이디")
private Long memberId;
@Schema(description = "밈스를 생성한 멤버 아이디")
private Long memberId;

@Schema(description = "밈스를 생성한 멤버 이름")
private String memberName;
@Schema(description = "밈스를 생성한 멤버 이름")
private String memberName;

@Schema(description = "밈스로 보여줄 밈의 S3 주소")
private String memeUrl;
@Schema(description = "밈스로 보여줄 밈의 S3 주소")
private String memeUrl;

@Schema(description = "밈스 제목")
private String title;
@Schema(description = "밈스 제목")
private String title;

@Schema(description = "댓글 수")
private int commentCount;
@Schema(description = "댓글 수")
private Long commentCount;

@Schema(description = "댓글 리스트")
private List<CommentInfo> commentInfoList;
@Schema(description = "댓글 리스트")
private List<CommentInfo> commentInfoList;

@Schema(description = "좋아요 수")
private int likeCount;
@Schema(description = "좋아요 수")
private Long likeCount;

@Schema(description = "밈스 생성 시각")
private LocalDateTime createdAt;
@Schema(description = "밈스 생성 시각")
private LocalDateTime createdAt;

@Builder
public MemesResponse(Long memesId, Long memberId, String memberName, String memeUrl, String title, int commentCount, List<CommentInfo> commentInfoList, int likeCount, LocalDateTime createdAt) {
this.memesId = memesId;
this.memberId = memberId;
this.memberName = memberName;
this.memeUrl = memeUrl;
this.title = title;
this.commentCount = commentCount;
this.commentInfoList = commentInfoList;
this.likeCount = likeCount;
this.createdAt = createdAt;
}
@Builder
public MemesResponse(Long memesId, Long memberId, String memberName, String memeUrl, String title,
Long commentCount, List<CommentInfo> commentInfoList, Long likeCount, LocalDateTime createdAt) {
this.memesId = memesId;
this.memberId = memberId;
this.memberName = memberName;
this.memeUrl = memeUrl;
this.title = title;
this.commentCount = commentCount;
this.commentInfoList = commentInfoList;
this.likeCount = likeCount;
this.createdAt = createdAt;
}

public static MemesResponse of(Memes memes) {
return MemesResponse.builder()
.memesId(memes.getId())
.memberId(memes.getMember().getId())
.memberName(memes.getMember().getName())
.memeUrl(memes.getMeme().getS3Url())
.title(memes.getTitle())
.commentCount(memes.getCommentCount())
.commentInfoList(memes.getComments().stream().map(CommentInfo::of).toList())
.likeCount(memes.getLikeCount())
.createdAt(memes.getCreatedAt())
.build();
}
public static MemesResponse of(Memes memes) {
return MemesResponse.builder()
.memesId(memes.getId())
.memberId(memes.getMember().getId())
.memberName(memes.getMember().getName())
.memeUrl(memes.getMeme().getS3Url())
.title(memes.getTitle())
.commentCount(memes.getCommentCount())
.commentInfoList(memes.getComments().stream().map(CommentInfo::of).toList())
.likeCount(memes.getLikeCount())
.createdAt(memes.getCreatedAt())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public class MemesService {

@Transactional
public void register(MemesServiceDto memesServiceDto) {
Member foundMember = memberService.findByEmail(memesServiceDto.getEmail());
Meme foundMeme = memeService.getMemeBetweenService(memesServiceDto.getMemeId());
Member member = memberService.findByEmail(memesServiceDto.getEmail());
Meme meme = memeService.getMemeBetweenService(memesServiceDto.getMemeId());

Memes newMemes = memesServiceDto.toEntity(findMember, findMeme);
Memes newMemes = memesServiceDto.toEntity(member, meme);
memesRepository.save(newMemes);
}

Expand Down

0 comments on commit 5500239

Please sign in to comment.