Skip to content

Commit 9f8d30b

Browse files
author
=
committed
feat: Food, Order, Data model and dto impl
1 parent 71a9b73 commit 9f8d30b

File tree

17 files changed

+1837
-30
lines changed

17 files changed

+1837
-30
lines changed

src/main/kotlin/com/example/Application.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ import io.ktor.server.engine.*
66
import io.ktor.server.netty.*
77

88
fun main() {
9-
embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = Application::module)
10-
.start(wait = true)
9+
embeddedServer(
10+
factory = Netty,
11+
port = System.getenv("PORT")?.toInt() ?: 8080,
12+
host = "0.0.0.0",
13+
module = Application::module
14+
).start(wait = true)
1115
}
1216

1317
fun Application.module() {
18+
configureDatabase()
1419
configureSerialization()
1520
configureRouting()
21+
configureUserRouting()
1622
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.example.dto
2+
3+
import kotlinx.serialization.Serializable
4+
5+
@Serializable
6+
data class FoodDto(
7+
val id: Int,
8+
val name: String,
9+
val description: String,
10+
val price: Double,
11+
val rating: Double,
12+
val orderCount: Int,
13+
val type: String,
14+
val imageUrl: String
15+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.example.dto
2+
3+
import kotlinx.datetime.Instant
4+
import kotlinx.serialization.Serializable
5+
6+
@Serializable
7+
data class OrderDto(
8+
val id: Int,
9+
val userId: Int,
10+
val foodId: Int,
11+
val quantity: Int,
12+
val orderTime: Instant = Instant.DISTANT_PAST
13+
)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.example.dto
2+
3+
import kotlinx.serialization.Serializable
4+
5+
enum class FoodType {
6+
Burger, Pizza, Sandwich, Dessert, Snack, Drink
7+
}
8+
9+
@Serializable
10+
data class UserDto(
11+
val id: Int,
12+
val fullName: String,
13+
val email: String,
14+
val password: String,
15+
val phoneNumber: String,
16+
val occupation: String,
17+
val employer: String,
18+
val country: String,
19+
val latitude: Double,
20+
val longitude: Double,
21+
)
22+
23+
@Serializable
24+
data class UserRegisterDto(
25+
val fullName: String,
26+
val email: String,
27+
val password: String,
28+
)
29+
30+
@Serializable
31+
data class UserLoginDto(
32+
val email: String,
33+
val password: String
34+
)
35+
36+
@Serializable
37+
data class UserUpdateLocationDto(
38+
val latitude: Double,
39+
val longitude: Double
40+
)

0 commit comments

Comments
 (0)