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

[PC-380] 어드민 유저 프로필 조회 기능 #25

Merged
merged 46 commits into from
Jan 25, 2025
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b4eba3f
[PC-380] fix: Profile Base Entity 상속
Lujaec Jan 19, 2025
9c2b43b
[PC-380] feat: 프로필 status 컬럼 추가
Lujaec Jan 19, 2025
58cf4c6
[PC-380] feat: 프로필 리젝 로그 테이블 추가
Lujaec Jan 19, 2025
35985f5
[PC-380] refactor: 사용하지 않는 클래스 삭제
Lujaec Jan 19, 2025
2a3f4ac
[PC-380] refactor: common:domain 모듈 생성
Lujaec Jan 19, 2025
d00b2c2
[PC-380] refactor: common:domain 모듈 생성
Lujaec Jan 19, 2025
fcae56e
[PC-380] refactor: common:domain 모듈 생성
Lujaec Jan 19, 2025
32cc85e
[PC-380] refactor: common 모듈에서 domain 모듈 세분화
Lujaec Jan 19, 2025
0e13af3
[PC-380] fix: 프로필 상태 컬럼 네이밍 변경
Lujaec Jan 19, 2025
aff12ce
[PC-000] chore: 컨벤션 수정
Lujaec Jan 19, 2025
2287031
[PC-000] refactor: 모듈 세분화
Lujaec Jan 19, 2025
7ced203
[PC-000] feat: common:domain 모듈 공통 응답 추가
Lujaec Jan 19, 2025
dd2cb6e
[PC-380] feat: admin 모듈 시큐리티 설정 추가
Lujaec Jan 19, 2025
143c161
[PC-380] chore: 더미 데이터 스크립트 수정
Lujaec Jan 19, 2025
462c554
[PC-380] feat: admin 모듈 사용자 조회 기능
Lujaec Jan 19, 2025
25e8476
[PC-381] typo: nickname 프로퍼티 수정
Lujaec Jan 19, 2025
144424d
[PC-381] fix: 프로필 에러 코드 메시지 수정
Lujaec Jan 19, 2025
898c387
[PC-381] feat: 프로필 상셍 조회 기능
Lujaec Jan 19, 2025
abefcb7
[PC-384] feat: 신고 도메인 생성
Lujaec Jan 20, 2025
596bd68
[PC-384] feat: ManyToOne 관계로 수정
Lujaec Jan 20, 2025
1a84a2f
[PC-384] feat: 신고 리스트 조회 기능
Lujaec Jan 20, 2025
1ed9030
[PC-384] fix: 더미 데이터 수정 (사용자, 프로필 10개)
Lujaec Jan 20, 2025
bbdb68b
[PC-384] feat: 신고 상세 데이터 조회 기능
Lujaec Jan 20, 2025
0fc3306
[PC-383] fix: 연락처 기반 차단 네이밍 수정 (Block -> BlockContact)
Lujaec Jan 20, 2025
3a500dc
[PC-383] feat: 차단 데이터 조회 기능
Lujaec Jan 20, 2025
42cdd4f
[PC-383] feat: 차단 더미 데이터 추가
Lujaec Jan 20, 2025
c62fb0b
[PC-382] fix: RoleStatus 패키지 위치 변경
Lujaec Jan 23, 2025
bec3149
[PC-382] fix: ManyToOne 관계로 수정
Lujaec Jan 23, 2025
986e182
[PC-382] fix: response 변수 이름 수정 (reason -> reject)
Lujaec Jan 23, 2025
ff5eb50
[PC-382] feat: 관리자 유저 프로필 상태 수정 기능
Lujaec Jan 23, 2025
1ec6d93
[PC-382] feat: 관리자 유저 프로필 상태 수정 기능
Lujaec Jan 23, 2025
fadde4f
[PC-382] feat: 리젝 하는 경우 멤버 상태 PENDING으로 수정
Lujaec Jan 23, 2025
aee284c
[PC-379] fix: auth 모듈 분리
Lujaec Jan 23, 2025
af3bfa2
[PC-379] feat: admin 모듈 oauthId 기반 조회 기능
Lujaec Jan 23, 2025
13edacc
[PC-379] feat: admin 모듈 jwt 필터 적용
Lujaec Jan 23, 2025
da942bc
[PC-379] feat: admin 모듈 로그인 기능
Lujaec Jan 23, 2025
d5decee
[PC-379] chore: 누락 파일
Lujaec Jan 23, 2025
0f3b262
Merge remote-tracking branch 'origin/develope' into feat/PC-380-admin…
devchlee12 Jan 25, 2025
7d2e9f3
[PC-380] feat: 머지 충돌 수정
devchlee12 Jan 25, 2025
50629e7
Merge pull request #34 from YAPP-Github/feature/PC-379-admin-sign-in
Lujaec Jan 25, 2025
04f7819
Merge pull request #33 from YAPP-Github/feature/PC-382-admin-update-m…
Lujaec Jan 25, 2025
fc6567a
Merge pull request #28 from YAPP-Github/feature/PC-383-admin-read-block
Lujaec Jan 25, 2025
0801520
Merge pull request #27 from YAPP-Github/feature/PC-384-admin-read-report
Lujaec Jan 25, 2025
40f7f59
Merge branch 'feat/PC-380-admin-profile-read' into feat/PC-381-admin-…
Lujaec Jan 25, 2025
8542bd0
[PC-381] PR 병합
Lujaec Jan 25, 2025
7364362
Merge pull request #26 from YAPP-Github/feat/PC-381-admin-profile-det…
Lujaec Jan 25, 2025
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
Prev Previous commit
Next Next commit
[PC-383] fix: 연락처 기반 차단 네이밍 수정 (Block -> BlockContact)
Lujaec committed Jan 20, 2025
commit 0fc3306fbdd58610dc30f156589a5f0f51ca424c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.yapp.domain.block.application;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yapp.domain.block.BlockContact;
import org.yapp.domain.block.application.dto.BlockContactCreateDto;
import org.yapp.domain.block.dao.BlockContactRepository;
import org.yapp.domain.user.User;

