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

Null 295 api docs refactor and pagination #28

Merged
merged 38 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ca0217d
refactor: controllerλ³€κ²½
BaeJinho4028 Sep 2, 2024
086007c
refactor: api doc λ³€κ²½
BaeJinho4028 Sep 2, 2024
04c685c
feat: dto 생성 및 μˆ˜μ •
BaeJinho4028 Sep 2, 2024
2afd126
chore: 디렉토리λͺ… λ³€κ²½
BaeJinho4028 Sep 2, 2024
c4b5a3b
refactor: μ„œλΉ„μŠ€ μ½”λ“œ μˆ˜μ •1
BaeJinho4028 Sep 3, 2024
d0dce05
chore: model 생성 및 μˆ˜μ •
BaeJinho4028 Sep 3, 2024
c5452cb
chore: inner dto μˆ˜μ •
BaeJinho4028 Sep 3, 2024
dee6ac8
refactor: λ©”λͺ¨ μΆ”κ°€, νƒœκ·Έ μΆ”κ°€ λ¦¬νŒ©ν„°λ§
BaeJinho4028 Sep 4, 2024
ab9f272
refactor: 단일/볡수 λ©”λͺ¨ μΆ”κ°€ 및 λ¦¬νŒ©ν„°λ§
BaeJinho4028 Sep 4, 2024
f2ae9bd
chore: tagμΆ”κ°€ 차단
BaeJinho4028 Sep 4, 2024
4f17236
chore: AI λͺ…μΉ­ λ³€κ²½
BaeJinho4028 Sep 4, 2024
819e592
chore: 였λ₯˜ μˆ˜μ •
BaeJinho4028 Sep 4, 2024
0eaac1a
refactor: λ©”λͺ¨ 검색, μ—…λ°μ΄νŠΈ μˆ˜μ •
BaeJinho4028 Sep 4, 2024
5d6e81b
chore: 였λ₯˜ ν•΄κ²°
BaeJinho4028 Sep 4, 2024
15a6f18
chore: ai μ„œλ²„ 였λ₯˜ ν•΄κ²°
BaeJinho4028 Sep 4, 2024
3100e53
refactor: ai μ—”λ“œν¬μΈνŠΈ λ³€κ²½ 반영
BaeJinho4028 Sep 5, 2024
70da3df
chore: λ©”λͺ¨μ— νƒœκ·Έ μΆ”κ°€ κΈ°λŠ₯ μ‚­μ œ
BaeJinho4028 Sep 5, 2024
92a3566
chore: λ©”λͺ¨μ— μ—°κ²°λœ νƒœκ·Έ μ°ΎλŠ” λ©”μ†Œλ“œ μΆ”κ°€
BaeJinho4028 Sep 5, 2024
ed8e771
chore: μ€„λ„˜κΉ€ 제거
BaeJinho4028 Sep 5, 2024
82c0c4a
chore: 폴더λͺ… λ³€κ²½
BaeJinho4028 Sep 5, 2024
560ac63
feat: νŽ˜μ΄μ§€λ„€μ΄μ…˜ κ΅¬ν˜„
BaeJinho4028 Sep 5, 2024
2a79899
fix: 루트 νƒœκ·Έ api제거
BaeJinho4028 Sep 5, 2024
4015af4
chore: μ‚¬μš©μ•ˆν•˜λŠ” importλ¬Έ, class μ‚­μ œ
BaeJinho4028 Sep 5, 2024
f4369a1
fix: ai api μˆ˜μ •
BaeJinho4028 Sep 5, 2024
85a957f
chore: μž„μ‹œ μœ μ € 아이디 μΆ”κ°€
BaeJinho4028 Sep 5, 2024
442fb87
feat: νšŒμ›κ°€μž…μ‹œ λ£¨νŠΈνƒœκ·Έ 생성 κΈ°λŠ₯ μΆ”κ°€
BaeJinho4028 Sep 6, 2024
6e208f8
refactor: idλ₯Ό UUIDν˜•μ‹μœΌλ‘œ λ³€κ²½
BaeJinho4028 Sep 6, 2024
d962d4f
refactor: builderν˜•μ‹ λŒ€μ‹  μƒμ„±μž μ‚¬μš©
BaeJinho4028 Sep 6, 2024
aa080b9
chore: UUID λ³€κ²½ 전체 적용
BaeJinho4028 Sep 6, 2024
1e51d11
chore: ai code review ν™˜κ²½κ°’ μˆ˜μ •
BaeJinho4028 Sep 6, 2024
a8356f3
fix: ν”Όλ“œλ°± 반영1
BaeJinho4028 Sep 6, 2024
e458072
fix: λ©”λͺ¨ μΆ”κ°€ 였λ₯˜ μˆ˜μ •
BaeJinho4028 Sep 7, 2024
3aa797c
Origin/null 311 divide user db (#29)
BaeJinho4028 Sep 9, 2024
fd0b930
fix: λ©”λͺ¨ μΆ”κ°€ 였λ₯˜ μˆ˜μ •
BaeJinho4028 Sep 9, 2024
049eff7
refactor: api doc μˆ˜μ •
BaeJinho4028 Sep 10, 2024
85e4494
chore: 클래슀λͺ… λ³€κ²½
BaeJinho4028 Sep 11, 2024
a220d08
chore: user api μˆ˜μ •
BaeJinho4028 Sep 11, 2024
9ce7b9b
fix: 였λ₯˜ ν•΄κ²°
BaeJinho4028 Sep 11, 2024
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
13 changes: 11 additions & 2 deletions .github/workflows/code_review_from_chatgpt.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Code Review From ChatGPT

permissions:
contents: read
pull-requests: write

on:
pull_request:
types: [opened, synchronize]
types: [ reopened ]

jobs:
code-review:
runs-on: ubuntu-latest
Expand All @@ -14,4 +17,10 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGUAGE: Korean
MODEL: gpt-4o
MODEL: gpt-4o-mini
top_p: 1
temperature: 1
PROMPT: |
Please focus only on critical errors and major issues in the code review. Provide a single, concise response that highlights the most significant problems. Avoid giving extensive feedback on minor or stylistic issues. Summarize your comments and prioritize the most impactful suggestions for improvement.
max_tokens: 5000
MAX_PATCH_LENGTH: 3000
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.springframework.data.mongodb.config.EnableMongoAuditing;

@Configuration
@EnableMongoAuditing
public class MongoConfig {

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;

import com.example.oatnote.memo.service.client.exception.AiResponseErrorHandler;
import com.example.oatnote.memoTag.service.client.exception.AIResponseErrorHandler;
import com.fasterxml.jackson.databind.ObjectMapper;

import lombok.RequiredArgsConstructor;
Expand All @@ -20,7 +20,7 @@ public class RestTemplateConfig {
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(0, new MappingJackson2HttpMessageConverter(objectMapper));
restTemplate.setErrorHandler(new AiResponseErrorHandler());
restTemplate.setErrorHandler(new AIResponseErrorHandler());
return restTemplate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
http
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/memos/{memoId}/tags").authenticated() //TODO 경둜 μˆ˜μ •
.requestMatchers("/**").permitAll()
.requestMatchers("/user/login", "/user/register", "/user/refresh").permitAll()
.requestMatchers("/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**").permitAll()
.anyRequest().authenticated()
)
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.example.oatnote.event.listener;

import java.util.ArrayList;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import com.example.oatnote.event.model.UserRegisteredEvent;
import com.example.oatnote.memoTag.service.tag.TagService;
import com.example.oatnote.memoTag.service.tag.model.Tag;

import lombok.RequiredArgsConstructor;

@Component
@RequiredArgsConstructor
public class CreateRootTagListener {

private final TagService tagService;

@EventListener
public void handleUserRegisteredEvent(UserRegisteredEvent event) {
createDummyTagsForNewUser(event.userId());
}

private void createDummyTagsForNewUser(String userId) {
Tag rootTag = new Tag(
userId,
"@",
userId,

Choose a reason for hiding this comment

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

κ²°κ΅­ 이 λ°©μ‹μœΌλ£¨ κ°€μ…¨κ΅¬λ§Œ

new ArrayList<>()
);
tagService.saveTag(rootTag);
}
}
Copy link

Choose a reason for hiding this comment

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

μ½”λ“œ νŒ¨μΉ˜μ— λŒ€ν•œ κ°„λ‹¨ν•œ λ¦¬λ·°μž…λ‹ˆλ‹€.

버그 리슀크

  1. userId μœ νš¨μ„± 검사 λΆ€μ‘±: userIdκ°€ nullμ΄λ‚˜ μœ νš¨ν•˜μ§€ μ•Šμ€ κ²½μš°μ— λŒ€ν•œ 검사가 μ—†μŠ΅λ‹ˆλ‹€. μœ νš¨μ„±μ„ μ²΄ν¬ν•˜λŠ” 둜직이 ν•„μš”ν•©λ‹ˆλ‹€.
  2. 쀑볡 νƒœκ·Έ 생성 κ°€λŠ₯μ„±: λ™μΌν•œ userIdλ₯Ό 가진 μ—¬λŸ¬ μ‚¬μš©μžμ—κ²Œ μ€‘λ³΅λœ νƒœκ·Έκ°€ 생성될 수 μžˆμŠ΅λ‹ˆλ‹€. 이럴 경우, DBμ—μ„œ μ œμ•½ 쑰건을 μ„€μ •ν•˜κ±°λ‚˜ νƒœκ·Έ 쑴재 μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 둜직이 ν•„μš”ν•©λ‹ˆλ‹€.

κ°œμ„  μ œμ•ˆ

  1. μ—λŸ¬ 핸듀링 μΆ”κ°€: tagService.saveTag(rootTag) 호좜 ν›„ λ°œμƒν•  수 μžˆλŠ” μ˜ˆμ™Έλ₯Ό μ²˜λ¦¬ν•˜μ—¬ μ•ˆμ •μ„±μ„ λ†’μ΄λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.
  2. λ‘œκΉ… μΆ”κ°€: 이벀트 ν•Έλ“€λŸ¬μ—μ„œ μ–΄λ–€ μž‘μ—…μ΄ μˆ˜ν–‰λ˜μ—ˆλŠ”μ§€ κΈ°λ‘ν•˜κΈ° μœ„ν•œ λ‘œκΉ…μ„ μΆ”κ°€ν•˜λ©΄ 디버깅 및 λͺ¨λ‹ˆν„°λ§μ— 도움이 λ©λ‹ˆλ‹€.
  3. νƒœκ·Έ μ΄ˆκΈ°ν™” 방식 κ°œμ„ : νƒœκ·Έμ˜ μ΄λ¦„μ΄λ‚˜ 속성을 ν•˜λ“œμ½”λ”©ν•˜λŠ” λŒ€μ‹ , μƒμˆ˜λ‚˜ μ„€μ • νŒŒμΌμ—μ„œ κ΄€λ¦¬ν•˜λŠ” 것이 μœ μ§€λ³΄μˆ˜μ— μš©μ΄ν•©λ‹ˆλ‹€.

μ „λ°˜μ μœΌλ‘œ μ½”λ“œ κ΅¬μ‘°λŠ” 잘 λ˜μ–΄ μžˆμ§€λ§Œ, μœ„ 사항듀을 κ³ λ €ν•˜μ—¬ 좔가적인 μ•ˆμ •μ„±κ³Ό 가독성을 κ°œμ„ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.oatnote.event.model;

public record UserRegisteredEvent(
String userId
) {

}
Copy link

Choose a reason for hiding this comment

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

이 μ½”λ“œ νŒ¨μΉ˜λŠ” UserRegisteredEventλΌλŠ” λ ˆμ½”λ“œ 클래슀λ₯Ό μ •μ˜ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. κ°„λ‹¨ν•œ μ½”λ“œμ—¬μ„œ 큰 λ¬Έμ œλŠ” μ—†μ§€λ§Œ λͺ‡ 가지 κ°œμ„  사항과 버그 μœ„ν—˜ μš”μ†Œλ₯Ό μ œμ•ˆν•©λ‹ˆλ‹€.

  1. μž…λ ₯ 검증 (Input Validation): userIdκ°€ nullμ΄κ±°λ‚˜ 빈 λ¬Έμžμ—΄μΌ 경우λ₯Ό λŒ€λΉ„ν•˜μ—¬ μž…λ ₯ 검증 λ‘œμ§μ„ μΆ”κ°€ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. μ΄λŠ” 객체 생성 μ‹œ μ˜ˆμ™Έλ₯Ό λ°œμƒμ‹œμΌœ 잘λͺ»λœ μƒνƒœλ₯Ό 방지할 수 μžˆμŠ΅λ‹ˆλ‹€.

  2. Javadoc μΆ”κ°€: ν΄λž˜μŠ€μ™€ ν•„λ“œμ— λŒ€ν•œ μ„€λͺ…을 Javadoc으둜 μΆ”κ°€ν•˜λ©΄, μ½”λ“œμ˜ 가독성이 높아지고 λ‹€λ₯Έ κ°œλ°œμžκ°€ μ΄ν•΄ν•˜κΈ° μ‰¬μ›Œμ§‘λ‹ˆλ‹€.

  3. Immutable νŠΉμ„± ν™œμš©: λ ˆμ½”λ“œλŠ” 기본적으둜 λΆˆλ³€(immutable) νŠΉμ„±μ„ κ°€μ§€λ―€λ‘œ, 이λ₯Ό ν™œμš©ν•΄ ν•„μš”ν•œ 경우 μˆ˜μ • κ°€λŠ₯ν•œ ID 체크 쑰건 등을 μΆ”κ°€ν•˜λŠ” 것도 쒋은 λ°©λ²•μž…λ‹ˆλ‹€.

  4. νŒ¨ν‚€μ§€ λͺ…λͺ… κ·œμΉ™: com.example.oatnote.event.model νŒ¨ν‚€μ§€ 이름이 λͺ…ν™•ν•˜κΈ΄ ν•˜μ§€λ§Œ, μ‹€μ œ 이벀트 κ΄€λ ¨ ν΄λž˜μŠ€λŠ” 일반적으둜 domain λ˜λŠ” event ν•˜μœ„ νŒ¨ν‚€μ§€μ— μœ„μΉ˜ν•˜κΈ°λ„ ν•˜λ―€λ‘œ μ‘°μ •ν•  여지가 μžˆμŠ΅λ‹ˆλ‹€.

μ „μ²΄μ μœΌλ‘œ 이 μ½”λ“œλŠ” κ°„λ‹¨ν•˜μ§€λ§Œ, μœ„μ™€ 같은 κ°œμ„  사항을 μΆ”κ°€ν•œλ‹€λ©΄ λ”μš± μ•ˆμ •μ μ΄κ³  μœ μ§€λ³΄μˆ˜ν•˜κΈ° μ‰¬μš΄ μ½”λ“œκ°€ 될 κ²ƒμž…λ‹ˆλ‹€.

138 changes: 0 additions & 138 deletions src/main/java/com/example/oatnote/memo/MemoTagController.java

This file was deleted.

Loading
Loading