Skip to content

Commit

Permalink
Merge pull request #430 from BCSDLab/feature/timetable-setting
Browse files Browse the repository at this point in the history
[Feature] 시간표 모듈 구현 및 패키지 구조화
  • Loading branch information
Jokwanhee authored Oct 25, 2024
2 parents 3a89d08 + 618b857 commit c460b30
Show file tree
Hide file tree
Showing 42 changed files with 790 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data/src/main/java/in/koreatech/koin/data/api/TimetableApi.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package `in`.koreatech.koin.data.api

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("/lectures")
suspend fun getLectures(
@Query("semester_date") semesterDate: String
): List<LectureResponse>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package `in`.koreatech.koin.data.api.auth

import `in`.koreatech.koin.data.request.timetable.TimetableFrameCreateQueryRequest
import `in`.koreatech.koin.data.request.timetable.TimetableFrameQueryRequest
import `in`.koreatech.koin.data.request.timetable.TimetableLecturesQueryRequest
import `in`.koreatech.koin.data.response.timetable.TimetableFrameResponse
import `in`.koreatech.koin.data.response.timetable.TimetableLecturesResponse
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

interface TimetableAuthApi {
@GET("/v2/timetables/lecture")
suspend fun getTimetableLectures(): TimetableLecturesResponse

@PUT("/v2/timetables/lecture")
suspend fun putTimetableLectures(
@Body lectures: TimetableLecturesQueryRequest
): TimetableLecturesResponse

@POST("/v2/timetables/lecture")
suspend fun postTimetableLectures(
@Body lectures: TimetableLecturesQueryRequest
): TimetableLecturesResponse

@PUT("/v2/timetables/frame/{id}")
suspend fun putTimetableFrame(
@Path("id") id: Int,
@Body frame: TimetableFrameQueryRequest
): TimetableFrameResponse

@POST("/v2/timetables/frame")
suspend fun postTimetableFrame(
@Body frame: TimetableFrameCreateQueryRequest
): TimetableFrameResponse

@DELETE("/v2/timetables/frame")
suspend fun deleteTimetableFrame()

@GET("/v2/timetables/frame")
suspend fun getTimetableFrames(
@Query("semester") semester: String
): List<TimetableFrameResponse>

@DELETE("/v2/timetables/lecture/{id}")
suspend fun deleteTimetableLecture(
@Path("id") id: Int
)

@DELETE("/v2/all/timetables/frame")
suspend fun deleteAllTimetableFrame()
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,12 @@ object NoAuthNetworkModule {
): CoopShopApi {
return retrofit.create(CoopShopApi::class.java)
}

@Provides
@Singleton
fun provideTimetableApi(
@NoAuth retrofit: Retrofit
): TimetableApi {
return retrofit.create(TimetableApi::class.java)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package `in`.koreatech.koin.data.di.repository

import dagger.Binds
import dagger.BindsInstance
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import `in`.koreatech.koin.data.repository.TimetableRepositoryImpl
import `in`.koreatech.koin.data.repository.firebase.messaging.FirebaseMessagingRepositoryImpl
import `in`.koreatech.koin.domain.repository.TimetableRepository
import `in`.koreatech.koin.domain.repository.firebase.messaging.FirebaseMessagingRepository
import javax.inject.Singleton

Expand All @@ -16,4 +19,10 @@ abstract class BindsRepositoryModule {
abstract fun bindsFirebaseMessagingRepository(
firebaseMessagingRepositoryImpl: FirebaseMessagingRepositoryImpl
): FirebaseMessagingRepository

@Binds
@Singleton
abstract fun bindsTimetableRepository(
timetableRepositoryImpl: TimetableRepositoryImpl
): TimetableRepository
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import `in`.koreatech.koin.data.api.*
import `in`.koreatech.koin.data.api.auth.ArticleAuthApi
import `in`.koreatech.koin.data.api.auth.DiningAuthApi
import `in`.koreatech.koin.data.api.auth.OwnerAuthApi
import `in`.koreatech.koin.data.api.auth.TimetableAuthApi
import `in`.koreatech.koin.data.api.auth.UserAuthApi
import `in`.koreatech.koin.data.source.remote.*
import javax.inject.Singleton
Expand Down Expand Up @@ -124,4 +125,13 @@ object RemoteDataSourceModule {
): CoopShopRemoteDataSource {
return CoopShopRemoteDataSource(coopShopApi)
}

@Provides
@Singleton
fun provideTimetableRemoteDataSource(
timetableApi: TimetableApi,
timetableAuthApi: TimetableAuthApi
): TimetableRemoteDataSource {
return TimetableRemoteDataSource(timetableApi, timetableAuthApi)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package `in`.koreatech.koin.data.repository

import `in`.koreatech.koin.data.source.remote.TimetableRemoteDataSource
import `in`.koreatech.koin.domain.model.timetable.request.TimetableFrameCreateQuery
import `in`.koreatech.koin.domain.model.timetable.request.TimetableFrameQuery
import `in`.koreatech.koin.domain.model.timetable.request.TimetableLecturesQuery
import `in`.koreatech.koin.domain.model.timetable.response.Lecture
import `in`.koreatech.koin.domain.model.timetable.response.Semester
import `in`.koreatech.koin.domain.model.timetable.response.TimetableFrame
import `in`.koreatech.koin.domain.model.timetable.response.TimetableLectures
import `in`.koreatech.koin.domain.repository.TimetableRepository
import javax.inject.Inject

class TimetableRepositoryImpl @Inject constructor(
private val timetableRemoteDataSource: TimetableRemoteDataSource
): TimetableRepository {
override suspend fun getSemesters(): List<Semester> {
TODO("Not yet implemented")
}

override suspend fun getLectures(semesterDate: String): List<Lecture> {
TODO("Not yet implemented")
}

override suspend fun getTimetableLectures(): TimetableLectures {
TODO("Not yet implemented")
}

override suspend fun putTimetableLectures(lectures: TimetableLecturesQuery): TimetableLectures {
TODO("Not yet implemented")
}

override suspend fun postTimetableLectures(lectures: TimetableLecturesQuery): TimetableLectures {
TODO("Not yet implemented")
}

override suspend fun putTimetableFrame(id: Int, frame: TimetableFrameQuery): TimetableFrame {
TODO("Not yet implemented")
}

override suspend fun postTimetableFrame(frame: TimetableFrameCreateQuery): TimetableFrame {
TODO("Not yet implemented")
}

override suspend fun deleteTimetableFrame() {
TODO("Not yet implemented")
}

override suspend fun getTimetableFrames(semester: String): List<TimetableFrame> {
TODO("Not yet implemented")
}

override suspend fun deleteTimetableLecture(id: Int) {
TODO("Not yet implemented")
}

override suspend fun deleteAllTimetableFrame() {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package `in`.koreatech.koin.data.request.timetable

import com.google.gson.annotations.SerializedName

data class TimetableFrameQueryRequest(
@SerializedName("timetable_name")
val timetableName: String,
@SerializedName("is_main")
val isMain: Boolean,
)

data class TimetableFrameCreateQueryRequest(
@SerializedName("semester")
val semester: String,
@SerializedName("timetable_name")
val timetableName: Boolean,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package `in`.koreatech.koin.data.request.timetable

import com.google.gson.annotations.SerializedName

data class TimetableLecturesQueryRequest(
@SerializedName("timetable_frame_id")
val timetableFrameId: Int,
@SerializedName("timetable_lecture")
val timetableLecture: List<TimetableLectureQueryRequest>,
)

data class TimetableLectureQueryRequest(
@SerializedName("id")
val id: Int,
@SerializedName("lecture_id")
val lectureId: Int,
@SerializedName("class_title")
val classTitle: String,
@SerializedName("class_time")
val classTime: List<Int>,
@SerializedName("class_place")
val classPlace: String,
@SerializedName("professor")
val professor: String,
@SerializedName("grades")
val grades: String,
@SerializedName("memo")
val memo: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package `in`.koreatech.koin.data.request.timetable

import com.google.gson.annotations.SerializedName

data class TimetableLecturesUpdateQueryRequest(
@SerializedName("timetable_frame_id")
val timetableFrameId: Int,
@SerializedName("timetable_lecture")
val timetableLecture: List<TimetableLectureUpdateQueryRequest>,
)

data class TimetableLectureUpdateQueryRequest(
@SerializedName("lecture_id")
val lectureId: Int,
@SerializedName("class_title")
val classTitle: String,
@SerializedName("class_time")
val classTime: List<Int>,
@SerializedName("class_place")
val classPlace: String?,
@SerializedName("professor")
val professor: String,
@SerializedName("grades")
val grades: String,
@SerializedName("memo")
val memo: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package `in`.koreatech.koin.data.response.timetable

import com.google.gson.annotations.SerializedName

data class LectureResponse(
@SerializedName("id")
val id: Int,
@SerializedName("code") // "HRD011"
val code: String?,
@SerializedName("name") // "직업능력개발훈련평가"
val name: String?,
@SerializedName("grades") // "2"
val grades: String?,
@SerializedName("lecture_class") // "01"
val lectureClass: String?,
@SerializedName("regular_number") // "40"
val regularNumber: String?,
@SerializedName("department") // "HRD학과"
val department: String?,
@SerializedName("target") // "기공3"
val target: String?,
@SerializedName("professor") // "홍길동"
val professor: String?,
@SerializedName("is_english") // "0" : fasle / "1" : true
val isEnglish: String?,
@SerializedName("design_score") // "0"
val designScore: String?,
@SerializedName("is_elearning") //
val isElearning: String?,
@SerializedName("class_time")
val classTime: List<Int>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package `in`.koreatech.koin.data.response.timetable

import com.google.gson.annotations.SerializedName

data class SemesterResponse(
@SerializedName("id")
val id :Int,
@SerializedName("semester")
val semester: String?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package `in`.koreatech.koin.data.response.timetable

import com.google.gson.annotations.SerializedName

data class TimetableFrameResponse(
@SerializedName("id")
val id: Int,
@SerializedName("timetable_name")
val timetableName: String?,
@SerializedName("is_main")
val isMain: Boolean,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package `in`.koreatech.koin.data.response.timetable

import com.google.gson.annotations.SerializedName

data class TimetableLectureResponse(
@SerializedName("id")
val id: Int,
@SerializedName("lecture_id")
val lectureId: Int,
@SerializedName("regular_number") // "38"
val regularNumber: String?,
@SerializedName("code") // "ARB244"
val code: String?,
@SerializedName("design_score") // "0"
val designScore: String?,
@SerializedName("class_time")
val classTime: List<Int>,
@SerializedName("class_place") // "2공학관"
val classPlace: String?,
@SerializedName("memo")
val memo: String?,
@SerializedName("grades") // "3"
val grades: String?,
@SerializedName("class_title") // "한국사"
val classTitle: String?,
@SerializedName("lecture_class") // "01"
val lectureClass: String?,
@SerializedName("target") // "디자 1 건축"
val target: String?,
@SerializedName("professor") // "이돈우"
val professor: String?,
@SerializedName("department") // "디자인ㆍ건축공학부"
val department: String?,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package `in`.koreatech.koin.data.response.timetable

import com.google.gson.annotations.SerializedName

data class TimetableLecturesResponse(
@SerializedName("timetable_frame_id")
val timetableFrameId: Int,
@SerializedName("timetable")
val timetable: List<TimetableLectureResponse>,
@SerializedName("grades")
val grades: Int?,
@SerializedName("total_grades")
val totalGrades: Int?,
)

Loading

0 comments on commit c460b30

Please sign in to comment.