-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] 시간표 마이그레이션 #291
Draft
Jokwanhee
wants to merge
29
commits into
develop
Choose a base branch
from
feature/timetable_v2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,189
−28
Draft
[Feature] 시간표 마이그레이션 #291
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b26fe47
[ADD] init timetable compose setting
Jokwanhee 8aca5ac
[ADD] timetable content header & get semester api
Jokwanhee 1d6e367
[ADD] timetable UI & departments and lectures api
Jokwanhee f665100
[ADD] timetable bottomsheet
Jokwanhee 0982dfe
[ADD] anoymous timetables
Jokwanhee b3874fe
[MOD] anonymous logic in datasource
Jokwanhee 09d2f95
[ADD] user timetables
Jokwanhee ccbaff5
[MOD] bottomsheet roundedshape
Jokwanhee 6ae63ab
[ADD] lecture color palette
Jokwanhee 6cde7e3
[MOD] userState in timetable navi trail
Jokwanhee fb584aa
[MOD] user add timetables
Jokwanhee 431b509
[UI] timetable
Jokwanhee 5a793cb
[MOD] bottomsheetshape padding position & darkmode false
Jokwanhee 19fd67c
[ADD] unregister listener solve memory leak
Jokwanhee 8c72345
[MOD] bottomsheet height with ime
Jokwanhee a082078
[ADD] glance project settings
Jokwanhee 035d9f5
[ADD] update widget
Jokwanhee 46ab5de
[ADD] glance widget
Jokwanhee f5892d4
Merge branch 'develop' into feature/timetable_v2
Jokwanhee 2580677
[MOD] timeblock ui
Jokwanhee 4cc5c95
[MOD] timetable ui
Jokwanhee 55d3040
[DEL] dragon image
Jokwanhee 8d5a906
[ADD] lecture default colors
Jokwanhee 8e77bda
[MOD] timetable widget label & invisible before timetable widget
Jokwanhee ddcbf45
[MOD] lecture description
Jokwanhee b61a7cd
[MOD] timetable header size
Jokwanhee a65a88a
[MOD] timetable widget ui
Jokwanhee 079002a
[ADD] empty event time click enabled false
Jokwanhee ee9437e
[ADD] lecture click event trigger
Jokwanhee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"departments": [ | ||
{ | ||
"id": 1, | ||
"name": "컴퓨터공학부" | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "기계공학부" | ||
}, | ||
{ | ||
"id": 3, | ||
"name": "전기전자통신공학부" | ||
}, | ||
{ | ||
"id": 4, | ||
"name": "에너지신소재화학공학부" | ||
}, | ||
{ | ||
"id": 5, | ||
"name": "산업경영학부" | ||
}, | ||
{ | ||
"id": 6, | ||
"name": "메카트로닉스공학부" | ||
}, | ||
{ | ||
"id": 7, | ||
"name": "디자인건축공학부" | ||
}, | ||
{ | ||
"id": 8, | ||
"name": "고용서비스정책학과" | ||
}, | ||
{ | ||
"id": 9, | ||
"name": "안전공학과" | ||
}, | ||
{ | ||
"id": 10, | ||
"name": "교양학부" | ||
}, | ||
{ | ||
"id": 11, | ||
"name": "HRD학과" | ||
}, | ||
{ | ||
"id": 12, | ||
"name": "융합학과" | ||
} | ||
] | ||
} |
18 changes: 18 additions & 0 deletions
18
data/src/main/java/in/koreatech/koin/data/api/TimetableApi.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 `in`.koreatech.koin.data.api | ||
|
||
import `in`.koreatech.koin.data.constant.URLConstant.LECTURE | ||
import `in`.koreatech.koin.data.constant.URLConstant.SEMESTERS | ||
import `in`.koreatech.koin.data.response.timetable.LectureResponse | ||
import `in`.koreatech.koin.data.response.timetable.SemesterResponse | ||
import retrofit2.http.GET | ||
import retrofit2.http.Query | ||
|
||
interface TimetableApi { | ||
@GET(SEMESTERS) | ||
suspend fun getSemesters(): List<SemesterResponse> | ||
|
||
@GET(LECTURE) | ||
suspend fun getLectures( | ||
@Query("semester_date") semester: String | ||
): List<LectureResponse> | ||
} |
28 changes: 28 additions & 0 deletions
28
data/src/main/java/in/koreatech/koin/data/api/auth/TimetableAuthApi.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,28 @@ | ||
package `in`.koreatech.koin.data.api.auth | ||
|
||
import `in`.koreatech.koin.data.constant.URLConstant.TIMETABLE | ||
import `in`.koreatech.koin.data.constant.URLConstant.TIMETABLES | ||
import `in`.koreatech.koin.data.request.timetable.TimetablesRequest | ||
import `in`.koreatech.koin.data.response.timetable.TimetablesResponse | ||
import retrofit2.http.Body | ||
import retrofit2.http.DELETE | ||
import retrofit2.http.GET | ||
import retrofit2.http.POST | ||
import retrofit2.http.Query | ||
|
||
interface TimetableAuthApi { | ||
@GET(TIMETABLES) | ||
suspend fun getTimetables( | ||
@Query("semester") semester: String, | ||
): TimetablesResponse | ||
|
||
@POST(TIMETABLES) | ||
suspend fun postTimetables( | ||
@Body timetables: TimetablesRequest | ||
) | ||
|
||
@DELETE(TIMETABLE) | ||
suspend fun deleteTimetables( | ||
@Query("id") id: Int | ||
) | ||
} |
36 changes: 36 additions & 0 deletions
36
data/src/main/java/in/koreatech/koin/data/di/datastore/DataStoreModule.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,36 @@ | ||
package `in`.koreatech.koin.data.di.datastore | ||
|
||
import android.content.Context | ||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler | ||
import androidx.datastore.preferences.core.PreferenceDataStoreFactory | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.emptyPreferences | ||
import androidx.datastore.preferences.preferencesDataStoreFile | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.SupervisorJob | ||
import javax.inject.Singleton | ||
|
||
private const val KOIN_PREFERENCES = "koin_preferences" | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
object DataStoreModule { | ||
@Singleton | ||
@Provides | ||
fun providesPreferencesDataStore(@ApplicationContext appContext: Context): DataStore<Preferences> { | ||
return PreferenceDataStoreFactory.create( | ||
corruptionHandler = ReplaceFileCorruptionHandler( | ||
produceNewData = { emptyPreferences() } | ||
), | ||
scope = CoroutineScope(Dispatchers.IO + SupervisorJob()), | ||
produceFile = { appContext.preferencesDataStoreFile(KOIN_PREFERENCES) } | ||
) | ||
} | ||
} |
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
75 changes: 75 additions & 0 deletions
75
data/src/main/java/in/koreatech/koin/data/mapper/TimetableMapper.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,75 @@ | ||
package `in`.koreatech.koin.data.mapper | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import `in`.koreatech.koin.data.request.timetable.TimetablesLectureRequest | ||
import `in`.koreatech.koin.data.request.timetable.TimetablesRequest | ||
import `in`.koreatech.koin.data.response.timetable.DepartmentResponse | ||
import `in`.koreatech.koin.data.response.timetable.LectureResponse | ||
import `in`.koreatech.koin.data.response.timetable.SemesterResponse | ||
import `in`.koreatech.koin.data.response.timetable.TimetablesLectureResponse | ||
import `in`.koreatech.koin.domain.model.timetable.Department | ||
import `in`.koreatech.koin.domain.model.timetable.Lecture | ||
import `in`.koreatech.koin.domain.model.timetable.Semester | ||
|
||
fun SemesterResponse.toSemester() = Semester( | ||
id = this.id, | ||
semester = this.semester | ||
) | ||
|
||
fun LectureResponse.toLecture() = Lecture( | ||
id = this.id ?: 0, | ||
code = this.code ?: "", | ||
name = this.name ?: "", | ||
grades = this.grades ?: "", | ||
lectureClass = this.lectureClass ?: "", | ||
regularNumber = this.regularNumber ?: "", | ||
department = this.department ?: "", | ||
target = this.target ?: "", | ||
professor = this.professor ?: "", | ||
isEnglish = this.isEnglish ?: "", | ||
designScore = this.designScore ?: "", | ||
isElearning = this.isElearning ?: "", | ||
classTime = this.classTime, | ||
) | ||
|
||
fun TimetablesLectureResponse.toLecture() = Lecture( | ||
id = this.id ?: 0, | ||
code = this.code ?: "", | ||
name = this.name ?: "", | ||
grades = this.grades ?: "", | ||
lectureClass = this.lectureClass ?: "", | ||
regularNumber = this.regularNumber ?: "", | ||
department = this.department ?: "", | ||
target = this.target ?: "", | ||
professor = this.professor ?: "", | ||
isEnglish = "", | ||
designScore = this.designScore ?: "", | ||
isElearning = "", | ||
classTime = this.classTime.orEmpty(), | ||
) | ||
|
||
fun DepartmentResponse.toDepartment() = Department( | ||
id = this.id, | ||
name = this.name | ||
) | ||
|
||
fun List<Lecture>.toTimetablesRequest(semester: String) = TimetablesRequest( | ||
timetable = this.map { it.toTimetablesLectureResponse() }, | ||
semester = semester | ||
) | ||
|
||
fun Lecture.toTimetablesLectureResponse() = TimetablesLectureRequest( | ||
id = this.id, | ||
code = this.code, | ||
name = this.name, | ||
grades = this.grades, | ||
lectureClass = this.lectureClass, | ||
regularNumber = this.regularNumber, | ||
department = this.department, | ||
target = this.target, | ||
professor = this.professor, | ||
designScore = this.designScore, | ||
classPlace = "", | ||
memo = "", | ||
classTime = this.classTime | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lecture에 대해서 두개의 response를 둔 이유가 궁금합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 서버에서 불러오는 시간표 api response 스키마가 동일하지 않아서 response dto 를 두개 만들어 놨습니다.. 서버에게 말해야하지만 이번에 v2로 api를 만들고 있는걸로 알아서 공수가 또 들어갈것같아 우선 냅뒀습니다.. 추가로 이전 버전의 사이드 이펙트나 안드로이드가 아닌 다른 플랫폼에서 발생하는 이슈를 생각해보니 하암..
/lectures
(강의 목록 조회)/timetables
(시간표 정보 조회)