@Service
@RequiredArgsConstructor
public class BlockContactService {

private final BlockContactRepository blockContactRepository;

@Transactional()
public void blockPhoneNumbers(BlockContactCreateDto blockContactCreateDto) {
Long userId = blockContactCreateDto.userId();
List<String> phoneNumbers = blockContactCreateDto.phoneNumbers();
List<BlockContact> newBlockContacts = new ArrayList<>();

Set<String> blockedPhoneNumbers = blockContactRepository.findBlocksByUserId(userId)
.stream()
.map(BlockContact::getPhoneNumber)
.collect(Collectors.toSet());

phoneNumbers.stream()
.filter(phoneNumber -> !blockedPhoneNumbers.contains(phoneNumber))
.forEach(phoneNumber -> {
BlockContact blockContact = BlockContact.builder()
.user(User.builder().id(userId).build())
.phoneNumber(phoneNumber)
.build();
newBlockContacts.add(blockContact);
});

blockContactRepository.saveAll(newBlockContacts);
}

@Transactional(readOnly = false)
public List<BlockContact> findBlocksByUserId(Long userId) {
return blockContactRepository.findBlocksByUserId(userId);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.yapp.domain.block.application.dto;

import java.util.List;

public record BlockContactCreateDto(Long userId, List<String> phoneNumbers) {

public BlockContactCreateDto(Long userId, List<String> phoneNumbers) {
this.userId = userId;
this.phoneNumbers = phoneNumbers.stream()
.map(phone -> phone.replaceAll("-", ""))
.toList();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.yapp.domain.block.dao;

import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.yapp.domain.block.Block;

import java.util.List;
import org.yapp.domain.block.BlockContact;

@Repository
public interface BlockRepository extends JpaRepository<Block, Long> {
List<Block> findBlocksByUserId(Long userId);
public interface BlockContactRepository extends JpaRepository<BlockContact, Long> {

List<BlockContact> findBlocksByUserId(Long userId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.yapp.domain.block.presentation;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yapp.domain.block.BlockContact;
import org.yapp.domain.block.application.BlockContactService;
import org.yapp.domain.block.application.dto.BlockContactCreateDto;
import org.yapp.domain.block.presentation.dto.request.BlockPhoneNumbersRequest;
import org.yapp.domain.block.presentation.dto.response.UserBlockContactResponses;
import org.yapp.util.CommonResponse;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/blockContacts")
public class BlockContactController {

private final BlockContactService blockContactService;

@PostMapping("")
@Operation(summary = "핸드폰 번호 차단", description = "핸드폰 번호 리스트를 전달받고, 전달받은 핸드폰 번호 차단을 수행합니다.", tags = {
"차단"})
@ApiResponse(responseCode = "200", description = "핸드폰 차단 성공")
public ResponseEntity<CommonResponse<Void>> blockPhoneNumbers(
@AuthenticationPrincipal Long userId, @RequestBody BlockPhoneNumbersRequest request) {
blockContactService.blockPhoneNumbers(
new BlockContactCreateDto(userId, request.phoneNumbers()));
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccessWithNoContent("핸드폰 번호 차단 성공"));
}

@GetMapping("")
@Operation(summary = "핸드폰 번호 차단", description = "핸드폰 번호 리스트를 전달받고, 전달받은 핸드폰 번호 차단을 수행합니다.", tags = {
"차단"})
@ApiResponse(responseCode = "200", description = "핸드폰 차단 성공")
public ResponseEntity<CommonResponse<UserBlockContactResponses>> blockPhoneNumbers(
@AuthenticationPrincipal Long userId) {
List<BlockContact> blockContacts = blockContactService.findBlocksByUserId(userId);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(UserBlockContactResponses.from(userId,
blockContacts)));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -2,5 +2,6 @@

import java.time.LocalDateTime;

public record BlockResponse(String phoneNumber, LocalDateTime blockedAt) {
public record BlockContactResponse(String phoneNumber, LocalDateTime blockedAt) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.yapp.domain.block.presentation.dto.response;

import java.util.List;
import org.yapp.domain.block.BlockContact;

public record UserBlockContactResponses(Long userId,
List<BlockContactResponse> blockContactResponses) {

public static UserBlockContactResponses from(Long userId, List<BlockContact> blockContacts) {
List<BlockContactResponse> blockContactResponses = blockContacts.stream().map(
blockContact -> new BlockContactResponse(blockContact.getPhoneNumber(),
blockContact.getCreatedAt())).toList();

return new UserBlockContactResponses(
userId,
blockContactResponses
);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
@Index(name = "idx_phone_number", columnList = "phoneNumber"),
}
)
public class Block extends BaseEntity {
public class BlockContact extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)