Skip to content

Commit

Permalink
fix: TouchpointDto fromMemberId -> fromMemberNickname 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
okodeee committed Nov 20, 2024
1 parent 71fc525 commit 2454999
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 54 deletions.
37 changes: 5 additions & 32 deletions src/main/java/vom/spring/domain/touchpoint/TouchpointDto.java
Original file line number Diff line number Diff line change
@@ -1,46 +1,19 @@
package vom.spring.domain.touchpoint;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import vom.spring.domain.album.Album;
import vom.spring.domain.album.AlbumDto;
import vom.spring.domain.member.domain.Member;
import lombok.Setter;

import java.time.LocalDateTime;

@Getter @Setter
public class TouchpointDto {
private Long fromMemberId;
private String fromMemberNickname;
private LocalDateTime createdAt;
private String fromMemberProfileImgUrl;

public TouchpointDto(Long fromMemberId, LocalDateTime createdAt, String fromMemberProfileImgUrl) {
this.fromMemberId = fromMemberId;
public TouchpointDto(String fromMemberNickname, LocalDateTime createdAt, String fromMemberProfileImgUrl) {
this.fromMemberNickname = fromMemberNickname;
this.createdAt = createdAt;
this.fromMemberProfileImgUrl = fromMemberProfileImgUrl;
}

public Long getFromMemberId() {
return fromMemberId;
}

public void setFromMemberId(Long fromMemberId) {
this.fromMemberId = fromMemberId;
}

public LocalDateTime getCreatedAt() {
return createdAt;
}

public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}

public String getFromMemberProfileImgUrl() {
return fromMemberProfileImgUrl;
}

public void setFromMemberProfileImgUrl(String fromMemberProfileUrl) {
this.fromMemberProfileImgUrl = fromMemberProfileUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public void save(Touchpoint touchpoint) {
em.persist(touchpoint);
}

public List<TouchpointDto> findFromMemberIdsByToMemberId(Long toMemberId, LocalDate today) {
public List<TouchpointDto> findByToMemberId(Long toMemberId, LocalDate today) {
return em.createQuery(
"select new TouchpointDto(t.fromMember.id, t.createdAt, t.fromMember.profileImgUrl) " +
"select new TouchpointDto(t.fromMember.nickname, t.createdAt, t.fromMember.profileImgUrl) " +
"from Touchpoint t " +
"where t.toMember.id = :toMemberId " +
"and t.createdAt < :today",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public TouchpointService(TouchpointRepository touchpointRepository, MemberReposi
@Transactional
public List<TouchpointDto> getTouchpoints(Long member_id) {
LocalDate today = LocalDate.now();
return touchpointRepository.findFromMemberIdsByToMemberId(member_id, today);
return touchpointRepository.findByToMemberId(member_id, today);
}

/**
Expand Down
38 changes: 19 additions & 19 deletions src/main/java/vom/spring/global/config/S3Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@
@Configuration
public class S3Config {

// @Value("${cloud.aws.credentials.access-key}")
// private String accessKey;
//
// @Value("${cloud.aws.credentials.secret-key}")
// private String secretKey;
//
// @Value("${cloud.aws.region.static}")
// private String region;
//
// @Bean
// public AmazonS3Client amazonS3Client() {
// BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
//
// return (AmazonS3Client) AmazonS3ClientBuilder
// .standard()
// .withRegion(region)
// .withCredentials(new AWSStaticCredentialsProvider(credentials))
// .build();
// }
@Value("${cloud.aws.credentials.access-key}")
private String accessKey;

@Value("${cloud.aws.credentials.secret-key}")
private String secretKey;

@Value("${cloud.aws.region.static}")
private String region;

@Bean
public AmazonS3Client amazonS3Client() {
BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);

return (AmazonS3Client) AmazonS3ClientBuilder
.standard()
.withRegion(region)
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.build();
}
// @Value("${cloud.aws.region.static}")
// private String region;
//
// @Bean
// public AmazonS3Client amazonS3Client() {
//
// return (AmazonS3Client) AmazonS3ClientBuilder
// .standard()
// .withRegion(region)
// .build();
// }
}

0 comments on commit 2454999

Please sign in to comment.