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

๐Ÿ”„๏ธ[Refactor] ์•Œ๋ฆผ ๊ธฐ๋Šฅ์— AOP ์ ์šฉ #47

Open
4 tasks
orlzlL opened this issue Apr 12, 2024 · 0 comments
Assignees
Labels
refactor ์กด์žฌ ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ๊ฐœ์„  ๋˜๋Š” ๊ณ ๋„ํ™”

Comments

@orlzlL
Copy link
Contributor

orlzlL commented Apr 12, 2024

๋ฆฌํŒฉํ† ๋ง ๋Œ€์ƒ (Refactoring Target)

Notification์ด ์ ์šฉ๋˜๋Š” Service๊ณ„์ธต ์ „๋ฐ˜

  • CommentService
  • ReplyService
  • FollowService
  • LetterService
  • HotPostService (๋ฏธ๊ตฌํ˜„)

๋ฆฌํŒฉํ† ๋ง ์ด์œ  (Reason for Refactoring)

@Transactional
	@Override
	public void createComment(CommentDTO commentDTO) {
		modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);

		Comment comment = modelMapper.map(commentDTO, Comment.class);
		commentRepository.save(comment);
		System.out.println("[comment] = " + comment);

		// ์ƒˆ ๋Œ“๊ธ€ ๋“ฑ๋ก ์‹œ ์•Œ๋ฆผ
		PostDetailVO post = postService.viewPostById(comment.getPostId());
		MemberDTO postAuthor = memberService.getMemberDetailsByMemberId(post.getMemberId());
		MemberDTO commentAuthor = memberService.getMemberDetailsByMemberId(comment.getMemberId());
		notificationService.send(postAuthor.getMemberId(),
			commentAuthor.getNickname() + "๋‹˜์ด ๋‚ด ๊ธ€์— ๋Œ“๊ธ€์„ ๋‹ฌ์•˜์Šต๋‹ˆ๋‹ค: " + comment.getContent());
	}

์œ„์™€ ๊ฐ™์ด ์•Œ๋ฆผ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ํŠน์ • ๋ฉ”์†Œ๋“œ ๋‚ด์—์„œ ์•Œ๋ฆผ์„ ๋ณด๋‚ด๋Š” ๊ณผ์ •์€ ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์ง€๊ณ  ์œ ์ง€๋ณด์ˆ˜์— ์ทจ์•ฝํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ, Comment-Reply์™€ ๊ฐ™์ด ์„œ๋กœ ๋ฐ€์ ‘ํ•˜๊ฒŒ ์—ฐ๊ด€๋œ ๋ถ€๋ถ„์€ ์ˆœํ™˜์ฐธ์กฐ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด AOP(Aspect-Oriented Programming)๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๊ณตํ†ต์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๋ถ€๋ถ„์„ ๊ฐ๊ฐ ๊ตฌํ˜„ํ•˜๋Š” ๋Œ€์‹  Aspect ๋‹จ์œ„๋กœ ๋ฌถ์–ด ๊ด€๋ฆฌํ•˜๊ณ  ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ณ€๊ฒฝ ๋‚ด์šฉ (Changes Made)

๊ณต๋ถ€์ค‘

๊ฐœ์„ ๋œ ์  (Improvements)

Aspect๋ฅผ ๋ชจ๋“ˆํ™”ํ•˜๊ณ  ๊ณตํ†ต ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ๊ณผ ํŽธ์˜์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ํ–ฅ (Impact)

๊ด€๋ จ ์ด์Šˆ (Related Issues)

#34

์ฒดํฌ๋ฆฌ์ŠคํŠธ (Checklist)

  • ๋ฆฌํŒฉํ† ๋ง ์™„๋ฃŒ
  • ํ…Œ์ŠคํŠธ ์™„๋ฃŒ
  • ๋ฌธ์„œํ™” ์™„๋ฃŒ
  • ๋ฆฌ๋ทฐ ์š”์ฒญ
@orlzlL orlzlL added the refactor ์กด์žฌ ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ๊ฐœ์„  ๋˜๋Š” ๊ณ ๋„ํ™” label Apr 12, 2024
@orlzlL orlzlL added this to the OnionHotSayYo-Server milestone Apr 12, 2024
@orlzlL orlzlL self-assigned this Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor ์กด์žฌ ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ๊ฐœ์„  ๋˜๋Š” ๊ณ ๋„ํ™”
Projects
Status: No status
Development

No branches or pull requests

1 participant