Skip to content

Commit

Permalink
Merge branch 'develop_back_core' into feat/group_accept_B-#414
Browse files Browse the repository at this point in the history
  • Loading branch information
GaBaljaintheroom authored May 14, 2024
2 parents c3f7609 + 22e6de2 commit bfeeacb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,27 @@ public TokenResponse validVerificationMessage(
throw new CertificationNumberNotMatchException();
}

updateToVerifiedMember(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 updateToVerifiedMember(final Long memberId, final byte[] plain) {
private Long updateToVerifiedMember(final Long memberId, final byte[] plain) {
final MemberTemporary memberTemporary = memberTemporaryRepository.findById(memberId)
.orElseThrow(MemberNotFoundException::new);

memberTemporaryRepository.delete(memberTemporary);

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

memberRepository.save(member);
memberRepository.save(verifiedMember);

return verifiedMember.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public List<NearbyARCapsuleSummaryDto> findARCapsuleSummaryDtosByCurrentLocation
.join(capsule.capsuleSkin, capsuleSkin)
.join(capsule.member, member)
.where(ST_Contains(mbr, capsule.point).and(capsule.member.id.eq(memberId)
.and(eqCapsuleType(capsuleType)))
.and(capsule.type.eq(CapsuleType.PUBLIC)))
.and(eqCapsuleType(capsuleType))))
.fetch();
}

Expand Down
2 changes: 1 addition & 1 deletion backend/core/src/main/resources/config
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ void setup(@Autowired EntityManager entityManager) {

//then
SoftAssertions.assertSoftly(softly -> {
assertThat(capsules).isNotEmpty();
assertThat(capsules).allMatch(c -> c.capsuleType().equals(capsuleType));
assertThat(capsules).allMatch(c -> myCapsuleIds.contains(c.id()));
assertThat(capsules).allMatch(c -> mbr.contains(c.point()));
Expand All @@ -153,6 +154,7 @@ void setup(@Autowired EntityManager entityManager) {

//then
SoftAssertions.assertSoftly(softly -> {
assertThat(capsules).isNotEmpty();
assertThat(capsules).allMatch(c -> c.capsuleType().equals(capsuleType));
assertThat(capsules).allMatch(c -> myCapsuleIds.contains(c.id()));
assertThat(capsules).allMatch(c -> mbr.contains(c.point()));
Expand All @@ -172,6 +174,7 @@ void setup(@Autowired EntityManager entityManager) {

//then
SoftAssertions.assertSoftly(softly -> {
assertThat(capsules).isNotEmpty();
assertThat(capsules).allMatch(c -> c.capsuleType().equals(capsuleType));
assertThat(capsules).allMatch(c -> myCapsuleIds.contains(c.id()));
assertThat(capsules).allMatch(c -> mbr.contains(c.point()));
Expand All @@ -191,6 +194,7 @@ void setup(@Autowired EntityManager entityManager) {

//then
SoftAssertions.assertSoftly(softly -> {
assertThat(capsules).isNotEmpty();
assertThat(capsules).allMatch(c -> c.capsuleType().equals(capsuleType));
assertThat(capsules).allMatch(c -> myCapsuleIds.contains(c.id()));
assertThat(capsules).allMatch(c -> mbr.contains(c.point()));
Expand All @@ -210,6 +214,7 @@ void setup(@Autowired EntityManager entityManager) {

//then
SoftAssertions.assertSoftly(softly -> {
assertThat(capsules).isNotEmpty();
assertThat(capsules).allMatch(
c -> c.capsuleType().equals(CapsuleType.PUBLIC) ||
c.capsuleType().equals(CapsuleType.SECRET) ||
Expand All @@ -233,6 +238,7 @@ void setup(@Autowired EntityManager entityManager) {

//then
SoftAssertions.assertSoftly(softly -> {
assertThat(capsules).isNotEmpty();
assertThat(capsules).allMatch(
c -> c.capsuleType().equals(CapsuleType.PUBLIC) ||
c.capsuleType().equals(CapsuleType.SECRET) ||
Expand All @@ -255,6 +261,7 @@ void setup(@Autowired EntityManager entityManager) {

//then
SoftAssertions.assertSoftly(softly -> {
assertThat(capsules).isNotEmpty();
assertThat(capsules).allMatch(c -> friendCapsuleIds.contains(c.id()));
assertThat(capsules).allMatch(c -> c.capsuleType().equals(CapsuleType.PUBLIC));
assertThat(capsules).allMatch(c -> mbr.contains(c.point()));
Expand All @@ -268,11 +275,12 @@ void setup(@Autowired EntityManager entityManager) {

//when
List<NearbyARCapsuleSummaryDto> capsules = capsuleQueryRepository.findFriendsARCapsulesByCurrentLocation(
friendCapsuleIds, mbr
friendIds, mbr
);

//then
SoftAssertions.assertSoftly(softly -> {
assertThat(capsules).isNotEmpty();
assertThat(capsules).allMatch(c -> friendCapsuleIds.contains(c.id()));
assertThat(capsules).allMatch(c -> c.capsuleType().equals(CapsuleType.PUBLIC));
assertThat(capsules).allMatch(c -> mbr.contains(c.point()));
Expand Down
2 changes: 1 addition & 1 deletion backend/notification/src/main/resources/config

0 comments on commit bfeeacb

Please sign in to comment.