-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
admin/receipt/get/id endpoint with attachments and all other receiptinfo
- Loading branch information
Showing
6 changed files
with
72 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ class AttachmentService { | |
return attachmentRepository.findByReceiptId(id); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 37 additions & 1 deletion
38
src/main/kotlin/com/example/autobank/service/PaymentCardService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,42 @@ | ||
package com.example.autobank.service | ||
|
||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.stereotype.Service | ||
import com.example.autobank.repository.receipt.CardRepository | ||
import com.example.autobank.repository.receipt.PaymentRepository | ||
import com.example.autobank.data.receipt.Card | ||
import com.example.autobank.data.receipt.Payment | ||
|
||
@Service | ||
class PaymentCardService { | ||
} | ||
|
||
@Autowired | ||
lateinit var paymentRepository: PaymentRepository | ||
|
||
@Autowired | ||
lateinit var cardRepository: CardRepository | ||
|
||
fun getCardByReceiptId(receiptId: Int): Card { | ||
val card = cardRepository.findFirstByReceiptId(receiptId) | ||
if (card == null) { | ||
throw Exception("Card not found") | ||
} | ||
return card | ||
|
||
} | ||
|
||
fun getPaymentByReceiptId(receiptId: Int): Payment { | ||
val payment = paymentRepository.findFirstByReceiptId(receiptId) | ||
if (payment == null) { | ||
throw Exception("Payment not found") | ||
} | ||
return payment | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters