Skip to content
Snippets Groups Projects
Unverified Commit ade48fa5 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

wip: progress

parent d433de71
Branches
Tags
No related merge requests found
Showing
with 397 additions and 79 deletions
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete package de.chaosdorf.mete.model
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
@JvmInline @JvmInline
value class BarcodeId(val value: Long) value class BarcodeId(val value: Long) {
override fun toString() = value.toString()
}
/*
* The MIT License (MIT)
*
* Copyright (c) 2013-2023 Chaosdorf e.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.chaosdorf.mete.model
interface BarcodeModel {
val barcodeId: BarcodeId
val drinkId: DrinkId
}
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete package de.chaosdorf.mete.model
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
@JvmInline @JvmInline
value class DrinkId(val value: Long) value class DrinkId(val value: Long) {
override fun toString() = value.toString()
}
...@@ -22,19 +22,16 @@ ...@@ -22,19 +22,16 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete.v1 package de.chaosdorf.mete.model
import kotlinx.serialization.SerialName import java.math.BigDecimal
import kotlinx.serialization.Serializable
@Serializable interface DrinkModel {
data class AuditResponseV1( val drinkId: DrinkId
@SerialName("payments_sum") val name: String
val payments: Double, val active: Boolean
@SerialName("deposits_sum") val volume: BigDecimal
val deposits: Double, val caffeine: Int?
@SerialName("sum") val price: BigDecimal
val total: Double, val logoUrl: String
@SerialName("audits") }
val entries: List<AuditEntryModelV1>
)
/*
* The MIT License (MIT)
*
* Copyright (c) 2013-2023 Chaosdorf e.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.chaosdorf.mete.model
import java.math.BigDecimal
interface MeteApi {
suspend fun getManifest(): PwaManifest?
suspend fun listTransactions(user: UserId? = null): TransactionSummaryModel
suspend fun listBarcodes(): List<BarcodeModel>
suspend fun getBarcode(id: BarcodeId): BarcodeModel?
suspend fun listDrinks(): List<DrinkModel>
suspend fun getDrink(id: DrinkId): DrinkModel?
suspend fun listUsers(): List<UserModel>
suspend fun getUser(id: UserId): UserModel?
suspend fun deposit(id: UserId, amount: BigDecimal)
suspend fun withdraw(id: UserId, amount: BigDecimal)
suspend fun purchase(id: UserId, drink: DrinkId)
suspend fun purchase(id: UserId, barcode: BarcodeId)
}
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete.v1 package de.chaosdorf.mete.model
interface MeteApiFactory<T> { interface MeteApiFactory {
fun newInstance(baseUrl: String): T fun newInstance(baseUrl: String): MeteApi
} }
/*
* The MIT License (MIT)
*
* Copyright (c) 2013-2023 Chaosdorf e.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.chaosdorf.mete.model
import java.math.BigDecimal
interface TransactionSummaryModel {
val payments: BigDecimal
val deposits: BigDecimal
val total: BigDecimal
val entries: List<TransactionModel>
}
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete package de.chaosdorf.mete.model
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete package de.chaosdorf.mete.model
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
......
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete package de.chaosdorf.mete.model
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
@JvmInline @JvmInline
value class AuditEntryId(val value: Long) value class TransactionId(val value: Long) {
override fun toString() = value.toString()
}
...@@ -22,19 +22,14 @@ ...@@ -22,19 +22,14 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete.v1 package de.chaosdorf.mete.model
import de.chaosdorf.mete.AuditEntryId
import de.chaosdorf.mete.DrinkId
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import kotlinx.serialization.SerialName import java.math.BigDecimal
import kotlinx.serialization.Serializable
@Serializable interface TransactionModel {
data class AuditEntryModelV1( val transactionId: TransactionId
val id: AuditEntryId, val difference: BigDecimal
@SerialName("created_at") val drinkId: DrinkId?
val createdAt: Instant, val timestamp: Instant
val difference: Double, }
val drink: DrinkId?
)
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package de.chaosdorf.mete package de.chaosdorf.mete.model
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
@JvmInline @JvmInline
value class UserId(val value: Long) value class UserId(val value: Long) {
override fun toString() = value.toString()
}
/*
* The MIT License (MIT)
*
* Copyright (c) 2013-2023 Chaosdorf e.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.chaosdorf.mete.model
import java.math.BigDecimal
interface UserModel {
val userId: UserId
val active: Boolean
val name: String
val email: String
val balance: BigDecimal
val audit: Boolean
val redirect: Boolean
}
/*
* The MIT License (MIT)
*
* Copyright (c) 2013-2023 Chaosdorf e.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.chaosdorf.mete.util
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import java.math.BigDecimal
object BigDecimalSerializer : KSerializer<BigDecimal> {
override val descriptor: SerialDescriptor =
PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: BigDecimal) =
encoder.encodeString(value.toPlainString())
override fun deserialize(decoder: Decoder): BigDecimal =
BigDecimal(decoder.decodeString())
}
/*
* The MIT License (MIT)
*
* Copyright (c) 2013-2023 Chaosdorf e.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.chaosdorf.mete.util
import okhttp3.Interceptor
import okhttp3.Response
object Code204Interceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val response = chain.proceed(request)
return if (response.code == 204) {
response.newBuilder().code(200).build()
} else {
response
}
}
}
...@@ -24,12 +24,16 @@ ...@@ -24,12 +24,16 @@
package de.chaosdorf.mete.v1 package de.chaosdorf.mete.v1
import de.chaosdorf.mete.BarcodeId import de.chaosdorf.mete.model.BarcodeId
import de.chaosdorf.mete.DrinkId import de.chaosdorf.mete.model.BarcodeModel
import de.chaosdorf.mete.model.DrinkId
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
data class BarcodeModelV1( internal data class BarcodeModelV1(
val id: BarcodeId, @SerialName("id")
val drink: DrinkId, override val barcodeId: BarcodeId,
) @SerialName("drink")
override val drinkId: DrinkId,
) : BarcodeModel
...@@ -24,19 +24,30 @@ ...@@ -24,19 +24,30 @@
package de.chaosdorf.mete.v1 package de.chaosdorf.mete.v1
import de.chaosdorf.mete.DrinkId import de.chaosdorf.mete.model.DrinkId
import de.chaosdorf.mete.model.DrinkModel
import de.chaosdorf.mete.util.BigDecimalSerializer
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import java.math.BigDecimal
@Serializable @Serializable
data class DrinkModelV1( internal data class DrinkModelV1(
val id: DrinkId, @SerialName("id")
val name: String, override val drinkId: DrinkId,
@SerialName("name")
override val name: String,
@SerialName("active")
override val active: Boolean,
@SerialName("bottle_size") @SerialName("bottle_size")
val bottleSize: Double, @Serializable(with = BigDecimalSerializer::class)
val caffeine: Int?, override val volume: BigDecimal,
val price: Double, @SerialName("caffeine")
override val caffeine: Int?,
@SerialName("price")
@Serializable(with = BigDecimalSerializer::class)
override val price: BigDecimal,
@SerialName("logo_file_name") @SerialName("logo_file_name")
val logoFileName: String, val logoFileName: String,
@SerialName("created_at") @SerialName("created_at")
...@@ -50,6 +61,5 @@ data class DrinkModelV1( ...@@ -50,6 +61,5 @@ data class DrinkModelV1(
@SerialName("logo_updated_at") @SerialName("logo_updated_at")
val logoUpdatedAt: Instant, val logoUpdatedAt: Instant,
@SerialName("logo_url") @SerialName("logo_url")
val logoUrl: String, override val logoUrl: String,
val active: Boolean ) : DrinkModel
)
...@@ -24,52 +24,71 @@ ...@@ -24,52 +24,71 @@
package de.chaosdorf.mete.v1 package de.chaosdorf.mete.v1
import de.chaosdorf.mete.DrinkId import de.chaosdorf.mete.model.BarcodeId
import de.chaosdorf.mete.PwaManifest import de.chaosdorf.mete.model.DrinkId
import de.chaosdorf.mete.UserId import de.chaosdorf.mete.model.MeteApi
import de.chaosdorf.mete.model.PwaManifest
import de.chaosdorf.mete.model.UserId
import retrofit2.Response
import retrofit2.http.GET import retrofit2.http.GET
import retrofit2.http.Path import retrofit2.http.Path
import retrofit2.http.Query import retrofit2.http.Query
import java.math.BigDecimal
interface MeteApiV1 { internal interface MeteApiV1 : MeteApi {
@GET("manifest.json") @GET("manifest.json")
suspend fun getManifest(): PwaManifest? override suspend fun getManifest(): PwaManifest?
@GET("api/v1/audits.json") @GET("api/v1/audits.json")
suspend fun getAudits( override suspend fun listTransactions(
@Query("user") user: Long? = null @Query("user") user: UserId?
): AuditResponseV1 ): TransactionSummaryModelV1
@GET("api/v1/barcodes.json") @GET("api/v1/barcodes.json")
suspend fun listBarcodes(): List<BarcodeModelV1> override suspend fun listBarcodes(): List<BarcodeModelV1>
@GET("api/v1/barcodes/{id}.json") @GET("api/v1/barcodes/{id}.json")
suspend fun getBarcode(): BarcodeModelV1? override suspend fun getBarcode(
@Path("id") id: BarcodeId
): BarcodeModelV1?
@GET("api/v1/drinks.json") @GET("api/v1/drinks.json")
suspend fun listDrinks(): List<DrinkModelV1> override suspend fun listDrinks(): List<DrinkModelV1>
@GET("api/v1/drinks/{id}.json") @GET("api/v1/drinks/{id}.json")
suspend fun getDrink(@Path("id") id: DrinkId): DrinkModelV1? override suspend fun getDrink(
@Path("id") id: DrinkId
): DrinkModelV1?
@GET("api/v1/users.json") @GET("api/v1/users.json")
suspend fun listUsers(): List<UserModelV1> override suspend fun listUsers(): List<UserModelV1>
@GET("api/v1/users/{id}.json") @GET("api/v1/users/{id}.json")
suspend fun getUser(@Path("id") id: UserId): UserModelV1? override suspend fun getUser(
@Path("id") id: UserId
): UserModelV1?
@GET("api/v1/users/{id}/deposit.json") @GET("api/v1/users/{id}/deposit.json")
suspend fun deposit(@Path("id") id: UserId) override suspend fun deposit(
@Path("id") id: UserId,
@Query("amount") amount: BigDecimal
)
@GET("api/v1/users/{id}/payment.json") @GET("api/v1/users/{id}/payment.json")
suspend fun payment(@Path("id") id: UserId) override suspend fun withdraw(
@Path("id") id: UserId,
@Query("amount") amount: BigDecimal
)
@GET("api/v1/users/{id}/buy.json") @GET("api/v1/users/{id}/buy.json")
suspend fun buy(@Path("id") id: UserId) override suspend fun purchase(
@Path("id") id: UserId,
@Query("drink") drink: DrinkId
)
@GET("api/v1/users/{id}/buy_barcode.json") @GET("api/v1/users/{id}/buy_barcode.json")
suspend fun buyWithBarcode(@Path("id") id: UserId) override suspend fun purchase(
@Path("id") id: UserId,
@GET("api/v1/users/stats.json") @Query("barcode") barcode: BarcodeId
suspend fun getStats() )
} }
...@@ -25,19 +25,28 @@ ...@@ -25,19 +25,28 @@
package de.chaosdorf.mete.v1 package de.chaosdorf.mete.v1
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import de.chaosdorf.mete.model.MeteApi
import de.chaosdorf.mete.model.MeteApiFactory
import de.chaosdorf.mete.util.Code204Interceptor
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import okhttp3.MediaType.Companion.toMediaType import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.create import retrofit2.create
object MeteApiV1Factory : MeteApiFactory<MeteApiV1> { object MeteApiV1Factory : MeteApiFactory {
private val json = Json { private val json = Json {
ignoreUnknownKeys = true ignoreUnknownKeys = true
} }
override fun newInstance(baseUrl: String): MeteApiV1 { private val httpClient = OkHttpClient.Builder()
.addInterceptor(Code204Interceptor)
.build()
override fun newInstance(baseUrl: String): MeteApi {
val contentType = "application/json".toMediaType() val contentType = "application/json".toMediaType()
val retrofit = Retrofit.Builder() val retrofit = Retrofit.Builder()
.client(httpClient)
.baseUrl(baseUrl) .baseUrl(baseUrl)
.addConverterFactory(json.asConverterFactory(contentType)) .addConverterFactory(json.asConverterFactory(contentType))
.build() .build()
......
/*
* The MIT License (MIT)
*
* Copyright (c) 2013-2023 Chaosdorf e.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.chaosdorf.mete.v1
import de.chaosdorf.mete.model.DrinkId
import de.chaosdorf.mete.model.TransactionId
import de.chaosdorf.mete.model.TransactionModel
import de.chaosdorf.mete.util.BigDecimalSerializer
import kotlinx.datetime.Instant
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import java.math.BigDecimal
@Serializable
internal data class TransactionModelV1(
@SerialName("id")
override val transactionId: TransactionId,
@SerialName("difference")
@Serializable(with = BigDecimalSerializer::class)
override val difference: BigDecimal,
@SerialName("drink")
override val drinkId: DrinkId?,
@SerialName("created_at")
override val timestamp: Instant
) : TransactionModel
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment