Skip to content

Commit 57685dd

Browse files
author
=
committed
refactor: updated tables
1 parent b25aa8c commit 57685dd

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

src/main/kotlin/com/example/dto/FoodDto.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ data class FoodDto(
1010
val price: Double,
1111
val rating: Double,
1212
val orderCount: Int,
13-
val type: String,
13+
val category: String,
1414
val imageUrl: String
1515
)
16+
17+
enum class FoodCategory {
18+
Burger, Pizza, Sandwich, Dessert, Snack, Drink
19+
}
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
package com.example.dto
22

3+
import com.example.util.BigDecimalSerializer
34
import kotlinx.datetime.Instant
45
import kotlinx.serialization.Serializable
6+
import java.math.BigDecimal
7+
import java.util.UUID
58

6-
@Serializable
9+
@Serializable(with = BigDecimalSerializer::class)
710
data class OrderDto(
811
val id: Int,
9-
val userId: Int,
10-
val foodId: Int,
11-
val quantity: Int,
12-
val orderTime: Instant = Instant.DISTANT_PAST
12+
val userId: UUID,
13+
val orderTime: Instant,
14+
val orderStatus: OrderStatus = OrderStatus.Pending,
15+
val totalPrice: BigDecimal,
16+
val paymentDetails: String? = null,
1317
)
18+
19+
enum class OrderStatus {
20+
Pending, Started, Processing, Finished, Cancelled
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.example.dto
2+
3+
import com.example.util.BigDecimalSerializer
4+
import kotlinx.serialization.Serializable
5+
import java.math.BigDecimal
6+
7+
@Serializable(with = BigDecimalSerializer::class)
8+
data class OrderItemDto(
9+
val id: Int,
10+
val orderId: Int,
11+
val foodId: Int,
12+
val quantity: Int,
13+
val price: BigDecimal
14+
)

src/main/kotlin/com/example/dto/UserDto.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ package com.example.dto
22

33
import kotlinx.serialization.Serializable
44

5-
enum class FoodType {
6-
Burger, Pizza, Sandwich, Dessert, Snack, Drink
7-
}
8-
95
@Serializable
106
data class UserDto(
117
val id: Int,

0 commit comments

Comments
 (0)