-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] 작곡가 수정 API 추가 #98
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,20 @@ public class Composer extends BaseEntity<Composer> { | |
| @Column(name = "continent") | ||
| private Continent continent; | ||
|
|
||
| public void update(String koreanName, String englishName, String nativeName, Gender gender, | ||
| String nationality, Short birthYear, Short deathYear, String bio, Era era, Continent continent) { | ||
| this.koreanName = koreanName; | ||
| this.englishName = englishName; | ||
| this.nativeName = nativeName; | ||
| this.gender = gender; | ||
| this.nationality = nationality; | ||
| this.birthYear = birthYear; | ||
| this.deathYear = deathYear; | ||
| this.bio = bio; | ||
| this.era = era; | ||
| this.continent = continent; | ||
| } | ||
|
Comment on lines
+50
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
이를 개선하기 위해 파라미터를 객체로 묶는 것을 고려해 보세요. 예를 들어, 예시 (별도 파라미터 객체 사용): // In Composer.java
public void update(ComposerUpdateParam param) {
this.koreanName = param.getKoreanName();
this.englishName = param.getEnglishName();
// ... etc
}이렇게 하면 |
||
|
|
||
| @Builder | ||
| private Composer(@NonNull String koreanName, @NonNull String englishName, | ||
| String nativeName, @NonNull Gender gender, String nationality, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.daramg.server.composer.dto | ||
|
|
||
| import com.daramg.server.composer.domain.Continent | ||
| import com.daramg.server.composer.domain.Era | ||
| import com.daramg.server.composer.domain.Gender | ||
| import jakarta.validation.constraints.NotBlank | ||
| import jakarta.validation.constraints.NotNull | ||
|
|
||
| data class ComposerUpdateDto( | ||
| @get:NotBlank val koreanName: String, | ||
| @get:NotBlank val englishName: String, | ||
| val nativeName: String? = null, | ||
| @get:NotNull val gender: Gender, | ||
| @get:NotBlank val nationality: String, | ||
| @get:NotNull val birthYear: Short, | ||
| @get:NotNull val deathYear: Short, | ||
| @get:NotBlank val bio: String, | ||
| @get:NotNull val era: Era, | ||
| @get:NotNull val continent: Continent, | ||
| ) |
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.
The use of a hardcoded user ID (
5L) for administrative authorization is a significant security vulnerability. This is insecure as any user who happens to be assigned this ID could gain administrative privileges. This pattern is also present in other administrative methods likecreateComposeranddeleteComposer. It is highly recommended to implement a robust role-based access control (RBAC) system by adding arolefield to theUserentity and checking for anADMINrole instead of a specific user ID. Additionally, to improve maintainability and reduce duplication, this authorization logic should be extracted into a separate private method, as it is currently duplicated acrosscreateComposer,updateComposer, anddeleteComposer.