Skip to content

Commit

Permalink
fix: 캐싱에 baseResponse를 포함하지 않도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
dongchandev committed Aug 21, 2024
1 parent a058b1f commit 1f1e886
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public ResponseData<List<MemberInfoRes>> getDeactivateMembers() {
}

@Cacheable(value = "members-cache", key = "'activeMembers'")
public ResponseData<List<MemberInfoRes>> getAll() {
return ResponseData.ok("모든 멤버 정보 조회 성공", service.getByStatus(ActiveStatus.ACTIVE).parallelStream()
public List<MemberInfoRes> getAll() {
return service.getByStatus(ActiveStatus.ACTIVE).parallelStream()
.map(this::getMemberInfo)
.toList());
.toList();
}

private MemberInfoRes getMemberInfo(Member member) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;

import java.io.Serializable;
import java.time.LocalDateTime;

public record MemberInfoRes(
Expand All @@ -28,7 +29,7 @@ public record MemberInfoRes(
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
LocalDateTime modifiedAt
) {
) implements Serializable {
public static MemberInfoRes of(Member member, Student student, Teacher teacher) {
return new MemberInfoRes(
member.getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import b1nd.dodam.domain.rds.member.entity.Student;

import java.io.Serializable;

public record StudentRes(
int id,
String name,
Integer grade,
Integer room,
Integer number) {
Integer number) implements Serializable {
public static StudentRes of(Student student) {
if(student == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import b1nd.dodam.domain.rds.member.entity.Teacher;

public record TeacherRes(String name, String tel, String position) {
import java.io.Serializable;

public record TeacherRes(String name, String tel, String position) implements Serializable {
public static TeacherRes of(Teacher teacher) {
if(teacher == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public ResponseData<List<MemberInfoRes>> getDeactivateMembers() {

@GetMapping("/all")
public ResponseData<List<MemberInfoRes>> getAll() {
return queryUseCase.getAll();
return ResponseData.ok("모든 멤버 정보 조회 성공", queryUseCase.getAll());
}

@GetMapping("/check/broadcast-club-member")
Expand Down

0 comments on commit 1f1e886

Please sign in to comment.