Skip to content

Commit

Permalink
#14 setup approveReceipt in AdminController but not tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Victoria committed Mar 7, 2024
1 parent 22f0853 commit a171b3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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){
Expand Down

0 comments on commit a171b3f

Please sign in to comment.