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/redis user repository #5

Merged
merged 7 commits into from
Apr 15, 2024
Merged

Feat/redis user repository #5

merged 7 commits into from
Apr 15, 2024

Conversation

david-parkk
Copy link
Member

@david-parkk david-parkk commented Apr 12, 2024

✏️ 작업 개요

  • refactor + test code

⛳ 작업 분류

  • refactor : find 함수
  • unit test
  • intergration test
  • validation
  • request, response format

🔨 작업 상세 내용

  1. findOne 함수가 저장된 user 엔티티를 return 하도록 변경(spring data redis의 구현체가 boolean이였음)
  2. 유닛 테스트추가

💡 생각해볼 문제

  • 명령형 프로그래밍을 코드를 작성한다면 문제가 생길 수 있어서 최대한 함수형으로 짜기 위해 노력중 (저장되기 전에 유저를 찾는 것이 선행될 수 있음)
  • test 코드는 명령형으로 짜는 게 맞는 거 같음
  • request, response 에 대한 처리는 나중에 (사실 웹소켓이 메인이고 지금은 reactor랑 친해지는 것이 목적)

💣 trouble

@david-parkk david-parkk requested a review from kamothi April 12, 2024 08:53
@david-parkk david-parkk self-assigned this Apr 12, 2024
public class RedisUserController implements UserController{

private final UserService userService;

@PostMapping("/user")
@PostMapping(produces= MediaType.APPLICATION_JSON_VALUE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어노테이션에 해당 값을 넣은 이유가 뭔가요? json으로 받는 것만을 명시하기 위해서인가요?

Copy link
Member

@kamothi kamothi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘해주고 있는거 같아 다행입니다. 남은 구현도 파이팅입니다.

return redisOperations.opsForValue()
.set(user.getKey(),user)
.then(Mono.just(user.getKey()))
.flatMap(key->redisOperations.opsForValue().get(key));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flatMap을 사용한 것이 인상이 깊네요. 만약 정상적으로 처리되었는지 정도만의 처리라면 Boolean 정도만으로도 충분해 보이는거 같아요

Copy link

Test Results

9 tests   9 ✅  1s ⏱️
3 suites  0 💤
3 files    0 ❌

Results for commit 563fe30.

@kamothi kamothi merged commit bebf36a into main Apr 15, 2024
3 checks passed
@kamothi kamothi deleted the feat/RedisUserRepository branch April 15, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants