-
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.
- Loading branch information
Showing
60 changed files
with
2,861 additions
and
150 deletions.
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
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/android/bbangzip/data/dto/request/RequestAddSubjectsDto.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 org.android.bbangzip.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RequestAddSubjectsDto( | ||
@SerialName("subjectName") | ||
val subjectName: String, | ||
@SerialName("year") | ||
val year: Int, | ||
@SerialName("semester") | ||
val semester: String, | ||
) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/android/bbangzip/data/dto/request/RequestDeleteSubjectsDto.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 org.android.bbangzip.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RequestDeleteSubjectsDto( | ||
@SerialName("subjectIds") | ||
val subjectIds: List<Int>, | ||
@SerialName("year") | ||
val year: Int, | ||
@SerialName("semester") | ||
val semester: String, | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/org/android/bbangzip/data/dto/request/RequestSubjectOptions.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 org.android.bbangzip.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RequestSubjectOptions( | ||
@SerialName("value") | ||
val value: 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
24 changes: 24 additions & 0 deletions
24
app/src/main/java/org/android/bbangzip/data/service/SubjectService.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 |
---|---|---|
@@ -1,10 +1,34 @@ | ||
package org.android.bbangzip.data.service | ||
|
||
import org.android.bbangzip.data.dto.request.RequestAddSubjectsDto | ||
import org.android.bbangzip.data.dto.request.RequestDeleteSubjectsDto | ||
import org.android.bbangzip.data.dto.request.RequestSubjectOptions | ||
import org.android.bbangzip.data.dto.response.ResponseSubjectFilterDto | ||
import org.android.bbangzip.data.util.base.BaseResponse | ||
import retrofit2.http.Body | ||
import retrofit2.http.GET | ||
import retrofit2.http.HTTP | ||
import retrofit2.http.POST | ||
import retrofit2.http.Path | ||
|
||
interface SubjectService { | ||
@GET("/api/v1/subjects/filter?year=2025&semester=1학기") | ||
suspend fun getSubjectInfo(): BaseResponse<ResponseSubjectFilterDto?> | ||
|
||
@POST("/api/v1/subjects") | ||
suspend fun postSubjectName( | ||
@Body requestAddSubjectsDto: RequestAddSubjectsDto, | ||
): BaseResponse<Unit?> | ||
|
||
@HTTP(method = "DELETE", path = "/api/v1/subjects", hasBody = true) | ||
suspend fun deleteSubjects( | ||
@Body requestDeleteSubjectsDto: RequestDeleteSubjectsDto, | ||
): BaseResponse<Unit?> | ||
|
||
@HTTP(method = "PUT", path = "/api/v1/subjects/{subjectId}/{options}", hasBody = true) | ||
suspend fun putSubjectOptions( | ||
@Path("subjectId") subjectId: Int, | ||
@Path("options") options: String, | ||
@Body requestSubjectOptions: RequestSubjectOptions, | ||
): BaseResponse<Unit?> | ||
} |
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
13 changes: 13 additions & 0 deletions
13
app/src/main/java/org/android/bbangzip/domain/repository/remote/SubjectRepository.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 |
---|---|---|
@@ -1,7 +1,20 @@ | ||
package org.android.bbangzip.domain.repository.remote | ||
|
||
import org.android.bbangzip.data.dto.request.RequestAddSubjectsDto | ||
import org.android.bbangzip.data.dto.request.RequestDeleteSubjectsDto | ||
import org.android.bbangzip.data.dto.request.RequestSubjectOptions | ||
import org.android.bbangzip.domain.model.SubjectInfoEntity | ||
|
||
interface SubjectRepository { | ||
suspend fun getSubjectInfo(): Result<SubjectInfoEntity> | ||
|
||
suspend fun postSubjectName(requestAddSubjectsDto: RequestAddSubjectsDto): Result<Unit> | ||
|
||
suspend fun deleteSubjects(requestDeleteSubjectsDto: RequestDeleteSubjectsDto): Result<Unit> | ||
|
||
suspend fun putSubjectOptions( | ||
subjectId: Int, | ||
options: String, | ||
requestSubjectOptions: RequestSubjectOptions, | ||
): Result<Unit> | ||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/org/android/bbangzip/domain/usecase/DeleteSubjectsUseCase.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,11 @@ | ||
package org.android.bbangzip.domain.usecase | ||
|
||
import org.android.bbangzip.data.dto.request.RequestDeleteSubjectsDto | ||
import org.android.bbangzip.domain.repository.remote.SubjectRepository | ||
|
||
class DeleteSubjectsUseCase( | ||
private val subjectRepository: SubjectRepository, | ||
) { | ||
suspend operator fun invoke(requestDeleteSubjectsDto: RequestDeleteSubjectsDto): Result<Unit> = | ||
subjectRepository.deleteSubjects(requestDeleteSubjectsDto = requestDeleteSubjectsDto) | ||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/org/android/bbangzip/domain/usecase/PostAddSubjectNameUseCase.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,11 @@ | ||
package org.android.bbangzip.domain.usecase | ||
|
||
import org.android.bbangzip.data.dto.request.RequestAddSubjectsDto | ||
import org.android.bbangzip.domain.repository.remote.SubjectRepository | ||
|
||
class PostAddSubjectNameUseCase( | ||
private val subjectRepository: SubjectRepository, | ||
) { | ||
suspend operator fun invoke(requestAddSubjectsDto: RequestAddSubjectsDto): Result<Unit> = | ||
subjectRepository.postSubjectName(requestAddSubjectsDto = requestAddSubjectsDto) | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/org/android/bbangzip/domain/usecase/PutSubjectOptionsUseCase.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,19 @@ | ||
package org.android.bbangzip.domain.usecase | ||
|
||
import org.android.bbangzip.data.dto.request.RequestSubjectOptions | ||
import org.android.bbangzip.domain.repository.remote.SubjectRepository | ||
|
||
class PutSubjectOptionsUseCase( | ||
private val subjectRepository: SubjectRepository, | ||
) { | ||
suspend operator fun invoke( | ||
subjectId: Int, | ||
options: String, | ||
requestSubjectOptions: RequestSubjectOptions, | ||
): Result<Unit> = | ||
subjectRepository.putSubjectOptions( | ||
subjectId = subjectId, | ||
options = options, | ||
requestSubjectOptions = requestSubjectOptions, | ||
) | ||
} |
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
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.