refact: [NETWORK] format on data part to be able to filter and search… (#288)

Co-authored-by: Florent Champigny <florent@bere.al>
This commit is contained in:
Florent CHAMPIGNY 2025-10-02 14:32:56 +02:00 committed by GitHub
parent 8c6ce2e244
commit 08e58f60f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 4420 additions and 67 deletions

View file

@ -31,6 +31,9 @@ private fun FloconNetworkCallEntity.toRequestDomainModel(): FloconNetworkCallDom
isMocked = request.isMocked,
startTimeFormatted = request.startTimeFormatted,
byteSizeFormatted = request.byteSizeFormatted,
domainFormatted = request.domainFormatted,
queryFormatted = request.queryFormatted,
methodFormatted = request.methodFormatted,
specificInfos = when (type) {
FloconNetworkCallType.HTTP -> FloconNetworkCallDomainModel.Request.SpecificInfos.Http
FloconNetworkCallType.GRAPHQL -> FloconNetworkCallDomainModel.Request.SpecificInfos.GraphQl(
@ -49,6 +52,7 @@ private fun FloconNetworkResponseEmbedded.toDomainModel(): FloconNetworkCallDoma
durationMs = durationMs,
issue = responseError,
durationFormatted = durationFormatted,
statusFormatted = statusFormatted,
)
} else {
FloconNetworkCallDomainModel.Response.Success(
@ -60,6 +64,7 @@ private fun FloconNetworkResponseEmbedded.toDomainModel(): FloconNetworkCallDoma
durationFormatted = durationFormatted,
byteSizeFormatted = responseByteSizeFormatted ?: "",
isImage = isImage,
statusFormatted = statusFormatted,
specificInfos = when {
graphql != null -> FloconNetworkCallDomainModel.Response.Success.SpecificInfos.GraphQl(
httpCode = graphql.responseHttpCode,

View file

@ -8,8 +8,6 @@ import io.github.openflocon.data.local.network.models.graphql.NetworkCallGraphQl
import io.github.openflocon.data.local.network.models.graphql.NetworkCallGraphQlResponseEmbedded
import io.github.openflocon.data.local.network.models.grpc.NetworkCallGrpcResponseEmbedded
import io.github.openflocon.data.local.network.models.http.NetworkCallHttpResponseEmbedded
import io.github.openflocon.domain.device.models.AppInstance
import io.github.openflocon.domain.device.models.DeviceId
import io.github.openflocon.domain.device.models.DeviceIdAndPackageNameDomainModel
import io.github.openflocon.domain.network.models.FloconNetworkCallDomainModel
@ -43,7 +41,10 @@ fun FloconNetworkCallDomainModel.toEntity(
)
else -> null
}
},
domainFormatted = request.domainFormatted,
queryFormatted = request.queryFormatted,
methodFormatted = request.methodFormatted,
),
response = response?.let { networkResponse ->
when(networkResponse) {
@ -61,6 +62,7 @@ fun FloconNetworkCallDomainModel.toEntity(
isImage = false,
durationFormatted = networkResponse.durationFormatted,
responseByteSizeFormatted = null,
statusFormatted = networkResponse.statusFormatted,
)
}
is FloconNetworkCallDomainModel.Response.Success -> {
@ -74,6 +76,7 @@ fun FloconNetworkCallDomainModel.toEntity(
responseByteSizeFormatted = networkResponse.byteSizeFormatted,
responseError = null,
isImage = networkResponse.isImage,
statusFormatted = networkResponse.statusFormatted,
graphql = when (val s = networkResponse.specificInfos) {
is FloconNetworkCallDomainModel.Response.Success.SpecificInfos.GraphQl -> NetworkCallGraphQlResponseEmbedded(
responseHttpCode = s.httpCode,

View file

@ -58,6 +58,10 @@ data class FloconNetworkRequestEmbedded(
val requestByteSize: Long,
val isMocked: Boolean,
val domainFormatted: String, // for sorting & filtering
val methodFormatted: String, // for sorting & filtering
val queryFormatted: String, // for sorting & filtering
@Embedded(prefix = "graphql_")
val graphql: NetworkCallGraphQlRequestEmbedded?,
)
@ -72,6 +76,7 @@ data class FloconNetworkResponseEmbedded(
val responseByteSizeFormatted: String?,
val responseError: String?,
val isImage: Boolean,
val statusFormatted: String, // for sorting & filtering
@Embedded(prefix = "graphql_")
val graphql: NetworkCallGraphQlResponseEmbedded?,