-
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.
Merge pull request #106 from SOPT-all/feat-#99-home-api
[Feat/#99] "홈 화면" API를 연결합니다
- Loading branch information
Showing
49 changed files
with
853 additions
and
60 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/sopt/gongbaek/data/local/datasource/LectureTimetableLocalDataSource.kt
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.sopt.gongbaek.data.local.datasource | ||
|
||
interface LectureTimetableLocalDataSource { | ||
fun getTimetable(): Map<String, List<Int>> | ||
fun setTimetable(lectureTimetable: Map<String, List<Int>>) | ||
} |
32 changes: 32 additions & 0 deletions
32
...n/java/com/sopt/gongbaek/data/local/datasourceimpl/LectureTimetableLocalDataSourceImpl.kt
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.sopt.gongbaek.data.local.datasourceimpl | ||
|
||
import android.content.SharedPreferences | ||
import com.sopt.gongbaek.data.local.datasource.LectureTimetableLocalDataSource | ||
import com.sopt.gongbaek.di.qualifier.LectureTimetablePrefs | ||
import kotlinx.serialization.SerializationException | ||
import kotlinx.serialization.encodeToString | ||
import kotlinx.serialization.json.Json | ||
import javax.inject.Inject | ||
|
||
class LectureTimetableLocalDataSourceImpl @Inject constructor( | ||
@LectureTimetablePrefs private val sharedPreferences: SharedPreferences | ||
) : LectureTimetableLocalDataSource { | ||
|
||
override fun setTimetable(lectureTimetable: Map<String, List<Int>>) { | ||
val jsonString = Json.encodeToString(lectureTimetable) | ||
sharedPreferences.edit().putString(KEY, jsonString).apply() | ||
} | ||
|
||
override fun getTimetable(): Map<String, List<Int>> { | ||
val jsonString = sharedPreferences.getString(KEY, null) ?: return emptyMap() | ||
return try { | ||
Json.decodeFromString(jsonString) | ||
} catch (e: SerializationException) { | ||
emptyMap() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val KEY = "lecture_timetable" | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/sopt/gongbaek/data/mapper/todomain/NearestGroupResponseDtoMapper.kt
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.sopt.gongbaek.data.mapper.todomain | ||
|
||
import com.sopt.gongbaek.data.remote.dto.response.NearestGroupResponseDto | ||
import com.sopt.gongbaek.domain.model.NearestGroup | ||
|
||
fun NearestGroupResponseDto.toDomain() = NearestGroup( | ||
groupId = groupId, | ||
category = category, | ||
groupType = groupType, | ||
groupTitle = groupTitle, | ||
weekDay = weekDay ?: "", | ||
weekDate = weekDate ?: "", | ||
currentPeopleCount = currentPeopleCount, | ||
maxPeopleCount = maxPeopleCount, | ||
startTime = startTime, | ||
endTime = endTime, | ||
location = location | ||
) |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/sopt/gongbaek/data/mapper/todomain/RecommendGroupResponseDtoMapper.kt
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.sopt.gongbaek.data.mapper.todomain | ||
|
||
import com.sopt.gongbaek.data.remote.dto.response.RecommendGroupInfoResponseDto | ||
import com.sopt.gongbaek.domain.model.RecommendGroupInfo | ||
|
||
fun RecommendGroupInfoResponseDto.toDomain() = | ||
RecommendGroupInfo( | ||
groupId = groupId, | ||
category = category, | ||
coverImg = coverImg, | ||
profileImg = profileImg, | ||
nickname = nickname, | ||
groupType = groupType, | ||
groupTitle = groupTitle, | ||
weekDay = weekDay ?: "", | ||
weekDate = weekDate ?: "", | ||
startTime = startTime, | ||
endTime = endTime, | ||
location = location | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/sopt/gongbaek/data/mapper/todomain/UserProfileResponseDtoMapper.kt
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.sopt.gongbaek.data.mapper.todomain | ||
|
||
import com.sopt.gongbaek.data.remote.dto.response.UserProfileResponseDto | ||
import com.sopt.gongbaek.domain.model.UserProfile | ||
|
||
fun UserProfileResponseDto.toDomain(): UserProfile = | ||
UserProfile( | ||
nickname = nickname, | ||
schoolName = schoolName | ||
) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/sopt/gongbaek/data/mapper/todomain/UserTimeTableResponseDtoMapper.kt
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.sopt.gongbaek.data.mapper.todomain | ||
|
||
import com.sopt.gongbaek.data.remote.dto.response.UserTimeTableResponseDto | ||
import com.sopt.gongbaek.domain.model.UserLectureTimeTable | ||
|
||
fun UserTimeTableResponseDto.toDomain(): List<UserLectureTimeTable> = | ||
timeTable.map { lectureTimeTable -> | ||
UserLectureTimeTable( | ||
idx = lectureTimeTable.idx, | ||
weekDay = lectureTimeTable.weekDay, | ||
startTime = lectureTimeTable.startTime, | ||
endTime = lectureTimeTable.endTime | ||
) | ||
} |
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
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
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
22 changes: 22 additions & 0 deletions
22
app/src/main/java/com/sopt/gongbaek/data/remote/dto/response/LectureTimeTable.kt
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.sopt.gongbaek.data.remote.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class UserTimeTableResponseDto( | ||
@SerialName("timeTable") | ||
val timeTable: List<LectureTimeTable> | ||
) | ||
|
||
@Serializable | ||
data class LectureTimeTable( | ||
@SerialName("idx") | ||
val idx: Int, | ||
@SerialName("weekDay") | ||
val weekDay: String, | ||
@SerialName("startTime") | ||
val startTime: Double, | ||
@SerialName("endTime") | ||
val endTime: Double | ||
) |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/sopt/gongbaek/data/remote/dto/response/NearestGroupResponseDto.kt
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.sopt.gongbaek.data.remote.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class NearestGroupResponseDto( | ||
@SerialName("groupId") | ||
val groupId: Int, | ||
@SerialName("category") | ||
val category: String, | ||
@SerialName("groupType") | ||
val groupType: String, | ||
@SerialName("groupTitle") | ||
val groupTitle: String, | ||
@SerialName("weekDay") | ||
val weekDay: String?, | ||
@SerialName("weekDate") | ||
val weekDate: String?, | ||
@SerialName("currentPeopleCount") | ||
val currentPeopleCount: Int, | ||
@SerialName("maxPeopleCount") | ||
val maxPeopleCount: Int, | ||
@SerialName("startTime") | ||
val startTime: Double, | ||
@SerialName("endTime") | ||
val endTime: Double, | ||
@SerialName("location") | ||
val location: String | ||
) |
32 changes: 32 additions & 0 deletions
32
...src/main/java/com/sopt/gongbaek/data/remote/dto/response/RecommendGroupInfoResponseDto.kt
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.sopt.gongbaek.data.remote.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RecommendGroupInfoResponseDto( | ||
@SerialName("groupId") | ||
val groupId: Int, | ||
@SerialName("category") | ||
val category: String, | ||
@SerialName("coverImg") | ||
val coverImg: Int, | ||
@SerialName("profileImg") | ||
val profileImg: Int, | ||
@SerialName("nickname") | ||
val nickname: String, | ||
@SerialName("groupType") | ||
val groupType: String, | ||
@SerialName("groupTitle") | ||
val groupTitle: String, | ||
@SerialName("weekDay") | ||
val weekDay: String, | ||
@SerialName("weekDate") | ||
val weekDate: String?, | ||
@SerialName("startTime") | ||
val startTime: Double, | ||
@SerialName("endTime") | ||
val endTime: Double, | ||
@SerialName("location") | ||
val location: String | ||
) |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/sopt/gongbaek/data/remote/dto/response/UserProfileResponseDto.kt
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.sopt.gongbaek.data.remote.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class UserProfileResponseDto( | ||
@SerialName("nickname") | ||
val nickname: String, | ||
@SerialName("schoolName") | ||
val schoolName: String | ||
) |
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
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
Oops, something went wrong.