Skip to content

Commit

Permalink
feat: ScheduleApi 구현 #52
Browse files Browse the repository at this point in the history
  • Loading branch information
bamin0422 committed Jun 27, 2024
1 parent 38e9d4f commit b60111d
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/main/java/com/owori/android/core/di/NetworkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.owori.android.data.api.image.ImageApi
import com.owori.android.data.api.keyword.KeywordApi
import com.owori.android.data.api.member.MemberApi
import com.owori.android.data.api.saying.SayingApi
import com.owori.android.data.api.schedule.ScheduleApi
import com.owori.android.module.HttpRequestInterceptor
import dagger.Module
import dagger.Provides
Expand Down Expand Up @@ -93,6 +94,12 @@ object NetworkModule {
return retrofit.buildService()
}

@Provides
@Singleton
fun provideScheduleApi(retrofit: Retrofit): ScheduleApi {
return retrofit.buildService()
}

@Provides
@Singleton
fun provideMemberApi(retrofit: Retrofit): MemberApi {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.owori.android.data.api.schedule

import com.owori.android.data.model.schedule.ScheduleItem
import com.owori.android.data.model.schedule.SchedulePostRequest
import com.owori.android.data.model.schedule.ScheduleResponse
import com.owori.android.module.DataResult
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query

interface ScheduleApi {

// 일정 등록
@POST("/schedule")
fun registerSchedule(@Body data: SchedulePostRequest): DataResult<ScheduleResponse>

// 일정 수정
@POST("/schedule/update")
fun editSchedule(@Body data: ScheduleItem): DataResult<ScheduleResponse>

// 일정 삭제
@DELETE("/schedule/{scheduleId}")
fun deleteSchedule(@Path(value = "scheduleId") id: String): DataResult<Any>

// 일정 월별 조회
@GET("/schedule/month")
fun getMonthlySchedule(@Query("year_month")yearMonth: String): DataResult<List<ScheduleItem>>

// 가족별 디데이 조회
@GET("/schedule/dday")
fun getMonthlyDDay(): DataResult<List<ScheduleItem>>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.owori.android.data.model.schedule

import com.google.gson.annotations.SerializedName

data class SchedulePostRequest(
val title: String,
val content: String,
@SerializedName("start_date")
val startDate: String?,
@SerializedName("end_date")
val endDate: String?,
@SerializedName("schedule_type")
val scheduleType: ScheduleType,
val nickname: String,
val color: String,
@SerializedName("dday_option")
val dDayOption: Boolean,
@SerializedName("alarm_options")
val alarmOptions: List<String>,
@SerializedName("is_mine")
val isMine: Boolean,
)

data class ScheduleItem(
@SerializedName("schedule_id")
val scheduleId: String,
val title: String,
val content: String,
@SerializedName("start_date")
val startDate: String?,
@SerializedName("end_date")
val endDate: String?,
@SerializedName("schedule_type")
val scheduleType: ScheduleType,
val nickname: String,
val color: String,
@SerializedName("dday_option")
val dDayOption: Boolean,
@SerializedName("alarm_options")
val alarmOptions: List<String>,
@SerializedName("is_mine")
val isMine: Boolean,
)

enum class ScheduleType {
FAMILY, INDIVIDUAL
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.owori.android.data.model.schedule

import com.google.gson.annotations.SerializedName

data class ScheduleResponse(
@SerializedName("schedule_id")
val scheduleId: String,
)

0 comments on commit b60111d

Please sign in to comment.