-
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
8 changed files
with
99 additions
and
0 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
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
data/src/main/java/com/kusitms/data/remote/entity/request/AttendCheckRequestBody.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,13 @@ | ||
package com.kusitms.data.remote.entity.request | ||
|
||
import com.kusitms.domain.model.home.AttendCheckModel | ||
|
||
data class AttendCheckRequestBody( | ||
val curriculumId: Int, | ||
val text: String | ||
) | ||
|
||
fun AttendCheckModel.toBody() = | ||
AttendCheckRequestBody( | ||
curriculumId, text | ||
) |
13 changes: 13 additions & 0 deletions
13
data/src/main/java/com/kusitms/data/remote/entity/response/home/AttendQrTextPayload.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,13 @@ | ||
package com.kusitms.data.remote.entity.response.home | ||
|
||
import com.kusitms.domain.model.home.AttendQRModel | ||
|
||
data class AttendQrTextPayload( | ||
val qrText: String | ||
) | ||
|
||
fun AttendQrTextPayload.toModel() = | ||
AttendQRModel( | ||
qrText = qrText | ||
) | ||
|
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
10 changes: 10 additions & 0 deletions
10
domain/src/main/java/com/kusitms/domain/model/home/AttendCheckModel.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.kusitms.domain.model.home | ||
|
||
data class AttendCheckModel( | ||
val curriculumId: Int, | ||
val text :String | ||
) | ||
|
||
data class AttendQRModel( | ||
val qrText: 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
23 changes: 23 additions & 0 deletions
23
domain/src/main/java/com/kusitms/domain/usecase/home/GetAttendQrUseCase.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,23 @@ | ||
package com.kusitms.domain.usecase.home | ||
|
||
import com.kusitms.domain.model.home.AttendQRModel | ||
import com.kusitms.domain.repository.HomeRepository | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flow | ||
import javax.inject.Inject | ||
|
||
class GetAttendQrUseCase @Inject constructor( | ||
private val homeRepository: HomeRepository | ||
) { | ||
operator fun invoke( | ||
curriculumId: Int | ||
): Flow<AttendQRModel> = flow { | ||
homeRepository.getAttendQrText( | ||
curriculumId = curriculumId | ||
).onSuccess { | ||
return@flow emit(it) | ||
}.onFailure { | ||
throw it | ||
} | ||
} | ||
} |