-   Notifications  You must be signed in to change notification settings 
- Fork 0
[25.06.19 / TASK-208] Feature - cookie and usermodel update #35
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
Conversation
| """ Walkthroughμ΄ λ³κ²½μ¬νμ μ¬μ©μ 컨νΈλ‘€λ¬μ κ΄λ ¨ μλΉμ€, λ ν¬μ§ν 리, DTOμ λν΄ usernameκ³Ό thumbnail νλλ₯Ό μΆκ° λ° νμ₯νλ©°, μΏ ν€ μ΅μ  μ²λ¦¬ λ°©μμ κ°μ ν©λλ€. λν UserControllerμ μ£Όμ λ©μλμ λν ν¬κ΄μ μΈ λ¨μ ν μ€νΈκ° μλ‘κ² μμ±λμμ΅λλ€. Changes
 Sequence Diagram(s)sequenceDiagram participant Client participant UserController participant UserService participant UserRepository participant VelogAPI Client->>UserController: login μμ² (access/refresh token) UserController->>VelogAPI: μ¬μ©μ μ λ³΄ μμ² VelogAPI-->>UserController: μ¬μ©μ μ λ³΄ (username, thumbnail λ±) UserController->>UserService: handleUserTokensByVelogUUID(userData, tokens) UserService->>UserRepository: createUser/updateTokens(uuid, email, username, thumbnail, tokens) UserRepository-->>UserService: User κ°μ²΄ λ°ν UserService-->>UserController: User κ°μ²΄ λ°ν UserController-->>Client: μΏ ν€ μ€μ  λ° μ¬μ©μ μ λ³΄ μλ΅ Possibly related PRs
 Suggested reviewers
 Poem
 π Recent review detailsConfiguration used: CodeRabbit UI π Files selected for processing (2)
 β Files skipped from review due to trivial changes (1)
 π§ Files skipped from review as they are similar to previous changes (1)
 β° Context from checks skipped due to timeout of 90000ms (4)
 β¨ Finishing Touches
 π§ͺ Generate Unit Tests
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit: 
 SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
 Other keywords and placeholders
 CodeRabbit Configuration File ( | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π Outside diff range comments (1)
src/services/user.service.ts (1)
65-73: μ κ· μ μ  μμ± μ νλ¬Έ ν ν°μ΄ DBμ μ μ μ μ₯λ¨
createUserβ νλ¬Έ ν ν° μ μ₯- κ³§λ°λ‘
updateUserTokensλ‘ μνΈν ν ν° μ¬μ μ₯λ λ²μ DB λΌμ΄λνΈλ¦½κ³Ό νλ¬Έ μ μ₯ λ ΈμΆμ΄ λ°μν©λλ€.
μνΈν ν ν λ²μ INSERT λ‘ μ²λ¦¬νλ©΄ 보μΒ·μ±λ₯ μμͺ½μμ μ΄λμ λλ€. νμνλ€λ©΄
encryptTokensνΈμΆμ λΆλ¦¬ν΄createUserμ΄μ μ μννλ κ΅¬μ‘°λ‘ λ¦¬ν©ν°λ§μ μ μλ립λλ€.
π§Ή Nitpick comments (6)
src/types/dto/userWithToken.type.ts (1)
16-18:thumbnailνλμ λ¬Έμμ΄ κ²μ¦μ΄ λλ½λ¨
thumbnailμμ λ¬Έμμ΄ μ λ ₯μ΄ μμλ©λλ€.@IsString()λ°μ½λ μ΄ν°λ₯Ό μΆκ°ν΄ μΌκ΄λ κ²μ¦μ μ μ§ν΄ μ£ΌμΈμ.@IsOptional() + @IsString() thumbnail: string | null = null;src/controllers/user.controller.ts (1)
24-37:clearCookieμ λ§λ£ κ° μ€μ  κ³ λ €μΌλΆ λΈλΌμ°μ λ
maxAgeκ° μλλΌλ μΏ ν€λ₯Ό μμ ν μ κ±°νμ§ μμ μ μμ΅λλ€.
isClearμΌ λexpires: new Date(0)λ₯Ό μΆκ°νλ©΄ νΈνμ±μ΄ ν₯μλ©λλ€.src/services/user.service.ts (1)
59-61:thumbnailλ λ³ν© λ€ μΈλ―Έμ½λ‘ λλ½μ½λμ λ¬Έμ λ μμ§λ§ ESLint κ·μΉ(semicolons)μ μ¬μ©νλ€λ©΄ κ²½κ³ κ° λ°μν μ μμ΅λλ€. ν μ€ μ£Όμ λ€ μΈλ―Έμ½λ‘ μ μΆκ°ν΄ λλ νΈμ΄ κΉλν©λλ€.
src/repositories/user.repository.ts (1)
45-54:SETμ μ 컬λΌμ΄ μΆκ°λ λ§νΌ DB μΈλ±μ€ κ²ν
usernameμΌλ‘ μ‘°ννλ κΈ°λ₯μ΄ μ΄λ―Έ μκ±°λ ν₯ν μκΈΈ κ²½μ° λ³΅ν© μΈλ±μ€λ₯Ό κ³ λ €ν΄ μ£ΌμΈμ.
μ§κΈ λ¨κ³μμ μ½λ μ€λ₯λ μμΌλ―λ‘ μ°Έκ³ λ§ νμλ©΄ λ©λλ€.src/controllers/__test__/user.controller.test.ts (2)
11-14: μλ λͺ¨νΉλ ν΄λμ€ μΈμ€ν΄μ€ μ¬μ© μ£Όμ
jest.mock('@/services/user.service')λ‘ μλ λͺ¨νΉνλ©΄ μμ±μΒ·λ©μλκ° μλμΌλ‘jest.fn()μΌλ‘ λ체λ©λλ€. νμ¬μ²λΌ μ€μ  μΈμ€ν΄μ€λ₯Όnewλ‘ λ§λ€λ©΄ νμ μ λ§μ§λ§ λ΄λΆ ꡬνμ΄ μμΌλ―λ‘ μκΈ°μΉ μμ νΈμΆ λλ½μ΄ λ°μν μ μμ΅λλ€.λͺ μμ  ν©ν λ¦¬λ‘ νμν λ©μλλ§ mock ꡬνμ 리ν΄νκ±°λ,
jest.mocked(UserService.prototype)μ μ¬μ©ν΄spyOnλ°©μμΌλ‘ λΆλΆ λͺ¨νΉνλ ꡬ쑰λ₯Ό κ³ λ €ν΄ μ£ΌμΈμ.
56-63: νκ²½ λ³μ 볡μ λλ½ν μ€νΈλ§λ€
process.env.NODE_ENVκ°μ λ³κ²½νμ§λ§afterEachμμ μλ κ°μ 볡μνμ§ μμ΅λλ€.
λ€λ₯Έ ν μ€νΈ νμΌμ μν₯μ΄ κ° μ μμΌλ μ΄μ  κ°μ μ μ₯νλ€κ° λ³΅κ΅¬ν΄ μ£ΌμΈμ.
π Review details
Configuration used: CodeRabbit UI
 Review profile: CHILL
 Plan: Pro
π Files selected for processing (5)
- src/controllers/__test__/user.controller.test.ts(1 hunks)
- src/controllers/user.controller.ts(5 hunks)
- src/repositories/user.repository.ts(4 hunks)
- src/services/user.service.ts(6 hunks)
- src/types/dto/userWithToken.type.ts(2 hunks)
β° Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: build-and-test (20)
- GitHub Check: build-and-test (23)
- GitHub Check: build-and-test (22)
- GitHub Check: build-and-test (21)
π Additional comments (1)
src/types/dto/userWithToken.type.ts (1)
27-33: μμ±μ μκ·Έλμ² λ³κ²½μ λ°λ₯Έ νΈμΆλΆ νμΈ νμνλΌλ―Έν°κ° λ κ° λμ΄λ¬μ΅λλ€. κΈ°μ‘΄ νΈμΆ μ½λκ° μ»΄νμΌ-νμ μ€λ₯ μμ΄ λΉλλλμ§, λ 리νλ μ  κΈ°λ° μμ±(μ:
plainToInstance)μ μν₯μ΄ μλμ§ μ μ κ²μμΌλ‘ νμΈν΄ μ£ΌμΈμ.
νμνλ€λ©΄ μ€λ²λ‘λλ default κ°μ κ³ λ €ν΄λ μ’μ΅λλ€.
| 
 μ΄μ λΆλΆμ νμ€ν¬ IDλ₯Ό λ¬μΌ νλκ±΄κ° μΆμ΄μ μ΅κ΄μ μΌλ‘ κ³μ λκ³  μμλλ°, λμ§μ΄λ³΄λ©΄ λ€λ₯Έ λΆλ€μ PRμλ κ±°μ XμμΌλ μκ°μ λͺ» νκ³  μμλ κ² κ°λ€μ;; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ½λ μ μ½μμ΅λλ€!
μ’μλ μ 
- jsdocμ΄ μΆκ°λ λΆλΆλ€μ΄ λͺ λΆλΆ μλλ°, νμ€ν μ΄ν΄μ λμμ΄ λμμ΅λλ€.
- undefined λ°©μ΄ λ± μΈμΈνκ² μ€λ₯κ° λ°μν μ μλ λΆλΆλ€μ κ³ λ €ν΄ λμ μ μ΄ λ³΄κΈ° μ’μμ΅λλ€!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ½λ μ μ½μμ΅λλ€. κ³ μνμ ¨μ΅λλ€~!!
μ’μλ μ 
- cookieOption(true)λ‘ maxAge μμ΄ μ€μ νλ€λ μ μ λͺ μν΄μ£Όμ λΆλΆμ΄ μ’μμ΅λλ€!
- email, username, thumbnailμ λν null μ²λ¦¬κ° λͺ νν λμ΄μμ΄μ μ’μμ΅λλ€!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ½λ μ λ΄€μ΅λλ€! κ³ μ λ§μΌμ ¨μ΅λλ€~! π π₯
μ’μλ μ 
- λ€λ₯Έ λΆλ€κ»μλ μ§μ΄μ£Όμ ¨λ€μνΌ μ μ ν μ£Όμκ³Ό λΉ κ° μ²λ¦¬κ° μ’μμ΅λλ€!
- κ°μΈμ μΌλ‘ νμμ μ μμ±νμ§ μμλ 컨νΈλ‘€λ¬ κ³μΈ΅ ν μ€νΈ μ½λλ λ³΄κ² λμ΄μ μ’μμ΅λλ€!! μΈμ¦/μΈκ° μμ μ 컨νΈλ‘€λ¬ κ³μΈ΅λ νμ€ν μ¨ λλκ² μ’μ κ² κ°λ€μ! λͺ¨νΉ, ν μ€νΈ μΌμ΄μ€λ€ λ€ κΌΌκΌΌν μ±κ²¨μ£Όμ λΆλΆλ λ무 μ’μμ΅λλ€.



π₯ λ³κ²½ μ¬ν
π· κ΄λ ¨ μ΄μ
πΈ μ€ν¬λ¦°μ· (UI λ³κ²½ μ νμ)
π 체ν¬λ¦¬μ€νΈ
Summary by CodeRabbit
μ κ· ν μ€νΈ
κΈ°λ₯ κ°μ
λ²κ·Έ μμ