-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 새 스킨 조회 기능 및 테스트 코드 추가 * chore: jpa관련 config 설정 - 버전 호환오류로 인한 기본 Template설정 * feat: 기본 새 스킨 조회 query 추가 * feat: 회원과 벌레에 대한 조회 쿼리 및 테스트 코드 추가 * feat: 회원 정보 조회 기능 및 테스트 코드 추가 * refactor: 회원과 Item 서비스의 의존성 순환을 피하기 위해 inventorySearchService 생성 * refactor: 회원과 Item 서비스의 의존성 순환을 피하기 위해 inventorySearchService 생성 * feat: 회원 정보 조회 API 추가 * style: 메서드 접근 제어자에 따른 순서 변경 * refactor: inventorySearchService 제거 후 memberService에서 repository 추가 * refactor: transform에서 stream으로 동작 변경 * style: 리뷰 반영
- Loading branch information
Showing
25 changed files
with
1,906 additions
and
4,409 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.moabam.api.domain.member; | ||
|
||
import static java.util.Objects.*; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class Badge { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@Column(name = "member_id", nullable = false) | ||
private Long memberId; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "type", nullable = false) | ||
private BadgeType type; | ||
|
||
@CreatedDate | ||
@Column(name = "created_at", updatable = false, nullable = false) | ||
private LocalDateTime createdAt; | ||
|
||
@Builder | ||
private Badge(Long memberId, BadgeType type) { | ||
this.memberId = requireNonNull(memberId); | ||
this.type = requireNonNull(type); | ||
} | ||
} |
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,35 @@ | ||
package com.moabam.api.domain.member; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import com.moabam.api.dto.member.BadgeResponse; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum BadgeType { | ||
|
||
MORNING_BIRTH("MORNING", "오목눈이 탄생"), | ||
MORNING_ADULT("MORNING", "어른 오목눈이"), | ||
NIGHT_BIRTH("NIGHT", "부엉이 탄생"), | ||
NIGHT_ADULT("NIGHT", "어른 부엉이"); | ||
|
||
private final String period; | ||
private final String korean; | ||
|
||
BadgeType(String period, String korean) { | ||
this.period = period; | ||
this.korean = korean; | ||
} | ||
|
||
public static List<BadgeResponse> memberBadgeMap(Set<BadgeType> badgeTypes) { | ||
return Arrays.stream(BadgeType.values()) | ||
.map(badgeType -> BadgeResponse.builder() | ||
.badge(badgeType) | ||
.unlock(badgeTypes.contains(badgeType)) | ||
.build()) | ||
.toList(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/moabam/api/domain/member/repository/BadgeRepository.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,9 @@ | ||
package com.moabam.api.domain.member.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import com.moabam.api.domain.member.Badge; | ||
|
||
public interface BadgeRepository extends JpaRepository<Badge, Long> { | ||
|
||
} |
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: 13 additions & 0 deletions
13
src/main/java/com/moabam/api/dto/member/BadgeResponse.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,13 @@ | ||
package com.moabam.api.dto.member; | ||
|
||
import com.moabam.api.domain.member.BadgeType; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record BadgeResponse( | ||
BadgeType badge, | ||
boolean unlock | ||
) { | ||
|
||
} |
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,20 @@ | ||
package com.moabam.api.dto.member; | ||
|
||
import com.moabam.api.domain.member.BadgeType; | ||
|
||
public record MemberInfo( | ||
String nickname, | ||
String profileImage, | ||
String intro, | ||
long totalCertifyCount, | ||
BadgeType badges, | ||
Integer goldenBug, | ||
Integer morningBug, | ||
Integer nightBug | ||
) { | ||
|
||
public MemberInfo(String nickname, String profileImage, String intro, | ||
long totalCertifyCount, BadgeType badges) { | ||
this(nickname, profileImage, intro, totalCertifyCount, badges, null, null, null); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/moabam/api/dto/member/MemberInfoResponse.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,26 @@ | ||
package com.moabam.api.dto.member; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.*; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record MemberInfoResponse( | ||
String nickname, | ||
String profileImage, | ||
String intro, | ||
long level, | ||
long exp, | ||
Map<String, String> birds, | ||
List<BadgeResponse> badges, | ||
@JsonInclude(NON_NULL) Integer goldenBug, | ||
@JsonInclude(NON_NULL) Integer morningBug, | ||
@JsonInclude(NON_NULL) Integer nightBug | ||
) { | ||
|
||
} |
Oops, something went wrong.