diff --git a/src/main/kotlin/com/example/autobank/controller/AdminController.kt b/src/main/kotlin/com/example/autobank/controller/AdminController.kt index d455ccb..e640de4 100644 --- a/src/main/kotlin/com/example/autobank/controller/AdminController.kt +++ b/src/main/kotlin/com/example/autobank/controller/AdminController.kt @@ -50,7 +50,7 @@ class AdminController(@Autowired val adminService: AdminService, @Autowired val val receiptReview = receiptReviewService.getReceiptReview(approveReceiptBody.receipt) receiptReviewService.updateReceiptReviewByStatus(receiptReview, approveReceiptBody.status) }else { - receiptReviewService.addReceiptReview() + receiptReviewService.createReceiptReview(status = approveReceiptBody.status, receipt = approveReceiptBody.receipt, user = approveReceiptBody.user, description = approveReceiptBody.description) } } } diff --git a/src/main/kotlin/com/example/autobank/service/ReceiptReviewService.kt b/src/main/kotlin/com/example/autobank/service/ReceiptReviewService.kt index ee2d3ad..1055830 100644 --- a/src/main/kotlin/com/example/autobank/service/ReceiptReviewService.kt +++ b/src/main/kotlin/com/example/autobank/service/ReceiptReviewService.kt @@ -7,6 +7,7 @@ import com.example.autobank.repository.ReceiptRepository import com.example.autobank.repository.ReceiptReviewRepository import jakarta.transaction.Status import org.springframework.stereotype.Service +import java.time.LocalDateTime @Service class ReceiptReviewService(private val repository: ReceiptReviewRepository) { @@ -20,8 +21,9 @@ class ReceiptReviewService(private val repository: ReceiptReviewRepository) { } fun createReceiptReview(status: Boolean, user: OnlineUser, description: String, receipt: Receipt){ - // val receiptReview = ReceiptReview( recieptId = receipt.id, date = "2017-01-13T17:09:42.4100000", d ) - //repository.save(receiptReview) + val dato = LocalDateTime.now() + val receiptReview = ReceiptReview( receiptReviewId = -1, recieptId = receipt.id, date = dato, adminID = user.onlineId, description = description, status = status ) + repository.save(receiptReview) } fun updateReceiptReviewByStatus(receiptReview: ReceiptReview, status: Boolean){