-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 북마크, Recommendation Converter 리팩토링
- Loading branch information
Showing
7 changed files
with
25 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
src/main/java/com/eodya/api/bookmark/util/BookMarkStatusAttributeConverter.java
This file was deleted.
Oops, something went wrong.
15 changes: 10 additions & 5 deletions
15
src/main/java/com/eodya/api/bookmark/util/BookMarkStatusConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
package com.eodya.api.bookmark.util; | ||
|
||
import com.eodya.api.bookmark.domain.BookMarkStatus; | ||
import org.springframework.core.convert.converter.Converter; | ||
import org.springframework.stereotype.Component; | ||
import jakarta.persistence.AttributeConverter; | ||
import jakarta.persistence.Converter; | ||
|
||
@Component | ||
public class BookMarkStatusConverter implements Converter<String, BookMarkStatus> { | ||
@Converter | ||
public class BookMarkStatusConverter implements AttributeConverter<BookMarkStatus, String> { | ||
|
||
@Override | ||
public BookMarkStatus convert(String status) { | ||
public String convertToDatabaseColumn(BookMarkStatus bookMarkStatus) { | ||
return bookMarkStatus.getDescription(); | ||
} | ||
|
||
@Override | ||
public BookMarkStatus convertToEntityAttribute(String status) { | ||
return BookMarkStatus.from(status); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
src/main/java/com/eodya/api/recommendation/util/RecommendationStatusAttributeConverter.java
This file was deleted.
Oops, something went wrong.
14 changes: 9 additions & 5 deletions
14
src/main/java/com/eodya/api/recommendation/util/RecommendationStatusConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
package com.eodya.api.recommendation.util; | ||
|
||
import com.eodya.api.recommendation.domain.RecommendationStatus; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.core.convert.converter.Converter; | ||
import jakarta.persistence.AttributeConverter; | ||
import jakarta.persistence.Converter; | ||
|
||
@Converter | ||
public class RecommendationStatusConverter implements AttributeConverter<RecommendationStatus, String> { | ||
|
||
@Component | ||
public class RecommendationStatusConverter implements Converter<String, RecommendationStatus> { | ||
@Override | ||
public String convertToDatabaseColumn(RecommendationStatus recommendationStatus) { | ||
return recommendationStatus.getDescription(); | ||
} | ||
|
||
@Override | ||
public RecommendationStatus convert(String status) { | ||
public RecommendationStatus convertToEntityAttribute(String status) { | ||
return RecommendationStatus.from(status); | ||
} | ||
} |