-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from Team-Smeme/sohyeon_#191
[ADD] 획득한 뱃지에 타입 데이터 추가
- Loading branch information
Showing
5 changed files
with
86 additions
and
73 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/main/java/com/smeme/server/dto/badge/AcquiredBadgeResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.smeme.server.dto.badge; | ||
|
||
import com.smeme.server.model.badge.Badge; | ||
import com.smeme.server.model.badge.BadgeType; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
|
||
@Builder(access = AccessLevel.PRIVATE) | ||
public record AcquiredBadgeResponseDTO( | ||
String name, | ||
String imageUrl, | ||
BadgeType type | ||
) { | ||
public static AcquiredBadgeResponseDTO of(Badge badge) { | ||
return AcquiredBadgeResponseDTO.builder() | ||
.name(badge.getName()) | ||
.imageUrl(badge.getImageUrl()) | ||
.type(badge.getType()) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 3 additions & 10 deletions
13
src/main/java/com/smeme/server/dto/member/MemberUpdateResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
package com.smeme.server.dto.member; | ||
|
||
import com.smeme.server.dto.badge.AcquiredBadgeResponseDTO; | ||
import com.smeme.server.model.badge.Badge; | ||
|
||
import java.util.List; | ||
|
||
public record MemberUpdateResponseDTO( | ||
List<BadgeDTO> badges | ||
List<AcquiredBadgeResponseDTO> badges | ||
) { | ||
public static MemberUpdateResponseDTO of(List<Badge> badges) { | ||
return new MemberUpdateResponseDTO(badges.stream() | ||
.map(badge -> new BadgeDTO(badge.getName(), badge.getImageUrl())).toList()); | ||
} | ||
|
||
record BadgeDTO( | ||
String name, | ||
String imageUrl | ||
) { | ||
return new MemberUpdateResponseDTO(badges.stream().map(AcquiredBadgeResponseDTO::of).toList()); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters