Skip to content

Commit 2886200

Browse files
authored
fix - Failed to fetch staffs in createNewClient screen (#2357)
* fix - Failed to fetch staff in createNewClient screen * added parcelize * fix checks
1 parent fe4db60 commit 2886200

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

core/database/src/main/java/com/mifos/core/objects/organisation/Staff.kt

+14
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,17 @@ data class Staff(
5252
@Column
5353
var isActive: Boolean? = null,
5454
) : MifosBaseModel(), Parcelable
55+
56+
@Parcelize
57+
data class StaffResponse(
58+
val displayName: String? = null,
59+
val externalId: String? = null,
60+
val firstname: String? = null,
61+
val id: Long? = null,
62+
val isActive: Boolean? = null,
63+
val isLoanOfficer: Boolean? = null,
64+
val joiningDate: List<Int>? = null,
65+
val lastname: String? = null,
66+
val officeId: Long? = null,
67+
val officeName: String? = null,
68+
) : Parcelable

core/network/src/main/java/com/mifos/core/network/mappers/staffs/StaffMapper.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
package com.mifos.core.network.mappers.staffs
1111

1212
import com.mifos.core.objects.organisation.Staff
13+
import com.mifos.core.objects.organisation.StaffResponse
1314
import org.mifos.core.data.AbstractMapper
14-
import org.openapitools.client.models.RetrieveOneResponse
1515

16-
object StaffMapper : AbstractMapper<RetrieveOneResponse, Staff>() {
17-
override fun mapFromEntity(entity: RetrieveOneResponse): Staff {
16+
object StaffMapper : AbstractMapper<StaffResponse, Staff>() {
17+
override fun mapFromEntity(entity: StaffResponse): Staff {
1818
return Staff().apply {
1919
id = entity.id!!.toInt()
2020
firstname = entity.firstname
@@ -27,8 +27,8 @@ object StaffMapper : AbstractMapper<RetrieveOneResponse, Staff>() {
2727
}
2828
}
2929

30-
override fun mapToEntity(domainModel: Staff): RetrieveOneResponse {
31-
return RetrieveOneResponse(
30+
override fun mapToEntity(domainModel: Staff): StaffResponse {
31+
return StaffResponse(
3232
id = domainModel.id?.toLong(),
3333
firstname = domainModel.firstname,
3434
lastname = domainModel.lastname,

core/network/src/main/java/com/mifos/core/network/services/StaffService.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package com.mifos.core.network.services
1111

1212
import com.mifos.core.model.APIEndPoint
1313
import com.mifos.core.objects.organisation.Staff
14-
import org.openapitools.client.models.RetrieveOneResponse
14+
import com.mifos.core.objects.organisation.StaffResponse
1515
import retrofit2.http.GET
1616
import retrofit2.http.Query
1717
import rx.Observable
@@ -32,5 +32,5 @@ interface StaffService {
3232
@GET(APIEndPoint.STAFF)
3333
suspend fun getAllStaff(
3434
@Query("officeId") officeId: Long? = null,
35-
): List<RetrieveOneResponse>
35+
): List<StaffResponse>
3636
}

0 commit comments

Comments
 (0)