Skip to content

Commit e3902cd

Browse files
committed
FEATURE : implementation several entities #4
1 parent 428706f commit e3902cd

File tree

7 files changed

+79
-2
lines changed

7 files changed

+79
-2
lines changed

src/main/kotlin/eom/improve/kafkaboot/model/FilmEntity.kt

-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package eom.improve.kafkaboot.model
22

33
import eom.improve.kafkaboot.dto.Film
4-
import eom.improve.kafkaboot.enum.MpaaRating
54
import org.springframework.data.annotation.Id
65
import org.springframework.data.relational.core.mapping.Table
76
import java.math.BigDecimal
87
import java.time.LocalDateTime
9-
import java.util.*
108

119
@Table("film")
1210
data class FilmEntity(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package eom.improve.kafkaboot.model
2+
3+
import org.springframework.data.annotation.Id
4+
import org.springframework.data.relational.core.mapping.Table
5+
import java.time.LocalDateTime
6+
7+
@Table("inventory")
8+
data class InventoryEntity(
9+
@Id
10+
val inventoryId: Int,
11+
val filmId: Int,
12+
val storeId: Int,
13+
val lastUpdate: LocalDateTime
14+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package eom.improve.kafkaboot.model
2+
3+
import org.springframework.data.annotation.Id
4+
import org.springframework.data.relational.core.mapping.Table
5+
import java.math.BigDecimal
6+
import java.time.LocalDateTime
7+
8+
@Table("payment")
9+
data class PaymentEntity(
10+
@Id
11+
val paymentId: Int,
12+
val customerId: String,
13+
val staffId: Int,
14+
val rentalId: Int,
15+
val amount: BigDecimal,
16+
val paymentDate: LocalDateTime
17+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package eom.improve.kafkaboot.model
2+
3+
import org.springframework.data.annotation.Id
4+
import org.springframework.data.relational.core.mapping.Table
5+
import java.time.LocalDateTime
6+
7+
@Table("rental")
8+
data class RentalEntity(
9+
@Id
10+
val rentalId: Int,
11+
val rentalDate: LocalDateTime,
12+
val inventoryId: Int,
13+
val customerId: Int,
14+
val returnDate: LocalDateTime? = null,
15+
val staffId: Int? = null,
16+
val lastUpdate: LocalDateTime? = null
17+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package eom.improve.kafkaboot.repository
2+
3+
import eom.improve.kafkaboot.model.InventoryEntity
4+
import org.springframework.data.r2dbc.repository.R2dbcRepository
5+
import org.springframework.stereotype.Repository
6+
import reactor.core.publisher.Flux
7+
8+
@Repository
9+
interface InventoryRepository : R2dbcRepository<InventoryEntity, Int> {
10+
fun findAllByFilmId(filmId: Int) : Flux<InventoryEntity>
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package eom.improve.kafkaboot.repository
2+
3+
import eom.improve.kafkaboot.model.PaymentEntity
4+
import org.springframework.data.r2dbc.repository.R2dbcRepository
5+
import org.springframework.stereotype.Repository
6+
import reactor.core.publisher.Flux
7+
8+
@Repository
9+
interface PaymentRepository : R2dbcRepository<PaymentEntity, Int> {
10+
fun findAllByRentalId(rentalId: Int) : Flux<PaymentEntity>
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package eom.improve.kafkaboot.repository
2+
3+
import eom.improve.kafkaboot.model.RentalEntity
4+
import org.springframework.data.r2dbc.repository.R2dbcRepository
5+
import reactor.core.publisher.Flux
6+
7+
interface RentalRepository : R2dbcRepository<RentalEntity, Int> {
8+
fun findAllByInventoryId(inventoryId: Int) : Flux<RentalEntity>
9+
}

0 commit comments

Comments
 (0)