Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
♻️ :: 네이밍 복수형으로 변환
Browse files Browse the repository at this point in the history
  • Loading branch information
chlgkdms committed Nov 14, 2023
1 parent f987320 commit 4b1b9b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 8 additions & 9 deletions data/src/main/kotlin/com/signal/data/api/DiaryApi.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.signal.data.api

import com.signal.data.model.diary.CreateDiaryRequest
import com.signal.data.model.diary.FetchAllDiaryResponse
import com.signal.data.model.diary.FetchDayDiaryResponse
import com.signal.data.model.diary.FetchDiariesResponse
import com.signal.data.model.diary.FetchDiaryDetailsResponse
import com.signal.data.model.diary.FetchMonthDiaryResponse
import com.signal.data.model.diary.FetchMonthDiariesResponse
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
Expand All @@ -17,20 +16,20 @@ interface DiaryApi {
)

@GET(SignalUrl.Diary.FetchAllDiary)
suspend fun fetchAllDiary(): FetchAllDiaryResponse
suspend fun fetchAllDiaries(): FetchDiariesResponse

@GET(SignalUrl.Diary.FetchMonthDiary)
suspend fun fetchMonthDiary(
suspend fun fetchMonthDiaries(
@Query("date") date: String,
): FetchMonthDiaryResponse
): FetchMonthDiariesResponse

@GET(SignalUrl.Diary.CreateDiary)
suspend fun fetchDayDiary(
suspend fun fetchDayDiaries(
@Query("date") date: String,
): FetchDayDiaryResponse
): FetchDiariesResponse

@GET(SignalUrl.Diary.CreateDiary)
suspend fun fetchDiaryDetails(
suspend fun fetchDiariesDetails(
@Query("diary_id") diaryId: Long,
): FetchDiaryDetailsResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.google.gson.annotations.SerializedName
import com.signal.domain.entity.MonthDiaryEntity
import java.time.LocalDateTime

data class FetchMonthDiaryResponse(
data class FetchMonthDiariesResponse(
@SerializedName("month_diary_list") val monthDiaryList: List<Diaries>,
) {
data class Diaries(
Expand All @@ -13,11 +13,11 @@ data class FetchMonthDiaryResponse(
)
}

fun FetchMonthDiaryResponse.toEntity() = MonthDiaryEntity(
fun FetchMonthDiariesResponse.toEntity() = MonthDiaryEntity(
monthDiaryEntity = this.monthDiaryList.map { it.toEntity() },
)

private fun FetchMonthDiaryResponse.Diaries.toEntity() = MonthDiaryEntity.MonthDiaryEntity(
private fun FetchMonthDiariesResponse.Diaries.toEntity() = MonthDiaryEntity.MonthDiaryEntity(
id = this.id,
date = this.date,
)

0 comments on commit 4b1b9b9

Please sign in to comment.