Skip to content

Commit 874c580

Browse files
committed
chore: 공휴일 API 관련 주석 추가
1 parent 6bb8a2e commit 874c580

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

app/src/main/java/com/eatssu/android/data/remote/dto/response/PublicHolidayApiResponse.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ data class PublicHolidayApiResponse(
4040
)
4141

4242
@OptIn(ExperimentalSerializationApi::class)
43+
/**
44+
* 공휴일 API는 item이 1개일 때는 Object, 여러 개일 때는 Array로 내려주는 케이스가 있어
45+
* 역직렬화 시 항상 List 형태로 정규화한다.
46+
*/
4347
object PublicHolidayItemListSerializer : JsonTransformingSerializer<List<Item>>(
4448
ListSerializer(Item.serializer())
4549
) {

app/src/main/java/com/eatssu/android/data/remote/repository/PublicHolidayRepositoryImpl.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ class PublicHolidayRepositoryImpl @Inject constructor(
2323
const val PUBLIC_HOLIDAY_SERVICE_KEY_NAME: String = "PublicHolidayServiceKey"
2424
}
2525

26+
/**
27+
* 외부 공휴일 API를 호출해 해당 [YearMonth]의 공휴일 목록을 조회한다.
28+
*
29+
*
30+
* - `HOLIDAY_API_KEY`가 비어있으면 네트워크 호출 없이 빈 리스트를 반환한다.
31+
* - 네트워크/파싱 실패 또는 비정상 resultCode인 경우 빈 리스트를 반환한다.
32+
* - `isHoliday == "Y"`만 필터링하고, 날짜 기준으로 중복 제거 후 오름차순 정렬한다.
33+
*/
2634
override suspend fun getHolidays(yearMonth: YearMonth): List<PublicHoliday> {
2735
if (serviceKey.isBlank()) {
2836
Timber.w("HOLIDAY_API_KEY is blank; skipping public holiday fetch")

app/src/main/java/com/eatssu/android/data/remote/service/PublicHolidayService.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ import retrofit2.http.Query
66

77
interface PublicHolidayService {
88

9+
/**
10+
* data.go.kr 공휴일(OpenAPI) 호출용 API.
11+
*
12+
* - 엔드포인트: SpcdeInfoService/getRestDeInfo
13+
* - ServiceKey는 이미 URL 인코딩된 값으로 전달한다(`encoded = true`).
14+
* - solYear/solMonth는 양력 기준 연/월이다.
15+
* - `_type=json`으로 JSON 응답을 받는다.
16+
*/
17+
918
@GET("B090041/openapi/service/SpcdeInfoService/getRestDeInfo")
1019
suspend fun getRestDeInfo(
1120
@Query(value = "ServiceKey", encoded = true) serviceKey: String,

app/src/main/java/com/eatssu/android/di/PublicHolidayModule.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@ import javax.inject.Singleton
1818

1919
@Qualifier
2020
@Retention(AnnotationRetention.BINARY)
21+
/** 공휴일 API 전용 Retrofit 구분자. */
2122
annotation class PublicHolidayApi
2223

24+
/**
25+
* 공휴일 API 전용 Retrofit/Service 제공 모듈.
26+
*
27+
* - 인증 토큰이 필요 없는 외부 API이므로 `@NoToken` OkHttpClient를 사용한다.
28+
* - 키는 `BuildConfig.HOLIDAY_API_KEY`로 주입되며, 비어있을 수 있다(로컬 환경 등).
29+
*/
2330
@Module
2431
@InstallIn(SingletonComponent::class)
2532
object PublicHolidayModule {

0 commit comments

Comments
 (0)