Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : Backend core 모듈 develop_backend 합병 #425

Merged
merged 84 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
16573f9
feat: 그룹 캡슐 상세 조회
GaBaljaintheroom Apr 18, 2024
e002573
refact: 그룹 캡슐 생성 로직 수정
GaBaljaintheroom Apr 18, 2024
bdec1a9
refact : 그룹 캡슐 상세조회 쿼리 수정
GaBaljaintheroom Apr 18, 2024
01d034f
refact : 벌크 저장 수정
GaBaljaintheroom Apr 19, 2024
51c0d57
feat: 그룹 캡슐 요약 조회 기능 구현
GaBaljaintheroom Apr 19, 2024
3fa2a8d
feat : 그룹 목록 조회 기능 추가
seokho-1116 Apr 19, 2024
8263adf
fix : 그룹 목록 조회 쿼리 수정
seokho-1116 Apr 19, 2024
3ef4cdb
test : 그룹 목록 조회 테스트 추가
seokho-1116 Apr 19, 2024
9bf5a4a
fix : group 테이블 예약어로 인한 설정 추가
seokho-1116 Apr 19, 2024
18533a2
fix : 쿼리 레포지토리 삭제 및 위치 조정
seokho-1116 Apr 20, 2024
29b5047
fix : 머지 충돌 해결
GaBaljaintheroom Apr 29, 2024
ba7c1cf
refact: 캡슐 요약 & 상세 조회 좌표 값 추가
GaBaljaintheroom Apr 29, 2024
6b34864
test : 그룹 캡슐 상세 & 요약 쿼리 테스트
GaBaljaintheroom Apr 30, 2024
e40109a
test : 그룹 캡슐 오픈 벌크 저장 테스트
GaBaljaintheroom Apr 30, 2024
a0f4b27
test : 그룹 캡슐 요약, 상세 service 테스트
GaBaljaintheroom Apr 30, 2024
a3feed2
test : 그룹 캡슐 오픈 여부 저장 테스트
GaBaljaintheroom Apr 30, 2024
986c73b
refact : 회원가입 시 멤버 임시 테이블로 저장
GaBaljaintheroom Apr 30, 2024
335788b
refact : 인증된 member로 전환
GaBaljaintheroom Apr 30, 2024
db37861
chore: 자바 구글 형식 적용
GaBaljaintheroom Apr 30, 2024
00a08cf
refact: 멤버 임시 테이블 삭제 쿼리 추가
GaBaljaintheroom May 2, 2024
06be6ce
chore: 머지 충돌 해결
GaBaljaintheroom May 2, 2024
af6f7fd
Merge branch 'develop_back_core' into ARCH-161-B-feat/group_capsule_d…
seokho-1116 May 2, 2024
e69c774
refact: 빌더 패턴 누락 없이 Null check validate 추가
GaBaljaintheroom May 3, 2024
08aeb98
fix: 인증된 회원 저장 메서드명 변경
GaBaljaintheroom May 3, 2024
1440bdd
chore: 자바 구글 형식 적용
GaBaljaintheroom May 3, 2024
9fc815f
refact: 친구 검색 API 친구 요청 필드 수정
GaBaljaintheroom May 3, 2024
152426f
refact: 친구 요청 받은 상태 확인
GaBaljaintheroom May 3, 2024
a7ee91e
test: friend 검색 service 테스트
GaBaljaintheroom May 3, 2024
0ed96d2
fix : 기존 url 변경
seokho-1116 May 3, 2024
7d52772
fix : 메서드 이름 수정
seokho-1116 May 3, 2024
08543c3
feat : 지도용, AR용 친구 캡슐 조회 추가
seokho-1116 May 3, 2024
9199da1
fix: MemberFriend 쿼리 수정
GaBaljaintheroom May 3, 2024
bc34a4e
fix : 쿼리 리팩토링
seokho-1116 May 3, 2024
d3a97b1
test : 쿼리 테스트 추가
seokho-1116 May 3, 2024
5f48a3c
fix : @Validated 제거, final 추가, distance 추가
seokho-1116 May 4, 2024
9e91b34
feat : 마이페이지 - 내가 만든 친구 캡슐 목록 조회
seokho-1116 May 4, 2024
c4cdb91
feat : 마이페이지 - 내가 만든 그룹 캡슐 목록 조회
seokho-1116 May 4, 2024
220542f
test : 마이페이지 - 내가 만든 공개 캡슐, 내가 만든 그룹 캡슐 테스트 추가
seokho-1116 May 4, 2024
b4f7f52
fix : 기존 캡슐 URL 수정, 캡슐 생성 부분 이동
seokho-1116 May 4, 2024
9521db8
fix : final 키워드 추가
seokho-1116 May 4, 2024
9de09e6
refact: 친구 양방향 인터셉터 제거
GaBaljaintheroom May 5, 2024
9711525
Merge branch 'develop_back_core' into fix/create_temporary_table-B-380
seokho-1116 May 5, 2024
dce805c
Merge pull request #387 from tukcomCD2024/fix/create_temporary_table-…
seokho-1116 May 5, 2024
7649f06
Merge branch 'develop_back_core' of https://github.com/tukcomCD2024/D…
GaBaljaintheroom May 5, 2024
854f951
Merge pull request #391 from tukcomCD2024/fix/friend_request_B-#389
seokho-1116 May 5, 2024
6b718f7
Merge branch 'refs/heads/develop_back_core' into feat/capsule_friends…
seokho-1116 May 5, 2024
aaa6697
Merge branch 'develop_back_core' into ARCH-161-B-feat/group_capsule_d…
GaBaljaintheroom May 5, 2024
80759f9
fix : 머지 충돌 해결
seokho-1116 May 5, 2024
74ef786
Merge pull request #392 from tukcomCD2024/feat/capsule_friends_only-B…
seokho-1116 May 5, 2024
55a2b73
chore : 머지 충돌 해결
GaBaljaintheroom May 5, 2024
753b91f
Merge branch 'refs/heads/develop_back_core' into feat/my_capsule-B-#311
seokho-1116 May 5, 2024
87b2002
Merge branch 'ARCH-161-B-feat/group_capsule_detail' of https://github…
GaBaljaintheroom May 5, 2024
1731ec4
fix : 머지 충돌 해결
seokho-1116 May 5, 2024
1e101f6
Merge pull request #393 from tukcomCD2024/feat/my_capsule-B-#311
seokho-1116 May 5, 2024
aa927ad
chore: 머지 충돌 해결
GaBaljaintheroom May 5, 2024
b991378
refact: 캡슐 응답 builder 패턴 적용
GaBaljaintheroom May 5, 2024
13ebd94
Merge pull request #357 from tukcomCD2024/ARCH-161-B-feat/group_capsu…
seokho-1116 May 5, 2024
a56825e
fix : 브랜치 머지 오류 수정
seokho-1116 May 6, 2024
7e2c3ba
fix : 서비스 스펙 수정, 컨트롤러 응답 수정
seokho-1116 May 6, 2024
b0a933b
test : 그룹 상세 조회 쿼리 테스트 추가
seokho-1116 May 6, 2024
7fae7d1
fix : response 할 때 시간 변환 수정, 응답 문서화 추가
seokho-1116 May 6, 2024
b70183a
fix : 그룹 상세조회 시 검증 추가
seokho-1116 May 6, 2024
99eab10
Merge branch 'refs/heads/develop_back_core' into ARCH-87-B-feat/group…
seokho-1116 May 6, 2024
edf4be2
fix : fixture 충돌 해결
seokho-1116 May 6, 2024
9d4a8ac
fix : dto, response 중복 오류 수정
seokho-1116 May 6, 2024
b0c8499
fix : final 누락 추가
seokho-1116 May 6, 2024
385fa33
Merge pull request #395 from tukcomCD2024/fix/branch_merge_error-B-co…
GaBaljaintheroom May 6, 2024
0564f05
fix : dto -> response 오류 수정
seokho-1116 May 6, 2024
8450687
fix : 변수 이름 수정
seokho-1116 May 6, 2024
d8cf5bd
Merge branch 'refs/heads/develop_back_core' into ARCH-87-B-feat/group…
seokho-1116 May 6, 2024
34dab2c
Merge pull request #396 from tukcomCD2024/ARCH-87-B-feat/group_list
GaBaljaintheroom May 6, 2024
2b8c7f8
Merge pull request #399 from tukcomCD2024/fix/dto_to_response_error-B…
GaBaljaintheroom May 6, 2024
3056950
refact: 그룹 캡슐 상세 & 요약 쿼리 개선
GaBaljaintheroom May 6, 2024
97e193e
refact: 그룹 상세 조회 select -> selectFrom 변경
GaBaljaintheroom May 6, 2024
61f81e5
test: 그룹 캡슐 쿼리 테스트 수정
GaBaljaintheroom May 6, 2024
c809285
test: 그룹 캡슐 상세 & 요약 쿼리 테스트 수정
GaBaljaintheroom May 6, 2024
1f16fee
rafact : s3 URL 생성 조건문 추가
GaBaljaintheroom May 6, 2024
fce88b5
Merge pull request #401 from tukcomCD2024/fix/update_group_capsule-B-…
seokho-1116 May 6, 2024
4e7c452
fix : 쿼리 오류 수정
seokho-1116 May 9, 2024
ccc7b86
fix : test 오류 수정
seokho-1116 May 9, 2024
0b1c22c
Merge pull request #410 from tukcomCD2024/fix/ar_capsules-B-core-#409
GaBaljaintheroom May 10, 2024
e7d45ac
feat : submodule update
seokho-1116 May 12, 2024
fbf28b5
chore: 알림 ymal 설정
GaBaljaintheroom May 14, 2024
22e6de2
refact : 전화번호 인증 후 식별 멤버 id 반환
GaBaljaintheroom May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import site.timecapsulearchive.core.domain.auth.data.response.VerificationMessageSendResponse;
import site.timecapsulearchive.core.domain.auth.service.MessageVerificationService;
import site.timecapsulearchive.core.domain.auth.service.TokenManager;
import site.timecapsulearchive.core.domain.member.data.mapper.MemberMapper;
import site.timecapsulearchive.core.domain.member.service.MemberService;
import site.timecapsulearchive.core.global.common.response.ApiSpec;
import site.timecapsulearchive.core.global.common.response.SuccessCode;
Expand All @@ -40,7 +39,6 @@ public class AuthApiController implements AuthApi {
private final TokenManager tokenService;
private final MessageVerificationService messageVerificationService;
private final MemberService memberService;
private final MemberMapper memberMapper;


@GetMapping(value = "/login/url/kakao", produces = {"application/json"})
Expand Down Expand Up @@ -126,7 +124,7 @@ public ResponseEntity<ApiSpec<TokenResponse>> reIssueAccessToken(
public ResponseEntity<ApiSpec<TemporaryTokenResponse>> signUpWithSocialProvider(
@Valid @RequestBody final SignUpRequest request
) {
final Long id = memberService.createMember(memberMapper.signUpRequestToDto(request));
final Long id = memberService.createMember(request.toDto());

return ResponseEntity.ok(
ApiSpec.success(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import site.timecapsulearchive.core.domain.member.data.dto.SignUpRequestDto;
import site.timecapsulearchive.core.domain.member.entity.SocialType;

@Schema(description = "소셜 프로바이더의 인증 아이디로 회원가입 요청")
Expand All @@ -27,4 +28,13 @@ public record SignUpRequest(
SocialType socialType
) {

public SignUpRequestDto toDto() {
return new SignUpRequestDto(
authId,
email,
profileUrl,
socialType
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import site.timecapsulearchive.core.domain.auth.exception.CertificationNumberNotMatchException;
import site.timecapsulearchive.core.domain.auth.repository.MessageAuthenticationCacheRepository;
import site.timecapsulearchive.core.domain.member.entity.Member;
import site.timecapsulearchive.core.domain.member.entity.MemberTemporary;
import site.timecapsulearchive.core.domain.member.exception.MemberNotFoundException;
import site.timecapsulearchive.core.domain.member.repository.MemberRepository;
import site.timecapsulearchive.core.domain.member.repository.MemberTemporaryRepository;
import site.timecapsulearchive.core.global.security.encryption.AESEncryptionManager;
import site.timecapsulearchive.core.global.security.encryption.HashEncryptionManager;
import site.timecapsulearchive.core.infra.sms.data.response.SmsApiResponse;
Expand All @@ -30,6 +32,7 @@ public class MessageVerificationService {
private final MessageAuthenticationCacheRepository messageAuthenticationCacheRepository;
private final SmsApiManager smsApiManager;
private final MemberRepository memberRepository;
private final MemberTemporaryRepository memberTemporaryRepository;
private final TokenManager tokenManager;

private final AESEncryptionManager aesEncryptionManager;
Expand Down Expand Up @@ -90,22 +93,27 @@ public TokenResponse validVerificationMessage(
throw new CertificationNumberNotMatchException();
}

updateMemberData(memberId, plain);
final Long verifiedMemberId = updateToVerifiedMember(memberId, plain);

return tokenManager.createNewToken(memberId);
return tokenManager.createNewToken(verifiedMemberId);
}

private boolean isNotMatch(final String certificationNumber,
final String findCertificationNumber) {
return !certificationNumber.equals(findCertificationNumber);
}

private void updateMemberData(final Long memberId, final byte[] plain) {
final Member findMember = memberRepository.findMemberById(memberId)
private Long updateToVerifiedMember(final Long memberId, final byte[] plain) {
final MemberTemporary memberTemporary = memberTemporaryRepository.findById(memberId)
.orElseThrow(MemberNotFoundException::new);

findMember.updatePhoneHash(hashEncryptionManager.encrypt(plain));
findMember.updatePhoneNumber(aesEncryptionManager.encryptWithPrefixIV(plain));
findMember.updateVerification();
memberTemporaryRepository.delete(memberTemporary);

final Member verifiedMember = memberTemporary.toMember(hashEncryptionManager.encrypt(plain),
aesEncryptionManager.encryptWithPrefixIV(plain));

memberRepository.save(verifiedMember);

return verifiedMember.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import java.util.Objects;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import site.timecapsulearchive.core.domain.member.entity.Member;
Expand All @@ -26,11 +28,21 @@ public class GroupCapsuleOpen extends BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "is_opened", nullable = false)
private Boolean isOpened;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "capsule_id", nullable = false)
private Capsule capsule;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id", nullable = false)
private Member member;

@Builder
private GroupCapsuleOpen(Boolean isOpened, Capsule capsule, Member member) {
this.isOpened = Objects.requireNonNull(isOpened);
this.capsule = Objects.requireNonNull(capsule);
this.member = Objects.requireNonNull(member);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.hibernate.validator.constraints.Range;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import site.timecapsulearchive.core.domain.capsule.entity.CapsuleType;
import site.timecapsulearchive.core.domain.capsule.generic_capsule.data.request.CapsuleCreateRequest;
import site.timecapsulearchive.core.domain.capsule.generic_capsule.data.response.CapsuleOpenedResponse;
import site.timecapsulearchive.core.domain.capsule.generic_capsule.data.response.ImagesPageResponse;
import site.timecapsulearchive.core.domain.capsule.generic_capsule.data.response.NearbyARCapsuleResponse;
import site.timecapsulearchive.core.domain.capsule.generic_capsule.data.response.NearbyCapsuleResponse;
import site.timecapsulearchive.core.global.common.response.ApiSpec;
import site.timecapsulearchive.core.global.error.ErrorResponse;

@Validated
public interface CapsuleApi {

@Operation(
Expand Down Expand Up @@ -56,14 +58,16 @@ ResponseEntity<ImagesPageResponse> getImages(
description = "잘못된 요청 파라미터에 의해 발생"
)
})
ResponseEntity<ApiSpec<NearbyARCapsuleResponse>> getNearbyARCapsules(
ResponseEntity<ApiSpec<NearbyARCapsuleResponse>> getARNearbyMyCapsules(
Long memberId,

@Parameter(in = ParameterIn.QUERY, description = "위도(wsg84)", required = true)
double longitude,
@Range(min = -90, max = 90, message = "위도는 -90과 90 사이여야 합니다.")
double latitude,

@Parameter(in = ParameterIn.QUERY, description = "경도(wsg84)", required = true)
double latitude,
@Range(min = -180, max = 180, message = "경도는 -180과 180 사이여야 합니다.")
double longitude,

@Parameter(in = ParameterIn.QUERY, description = "조회 거리(km)", required = true)
double distance,
Expand All @@ -88,14 +92,16 @@ ResponseEntity<ApiSpec<NearbyARCapsuleResponse>> getNearbyARCapsules(
description = "잘못된 요청 파라미터에 의해 발생"
)
})
ResponseEntity<ApiSpec<NearbyCapsuleResponse>> getNearbyCapsules(
ResponseEntity<ApiSpec<NearbyCapsuleResponse>> getMapNearbyMyCapsules(
Long memberId,

@Parameter(in = ParameterIn.QUERY, description = "위도(wsg84)", required = true)
double longitude,
@Range(min = -90, max = 90, message = "위도는 -90과 90 사이여야 합니다.")
double latitude,

@Parameter(in = ParameterIn.QUERY, description = "경도(wsg84)", required = true)
double latitude,
@Range(min = -180, max = 180, message = "경도는 -180과 180 사이여야 합니다.")
double longitude,

@Parameter(in = ParameterIn.QUERY, description = "조회 거리(km)", required = true)
double distance,
Expand All @@ -105,8 +111,8 @@ ResponseEntity<ApiSpec<NearbyCapsuleResponse>> getNearbyCapsules(
);

@Operation(
summary = "캡슐 열람 상태로 변경",
description = "캡슐을 열람 상태를 변경해준다.",
summary = "현재 사용자 위치 기준으로 사용자의 친구들의 지도용 캡슐 목록 조회",
description = "지도에서 캡슐을 보기 위해 현재 사용자 위치를 바탕으로 반경 distance km만큼 친구들의 캡슐을 조회한다.",
security = {@SecurityRequirement(name = "user_token")},
tags = {"capsule"}
)
Expand All @@ -116,70 +122,78 @@ ResponseEntity<ApiSpec<NearbyCapsuleResponse>> getNearbyCapsules(
description = "처리 완료"
),
@ApiResponse(
responseCode = "404",
description = "해당 캡슐을 찾을 수 없을 경우 발생하는 예외",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
responseCode = "400",
description = "잘못된 요청 파라미터에 의해 발생"
)
})
ResponseEntity<ApiSpec<CapsuleOpenedResponse>> updateCapsuleOpened(
ResponseEntity<ApiSpec<NearbyCapsuleResponse>> getMapNearbyFriendsCapsules(
Long memberId,

@Parameter(in = ParameterIn.PATH, description = "캡슐 아이디", required = true)
Long capsuleId
@Parameter(in = ParameterIn.QUERY, description = "위도(wsg84)", required = true)
@Range(min = -90, max = 90, message = "위도는 -90과 90 사이여야 합니다.")
double latitude,

@Parameter(in = ParameterIn.QUERY, description = "경도(wsg84)", required = true)
@Range(min = -180, max = 180, message = "경도는 -180과 180 사이여야 합니다.")
double longitude,

@Parameter(in = ParameterIn.QUERY, description = "조회 거리(km)", required = true)
double distance
);

@Operation(
summary = "비밀 캡슐 생성",
description = "사용자만 볼 수 있는 비밀 캡슐을 생성한다.",
summary = "현재 사용자 위치 기준으로 사용자의 친구들의 AR용 캡슐 목록 조회",
description = "AR 카메라로 캡슐을 보기 위해 현재 사용자 위치를 바탕으로 반경 distance km만큼 친구들의 캡슐을 조회한다.",
security = {@SecurityRequirement(name = "user_token")},
tags = {"secret capsule"}
tags = {"capsule"}
)
@ApiResponses(value = {
@ApiResponse(
responseCode = "202",
description = "처리 시작"
responseCode = "200",
description = "처리 완료"
),
@ApiResponse(
responseCode = "400",
description = "좌표변환을 할 수 없을 때 발생하는 예외, 입력좌표 확인 요망",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
),
@ApiResponse(
responseCode = "404",
description = "캡슐 스킨을 찾을 수 없을 경우 발생하는 예외",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
description = "잘못된 요청 파라미터에 의해 발생"
)
})
ResponseEntity<ApiSpec<String>> createSecretCapsule(
ResponseEntity<ApiSpec<NearbyARCapsuleResponse>> getARNearbyFriendsCapsules(
Long memberId,
CapsuleCreateRequest request

@Parameter(in = ParameterIn.QUERY, description = "위도(wsg84)", required = true)
@Range(min = -90, max = 90, message = "위도는 -90과 90 사이여야 합니다.")
double latitude,

@Parameter(in = ParameterIn.QUERY, description = "경도(wsg84)", required = true)
@Range(min = -180, max = 180, message = "경도는 -180과 180 사이여야 합니다.")
double longitude,

@Parameter(in = ParameterIn.QUERY, description = "조회 거리(km)", required = true)
double distance
);

@Operation(
summary = "공개 캡슐 생성",
description = "사용자의 친구들만 볼 수 있는 공개 캡슐을 생성한다.",
summary = "캡슐 열람 상태로 변경",
description = "캡슐을 열람 상태를 변경해준다.",
security = {@SecurityRequirement(name = "user_token")},
tags = {"public capsule"}
tags = {"capsule"}
)
@ApiResponses(value = {
@ApiResponse(
responseCode = "202",
description = "처리 시작"
),
@ApiResponse(
responseCode = "400",
description = "좌표변환을 할 수 없을 때 발생하는 예외, 입력좌표 확인 요망",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
responseCode = "200",
description = "처리 완료"
),
@ApiResponse(
responseCode = "404",
description = "캡슐 스킨을 찾을 수 없을 경우 발생하는 예외",
description = "해당 캡슐을 찾을 수 없을 경우 발생하는 예외",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))
)
})
ResponseEntity<ApiSpec<String>> createPublicCapsule(
ResponseEntity<ApiSpec<CapsuleOpenedResponse>> updateCapsuleOpened(
Long memberId,
CapsuleCreateRequest request

@Parameter(in = ParameterIn.PATH, description = "캡슐 아이디", required = true)
Long capsuleId
);
}

Loading
Loading