Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cph-cachet/carp.core-kotlin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 83825ae37033de952513430093dca7255bd93dcc
Choose a base ref
..
head repository: cph-cachet/carp.core-kotlin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 53363f8683663b50c1fb5dbaf60c42b055d454e8
Choose a head ref

This file was deleted.

Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import dk.cachet.carp.common.infrastructure.versioning.ApplicationServiceApiMigr
import dk.cachet.carp.deployments.application.DeploymentService
import dk.cachet.carp.deployments.infrastructure.DeploymentServiceInvoker
import dk.cachet.carp.deployments.infrastructure.DeploymentServiceRequest
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.*


@@ -27,9 +28,24 @@ private val major1Minor0To1Migration =
}
}

/**
* - The `deviceDisplayName` field in `DeviceRegistration` is no longer required.
* This also apply to `ConnectedDeviceRegistration`.
*/
@Suppress( "MagicNumber" )
private val major1Minor1To3Migration =
object : Major1Minor1To3Migration( )
object : ApiMigration( 1, 3 )
{
private val removedField = "deviceDisplayName"

@OptIn( ExperimentalSerializationApi::class )
protected fun ApiJsonObjectMigrationBuilder.addDisplayNameField( fieldName: String )
{
updateObject( fieldName ) {
json[ removedField ] ?: json.put( removedField, JsonPrimitive(null ) )
}
}

override fun migrateRequest( request: JsonObject ) = request

override fun migrateResponse( request: JsonObject, response: ApiResponse, targetVersion: ApiVersion ) =