Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
2b552b5
:recycle:Refactor: ๊ฒŒ์‹œ๊ธ€ ์นดํ…Œ๊ณ ๋ฆฌ ์ถ”๊ฐ€
uni-j-uni Dec 15, 2025
35dc1b9
:heavy_plus_sign:Dependency: WebSocket ์˜์กด์„ฑ ์ถ”๊ฐ€
uni-j-uni Dec 15, 2025
920a8db
:recycle:Refactor: ๊ตํ™˜ ๊ฒŒ์‹œ๊ธ€ ์‹๋ณ„์ž ์ถ”๊ฐ€ ๋ฐ ๋กœ์ง ์ˆ˜์ •
uni-j-uni Dec 15, 2025
255265e
:sparkles:Feat: ์›น์†Œ์ผ“ ๊ธฐ๋ฐ˜ ์ฑ„ํŒ… ๊ธฐ๋Šฅ ๊ตฌํ˜„
uni-j-uni Dec 15, 2025
67b5775
Merge branch 'main' into feature/chat
uni-j-uni Dec 15, 2025
59f12f0
:recycle:Refactor: ๊ฒŒ์‹œ๊ธ€ ์ฟผ๋ฆฌ ๋ฉ”์†Œ๋“œ ์˜ค๋ฅ˜ ์ˆ˜์ •
uni-j-uni Dec 15, 2025
e1b1a72
:recycle:Refactor: ์ฝ”๋“œ ๋ฆฌ๋ทฐ ๊ธฐ๋ฐ˜ ์ˆ˜์ •์‚ฌํ•ญ ๋ฐ˜์˜
uni-j-uni Dec 15, 2025
93e6daf
:recycle:Refactor: ์ฝ”๋“œ ๋ฆฌ๋ทฐ ๊ธฐ๋ฐ˜ ์ˆ˜์ •์‚ฌํ•ญ ๋ฐ˜์˜
uni-j-uni Dec 15, 2025
f7e9f5c
Merge branch 'main' of https://github.com/refit-lab/refit-be into feaโ€ฆ
uni-j-uni Dec 15, 2025
1d06f3c
:recycle:Refactor: ์ปค๋ฎค๋‹ˆํ‹ฐ ๊ฒŒ์‹œ๊ธ€ ์ „์ฒด ์กฐํšŒ ๊ฐ€๋Šฅํ•˜๋„๋ก ์ˆ˜์ •
uni-j-uni Dec 15, 2025
5ab42e4
:wrench:Settings: ํ”„๋ก ํŠธ ๋ฐฐํฌ ๋„๋ฉ”์ธ CORS ์ถ”๊ฐ€
uni-j-uni Dec 15, 2025
284bc71
:wrench:Settings: ํ”„๋ก ํŠธ ๋ฐฐํฌ ๋„๋ฉ”์ธ CORS ์ถ”๊ฐ€
uni-j-uni Dec 15, 2025
7f8dd33
:wrench:Settings: ํ”„๋ก ํŠธ ๋ฐฐํฌ ๋„๋ฉ”์ธ CORS ์ถ”๊ฐ€
uni-j-uni Dec 15, 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
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ ResponseEntity<BaseResponse<InfiniteResponse<PostDetailResponse>>> getPostByCate
type = "string",
allowableValues = {"FREE", "REPAIR", "INFO"},
example = "FREE"))
@RequestParam
@RequestParam(required = false)
String category,
@Parameter(description = "๋งˆ์ง€๋ง‰์œผ๋กœ ์กฐํšŒํ•œ ๊ฒŒ์‹œ๊ธ€ ์‹๋ณ„์ž(์ฒซ ์กฐํšŒ ์‹œ ์ƒ๋žต)", example = "3")
@Parameter(description = "๋งˆ์ง€๋ง‰์œผ๋กœ ์กฐํšŒํ•œ ๊ฒŒ์‹œ๊ธ€ ์‹๋ณ„์ž(์ฒซ ์กฐํšŒ ์‹œ ์ƒ๋žต, ์ตœ์‹ ์ˆœ์ด๋ผ์„œ ์‹๋ณ„์ž ๊ฐ’ ๊ฐ์†Œ)", example = "3")
@RequestParam(required = false)
Long lastPostId,
@Parameter(description = "ํ•œ ๋ฒˆ์— ์กฐํšŒํ•  ๊ฒŒ์‹œ๊ธ€ ๊ฐœ์ˆ˜", example = "3") @RequestParam(defaultValue = "3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ public interface PostRepository extends JpaRepository<Post, Long> {

Page<Post> findByPostCategory(PostCategory category, Pageable pageable);

Page<Post> findByPostCategoryContainingAndIdLessThan(
String category, Long lastPostId, Pageable pageable);

Page<Post> findAllByUser_Id(Long userId, Pageable pageable);

Page<Post> findAllByUser_IdAndIdLessThan(Long userId, Long lastPostId, Pageable pageable);
Page<Post> findByIdLessThan(Long id, Pageable pageable);

Page<Post> findByPostCategoryAndIdLessThan(PostCategory category, Long id, Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,28 @@ public InfiniteResponse<PostDetailResponse> getPostsByCategory(
Pageable pageable = PageRequest.of(0, size + 1, Sort.by(Sort.Direction.DESC, "id"));
List<Post> posts;

PostCategory postCategory;
try {
postCategory = PostCategory.valueOf(category);
} catch (IllegalArgumentException e) {
throw new CustomException(PostErrorCode.INVALID_CATEGORY);
}

if (lastPostId == null) {
posts = postRepository.findByPostCategory(postCategory, pageable).getContent();
if (category == null || category.isBlank()) {
if (lastPostId == null) {
posts = postRepository.findAll(pageable).getContent();
} else {
posts = postRepository.findByIdLessThan(lastPostId, pageable).getContent();
}
} else {
posts =
postRepository
.findByPostCategoryContainingAndIdLessThan(category, lastPostId, pageable)
.getContent();
PostCategory postCategory;
try {
postCategory = PostCategory.valueOf(category);
} catch (IllegalArgumentException e) {
throw new CustomException(PostErrorCode.INVALID_CATEGORY);
}

if (lastPostId == null) {
posts = postRepository.findByPostCategory(postCategory, pageable).getContent();
} else {
posts =
postRepository
.findByPostCategoryAndIdLessThan(postCategory, lastPostId, pageable)
.getContent();
}
}
Comment on lines +158 to 180
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue | ๐Ÿ”ด Critical

๐Ÿงฉ Analysis chain

๐Ÿ Script executed:

#!/bin/bash
# Find PostService test files
fd "PostService.*Test\.java$|PostService.*Spec\.java$" --type f

# Also search more broadly for test files
fd ".*Test\.java$" --type f | grep -i post | head -20

Repository: refit-lab/refit-be

Length of output: 44


๐Ÿ Script executed:

# Search for getPostsByCategory tests
rg -n "getPostsByCategory|getPostByCategory" --type java -g "*Test.java" -A 5 -B 2

Repository: refit-lab/refit-be

Length of output: 210


๐Ÿ Script executed:

# Let's also check the structure of the src directory
git ls-files | grep -E "src/(test|main)" | head -30

Repository: refit-lab/refit-be

Length of output: 2189


๐Ÿ Script executed:

#!/bin/bash
# Search for all Test.java files without filters
find . -name "*Test.java" -o -name "*Spec.java" 2>/dev/null | head -50

Repository: refit-lab/refit-be

Length of output: 44


๐Ÿ Script executed:

# Check if test directory exists
ls -la | grep -i test
find . -maxdepth 2 -type d -name "*test*" 2>/dev/null

Repository: refit-lab/refit-be

Length of output: 72


๐Ÿ Script executed:

# Get a complete picture of repository structure
git ls-files | cut -d'/' -f1,2 | sort | uniq -c | head -20

Repository: refit-lab/refit-be

Length of output: 500


๐Ÿ Script executed:

# Search for PostService in any Java file to understand the codebase better
rg -n "class PostService" --type java

Repository: refit-lab/refit-be

Length of output: 187


๐Ÿ Script executed:

#!/bin/bash
# List all files in src/test directory
find src/test -type f 2>/dev/null | head -50

Repository: refit-lab/refit-be

Length of output: 116


๐Ÿ Script executed:

# List directory structure of src/test
ls -la src/test 2>/dev/null
find src/test -type d 2>/dev/null

Repository: refit-lab/refit-be

Length of output: 311


๐Ÿ Script executed:

# Search for any Java files in src/test
git ls-files | grep "src/test"

Repository: refit-lab/refit-be

Length of output: 116


๐Ÿ Script executed:

# Search for PostService references in entire codebase including test
rg -l "PostService" --type java | head -20

Repository: refit-lab/refit-be

Length of output: 270


๐Ÿ Script executed:

#!/bin/bash
# Check the only test file to see if it tests PostService
cat src/test/java/com/sku/refit/RefitApplicationTests.java

Repository: refit-lab/refit-be

Length of output: 302


๐Ÿ Script executed:

# Check the PostService interface to see the actual method name
rg -n "getPostsByCategory|getPostByCategory|getPost" src/main/java/com/sku/refit/domain/post/service/PostService.java -A 3

Repository: refit-lab/refit-be

Length of output: 276


๐Ÿ Script executed:

# Check the full PostServiceImpl around the reviewed lines
sed -n '140,190p' src/main/java/com/sku/refit/domain/post/service/PostServiceImpl.java | cat -n

Repository: refit-lab/refit-be

Length of output: 2042


getPostsByCategory ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ž‘์„ฑ ํ•„์š”

์นดํ…Œ๊ณ ๋ฆฌ ํ•„ํ„ฐ๋ง ๋กœ์ง ๋ฆฌํŒฉํ† ๋ง์œผ๋กœ ํƒ€์ž… ์•ˆ์ „์„ฑ์ด ๊ฐœ์„ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ ํ˜„์žฌ ์ด ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ปค๋ฒ„๋ฆฌ์ง€๊ฐ€ ์ „ํ˜€ ์—†์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ๋ชจ๋“  ์‹คํ–‰ ๊ฒฝ๋กœ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:

  • category๊ฐ€ null/blank์ด๊ณ  lastPostId๊ฐ€ null์ธ ๊ฒฝ์šฐ
  • category๊ฐ€ null/blank์ด๊ณ  lastPostId๊ฐ€ ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ
  • ์œ ํšจํ•œ category์ด๊ณ  lastPostId๊ฐ€ null์ธ ๊ฒฝ์šฐ
  • ์œ ํšจํ•œ category์ด๊ณ  lastPostId๊ฐ€ ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ
  • ์ž˜๋ชป๋œ category ํ˜•์‹์œผ๋กœ CustomException(PostErrorCode.INVALID_CATEGORY) ๋ฐœ์ƒํ•˜๋Š” ๊ฒฝ์šฐ
๐Ÿค– Prompt for AI Agents
In src/main/java/com/sku/refit/domain/post/service/PostServiceImpl.java around
lines 158 to 180, there are five untested execution paths in getPostsByCategory;
add unit tests that cover: (1) category null/blank with lastPostId null, (2)
category null/blank with lastPostId present, (3) valid category with lastPostId
null, (4) valid category with lastPostId present, and (5) invalid category
string that throws CustomException(PostErrorCode.INVALID_CATEGORY). Implement
tests using your projectโ€™s test framework (JUnit) and mocking (Mockito) to stub
postRepository responses (return Page or List as expected) and verify the
service returns the repository results and/or throws the expected exception;
assert repository method selection (verify correct repository method called for
each scenario) and validate returned content or the thrown CustomException with
the correct error code.


boolean hasNext = posts.size() > size;
Expand Down Expand Up @@ -204,7 +212,7 @@ public InfiniteResponse<PostDetailResponse> getPostsByCategory(
user))
.toList();

Long newLastCursor = posts.isEmpty() ? null : posts.getLast().getId();
Long newLastCursor = posts.isEmpty() ? null : posts.get(posts.size() - 1).getId();

log.info(
"[POST CATEGORY LIST] category={}, lastPostId={}, size={}", category, lastPostId, size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ public void onAuthenticationSuccess(
log.info("์นด์นด์˜ค ๋กœ๊ทธ์ธ ์„ฑ๊ณต: {}", user.getUsername());

response.addHeader("Authorization", "Bearer " + tokenResponse.getAccessToken());
response.sendRedirect("http://localhost:3000");
response.sendRedirect("https://refit-lab.vercel.app");
}
}
2 changes: 1 addition & 1 deletion src/main/resources