Skip to content

Commit

Permalink
FEATURE : implementation several entities #4
Browse files Browse the repository at this point in the history
  • Loading branch information
stephano-tri committed Feb 13, 2024
1 parent 428706f commit e3902cd
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/main/kotlin/eom/improve/kafkaboot/model/FilmEntity.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package eom.improve.kafkaboot.model

import eom.improve.kafkaboot.dto.Film
import eom.improve.kafkaboot.enum.MpaaRating
import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table
import java.math.BigDecimal
import java.time.LocalDateTime
import java.util.*

@Table("film")
data class FilmEntity(
Expand Down
14 changes: 14 additions & 0 deletions src/main/kotlin/eom/improve/kafkaboot/model/InventoryEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package eom.improve.kafkaboot.model

import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table
import java.time.LocalDateTime

@Table("inventory")
data class InventoryEntity(
@Id
val inventoryId: Int,
val filmId: Int,
val storeId: Int,
val lastUpdate: LocalDateTime
)
17 changes: 17 additions & 0 deletions src/main/kotlin/eom/improve/kafkaboot/model/PaymentEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package eom.improve.kafkaboot.model

import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table
import java.math.BigDecimal
import java.time.LocalDateTime

@Table("payment")
data class PaymentEntity(
@Id
val paymentId: Int,
val customerId: String,
val staffId: Int,
val rentalId: Int,
val amount: BigDecimal,
val paymentDate: LocalDateTime
)
17 changes: 17 additions & 0 deletions src/main/kotlin/eom/improve/kafkaboot/model/RentalEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package eom.improve.kafkaboot.model

import org.springframework.data.annotation.Id
import org.springframework.data.relational.core.mapping.Table
import java.time.LocalDateTime

@Table("rental")
data class RentalEntity(
@Id
val rentalId: Int,
val rentalDate: LocalDateTime,
val inventoryId: Int,
val customerId: Int,
val returnDate: LocalDateTime? = null,
val staffId: Int? = null,
val lastUpdate: LocalDateTime? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package eom.improve.kafkaboot.repository

import eom.improve.kafkaboot.model.InventoryEntity
import org.springframework.data.r2dbc.repository.R2dbcRepository
import org.springframework.stereotype.Repository
import reactor.core.publisher.Flux

@Repository
interface InventoryRepository : R2dbcRepository<InventoryEntity, Int> {
fun findAllByFilmId(filmId: Int) : Flux<InventoryEntity>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package eom.improve.kafkaboot.repository

import eom.improve.kafkaboot.model.PaymentEntity
import org.springframework.data.r2dbc.repository.R2dbcRepository
import org.springframework.stereotype.Repository
import reactor.core.publisher.Flux

@Repository
interface PaymentRepository : R2dbcRepository<PaymentEntity, Int> {
fun findAllByRentalId(rentalId: Int) : Flux<PaymentEntity>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package eom.improve.kafkaboot.repository

import eom.improve.kafkaboot.model.RentalEntity
import org.springframework.data.r2dbc.repository.R2dbcRepository
import reactor.core.publisher.Flux

interface RentalRepository : R2dbcRepository<RentalEntity, Int> {
fun findAllByInventoryId(inventoryId: Int) : Flux<RentalEntity>
}

0 comments on commit e3902cd

Please sign in to comment.