Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚑 Fix serialization of enums #377

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import de.hbch.traewelling.providers.checkin.CheckInRequest
import java.time.ZonedDateTime

data class TrwlCheckInRequest(
@SerializedName("body") val body: String,
@SerializedName("business") val business: StatusBusiness,
@SerializedName("visibility") val visibility: StatusVisibility,
@SerializedName("eventId") val eventId: Int?,
val body: String,
val business: Int,
val visibility: Int,
val eventId: Int?,
@SerializedName("toot") val sendToot: Boolean,
@SerializedName("chainPost") val shouldChainToot: Boolean,
@SerializedName("tripId") val tripId: String,
@SerializedName("lineName") val lineName: String,
val tripId: String,
val lineName: String,
@SerializedName("start") val startStationId: Int,
@SerializedName("destination") val destinationStationId: Int,
@SerializedName("departure") val departureTime: ZonedDateTime,
@SerializedName("arrival") val arrivalTime: ZonedDateTime,
@SerializedName("force") val force: Boolean = false
val force: Boolean = false
): CheckInRequest()

data class TrwlCheckInResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import java.time.ZonedDateTime

data class TrwlCheckInUpdateRequest(
val body: String?,
val business: StatusBusiness,
val visibility: StatusVisibility,
val business: Int,
val visibility: Int,
val destinationId: Int? = null,
val destinationArrivalPlanned: ZonedDateTime? = null,
val manualDeparture: ZonedDateTime? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class CheckInViewModel : ViewModel() {
if (checkInTrwl) {
val trwlCheckInRequest = TrwlCheckInRequest(
message.value ?: "",
statusBusiness.value ?: StatusBusiness.PRIVATE,
statusVisibility.value ?: StatusVisibility.PUBLIC,
(statusBusiness.value ?: StatusBusiness.PRIVATE).ordinal,
(statusVisibility.value ?: StatusVisibility.PUBLIC).ordinal,
event.value?.id,
toot.value ?: false,
chainToot.value ?: false,
Expand Down Expand Up @@ -135,8 +135,8 @@ class CheckInViewModel : ViewModel() {
editStatusId,
TrwlCheckInUpdateRequest(
message.value,
statusBusiness.value ?: error("Invalid data"),
statusVisibility.value ?: error("Invalid data"),
statusBusiness.value?.ordinal ?: error("Invalid data"),
statusVisibility.value?.ordinal ?: error("Invalid data"),
destinationStationId,
arrivalTime,
manualDepartureTime,
Expand Down
Loading