Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Togedy/Togedy_Android into …
Browse files Browse the repository at this point in the history
…feat/#30-univ-schedule
  • Loading branch information
imtaejugkim committed Dec 16, 2024
2 parents 66011b9 + 990702f commit 8502a89
Show file tree
Hide file tree
Showing 74 changed files with 1,984 additions and 533 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.togedy_android.data.mapper.todata.planner

import com.example.togedy_android.data.remote.model.planner.DateRequestDto
import com.example.togedy_android.domain.model.planner.Date

fun Date.toData() : DateRequestDto = DateRequestDto(
date = this.date
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.example.togedy_android.data.mapper.todata.planner

import com.example.togedy_android.data.remote.model.planner.request.StudyGoalRequestDto
import com.example.togedy_android.domain.model.planner.NewStudyGoal

fun NewStudyGoal.toData(): StudyGoalRequestDto = StudyGoalRequestDto(
date = this.date,
targetTime = this.targetTime,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.example.togedy_android.data.mapper.todata.planner

import com.example.togedy_android.data.remote.model.planner.request.StudyPlanRequestDto
import com.example.togedy_android.domain.model.planner.NewStudyPlan

fun NewStudyPlan.toData(): StudyPlanRequestDto = StudyPlanRequestDto(
name = this.name,
date = this.date,
studyTagId = this.studyTagId,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.example.togedy_android.data.mapper.todata.planner

import com.example.togedy_android.data.remote.model.planner.request.StudyTagItemRequestDto
import com.example.togedy_android.domain.model.planner.NewStudyTageItem

fun NewStudyTageItem.toData(): StudyTagItemRequestDto = StudyTagItemRequestDto(
name = this.name,
color = this.color
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.togedy_android.data.mapper.todomain.planner

import com.example.togedy_android.data.remote.model.planner.resposne.StudyGoalIdResponseDto
import com.example.togedy_android.domain.model.planner.StudyGoalId

fun StudyGoalIdResponseDto.toDomain(): StudyGoalId = StudyGoalId(
studyGoalId = this.studyGoalId
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.togedy_android.data.mapper.todomain.planner

import com.example.togedy_android.data.remote.model.planner.resposne.StudyGoalResponseDto
import com.example.togedy_android.domain.model.planner.StudyGoal

fun StudyGoalResponseDto.toDomain(): StudyGoal = StudyGoal(
id = this.id,
targetTime = this.targetTime,
actualTime = this.actualTime,
achievement = this.achievement
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.togedy_android.data.mapper.todomain.planner

import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanIdResponseDto
import com.example.togedy_android.domain.model.planner.StudyPlanId

fun StudyPlanIdResponseDto.toDomain(): StudyPlanId = StudyPlanId(
studyPlanId = this.studyPlanId
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.togedy_android.data.mapper.todomain.planner

import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanResponseDto
import com.example.togedy_android.domain.model.planner.StudyPlanItem

fun List<StudyPlanResponseDto>.toDomain(): List<StudyPlanItem> {
return this.map { studyPlanItem ->
StudyPlanItem(
studyPlanId = studyPlanItem.studyPlanId,
name = studyPlanItem.name,
studyTagColor = studyPlanItem.studyTagColor,
studyTagId = studyPlanItem.studyTagId,
planStatus = studyPlanItem.planStatus,
studyRecords = studyPlanItem.studyRecords
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.example.togedy_android.data.mapper.todomain.planner

import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanStatusResponseDto
import com.example.togedy_android.domain.model.planner.StudyPlanStatus

fun StudyPlanStatusResponseDto.toDomain(): StudyPlanStatus = StudyPlanStatus(
id = this.id,
status = this.status
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.togedy_android.data.mapper.todomain.planner

import com.example.togedy_android.data.remote.model.planner.resposne.StudyTagIdResponseDto
import com.example.togedy_android.domain.model.planner.StudyTagId

fun StudyTagIdResponseDto.toDomain(): StudyTagId= StudyTagId(
studyTagId = this.studyTagId
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.togedy_android.data.mapper.todomain.planner

import com.example.togedy_android.data.remote.model.planner.resposne.StudyTagItemResponseDto
import com.example.togedy_android.domain.model.planner.StudyTagItem

fun List<StudyTagItemResponseDto>.toDomain(): List<StudyTagItem> {
return this.map { studyTagItem ->
StudyTagItem(
id = studyTagItem.id,
name = studyTagItem.name,
color = studyTagItem.color
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.example.togedy_android.data.remote.datasource

import com.example.togedy_android.data.remote.model.base.BaseResponse
import com.example.togedy_android.data.remote.model.planner.DateRequestDto
import com.example.togedy_android.data.remote.model.planner.request.StudyGoalRequestDto
import com.example.togedy_android.data.remote.model.planner.request.StudyPlanRequestDto
import com.example.togedy_android.data.remote.model.planner.request.StudyTagItemRequestDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyGoalIdResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyGoalResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanIdResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanStatusResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyTagIdResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyTagItemResponseDto

interface PlannerRemoteDataSource {
suspend fun getStudyGoal(request: DateRequestDto): BaseResponse<StudyGoalResponseDto>
suspend fun postStudyGoal(request: StudyGoalRequestDto): BaseResponse<StudyGoalIdResponseDto>

suspend fun getStudyTagList(): BaseResponse<List<StudyTagItemResponseDto>>
suspend fun postStudyTag(request: StudyTagItemRequestDto): BaseResponse<StudyTagIdResponseDto>
suspend fun putStudyTag(
tagId: Int,
request: StudyTagItemRequestDto
): BaseResponse<StudyTagIdResponseDto>

suspend fun getStudyPlanList(request: DateRequestDto): BaseResponse<List<StudyPlanResponseDto>>
suspend fun postStudyPlan(request: StudyPlanRequestDto): BaseResponse<StudyPlanIdResponseDto>
suspend fun putStudyPlanStatus(studyPlanId: Int, status: String): BaseResponse<StudyPlanStatusResponseDto>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.example.togedy_android.data.remote.datasourceimpl

import com.example.togedy_android.data.remote.datasource.PlannerRemoteDataSource
import com.example.togedy_android.data.remote.model.base.BaseResponse
import com.example.togedy_android.data.remote.model.planner.DateRequestDto
import com.example.togedy_android.data.remote.model.planner.request.StudyGoalRequestDto
import com.example.togedy_android.data.remote.model.planner.request.StudyPlanRequestDto
import com.example.togedy_android.data.remote.model.planner.request.StudyTagItemRequestDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyGoalIdResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyGoalResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanIdResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyPlanStatusResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyTagIdResponseDto
import com.example.togedy_android.data.remote.model.planner.resposne.StudyTagItemResponseDto
import com.example.togedy_android.data.remote.service.PlannerService
import javax.inject.Inject

class PlannerRemoteDataSourceImpl @Inject constructor(
private val plannerService: PlannerService
) : PlannerRemoteDataSource {
override suspend fun getStudyGoal(request: DateRequestDto): BaseResponse<StudyGoalResponseDto> =
plannerService.getStudyGoal(request)

override suspend fun postStudyGoal(request: StudyGoalRequestDto): BaseResponse<StudyGoalIdResponseDto> =
plannerService.postStudyGoal(request)


override suspend fun getStudyTagList(): BaseResponse<List<StudyTagItemResponseDto>> =
plannerService.getStudyTag()

override suspend fun postStudyTag(request: StudyTagItemRequestDto): BaseResponse<StudyTagIdResponseDto> =
plannerService.postStudyTag(request)

override suspend fun putStudyTag(tagId: Int, request: StudyTagItemRequestDto): BaseResponse<StudyTagIdResponseDto> =
plannerService.putStudyTag(tagId = tagId, request = request)

override suspend fun getStudyPlanList(request: DateRequestDto): BaseResponse<List<StudyPlanResponseDto>> =
plannerService.getStudyPlanList(request)


override suspend fun postStudyPlan(request: StudyPlanRequestDto): BaseResponse<StudyPlanIdResponseDto> =
plannerService.postStudyPlan(request)

override suspend fun putStudyPlanStatus(
studyPlanId: Int,
status: String
): BaseResponse<StudyPlanStatusResponseDto> =
plannerService.putStudyPlanStatus(studyPlanId = studyPlanId, status = status)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.example.togedy_android.data.remote.model.planner

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class DateRequestDto(
@SerialName("date")
val date: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.example.togedy_android.data.remote.model.planner.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyGoalRequestDto(
@SerialName("date")
val date: String,
@SerialName("targetTime")
val targetTime: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.togedy_android.data.remote.model.planner.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyPlanRequestDto(
@SerialName("name")
val name: String,
@SerialName("date")
val date: String,
@SerialName("studyTagId")
val studyTagId: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.example.togedy_android.data.remote.model.planner.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyTagItemRequestDto(
@SerialName("name")
val name: String,
@SerialName("color")
val color: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.example.togedy_android.data.remote.model.planner.resposne

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyGoalIdResponseDto(
@SerialName("studyGoalId")
val studyGoalId: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.togedy_android.data.remote.model.planner.resposne

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyGoalResponseDto(
@SerialName("id")
val id: Int,
@SerialName("targetTime")
val targetTime: String,
@SerialName("actualTime")
val actualTime: String,
@SerialName("achievement")
val achievement: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.example.togedy_android.data.remote.model.planner.resposne

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyPlanIdResponseDto(
@SerialName("studyPlanId")
val studyPlanId: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.example.togedy_android.data.remote.model.planner.resposne

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyPlanResponseDto(
@SerialName("studyPlanId")
val studyPlanId: Int,
@SerialName("name")
val name: String,
@SerialName("studyTagColor")
val studyTagColor: String,
@SerialName("studyTagId")
val studyTagId: Int,
@SerialName("planStatus")
val planStatus: String,
@SerialName("studyRecords")
val studyRecords: List<List<String>>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.example.togedy_android.data.remote.model.planner.resposne

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyPlanStatusResponseDto(
@SerialName("id")
val id: Int,
@SerialName("status")
val status: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.example.togedy_android.data.remote.model.planner.resposne

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyTagIdResponseDto(
@SerialName("studyTagId")
val studyTagId: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.togedy_android.data.remote.model.planner.resposne

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class StudyTagItemResponseDto(
@SerialName("id")
val id: Int,
@SerialName("name")
val name: String,
@SerialName("color")
val color: String,
)
Loading

0 comments on commit 8502a89

Please sign in to comment.