Merge pull request 'refactor: wrong position of query functions' (#8) from backend-dev into main
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
@@ -1,20 +1,19 @@
|
|||||||
package club.itstudio.itmanager.service
|
package club.itstudio.itmanager.service
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService
|
|
||||||
import club.itstudio.itmanager.entity.dto.Account
|
import club.itstudio.itmanager.entity.dto.Account
|
||||||
import club.itstudio.itmanager.entity.vo.request.EmailRegisterVO
|
import com.baomidou.mybatisplus.extension.service.IService
|
||||||
import club.itstudio.itmanager.entity.vo.request.PasswordResetVO
|
|
||||||
import club.itstudio.itmanager.entity.vo.response.ReloginVO
|
|
||||||
import org.springframework.security.core.userdetails.ReactiveUserDetailsService
|
import org.springframework.security.core.userdetails.ReactiveUserDetailsService
|
||||||
import reactor.core.publisher.Mono
|
import reactor.core.publisher.Mono
|
||||||
|
|
||||||
interface AccountService : IService<Account>, ReactiveUserDetailsService {
|
interface AccountService : IService<Account>, ReactiveUserDetailsService {
|
||||||
|
fun findAccountById(id: Long): Mono<Account>
|
||||||
fun findAccountByNameOrEmail(text: String): Mono<Account>
|
fun findAccountByNameOrEmail(text: String): Mono<Account>
|
||||||
fun findAccountByName(username: String): Mono<Account>
|
fun findAccountByName(username: String): Mono<Account>
|
||||||
fun findAccountByEmail(email: String): Mono<Account>
|
fun findAccountByEmail(email: String): Mono<Account>
|
||||||
fun existAccountByName(username: String): Mono<Boolean>
|
fun existAccountByName(username: String): Mono<Boolean>
|
||||||
fun existAccountByEmail(email: String): Mono<Boolean>
|
fun existAccountByEmail(email: String): Mono<Boolean>
|
||||||
fun resetPasswordByEmail(email: String, encodedPassword: String): Mono<Void>
|
fun resetPasswordByEmail(email: String, encodedPassword: String): Mono<Void>
|
||||||
|
fun createAccount(account: Account): Mono<Boolean>
|
||||||
|
|
||||||
// fun batchInsert(accounts: List<Account>): Mono<Boolean>
|
// fun batchInsert(accounts: List<Account>): Mono<Boolean>
|
||||||
// fun replaceAll(accounts: List<Account>): Mono<Boolean>
|
// fun replaceAll(accounts: List<Account>): Mono<Boolean>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface AttachmentService : IService<Attachment> {
|
|||||||
fun listByRelated(relatedTable: String, relatedId: Long): Mono<List<Attachment>>
|
fun listByRelated(relatedTable: String, relatedId: Long): Mono<List<Attachment>>
|
||||||
fun listByUploader(uploadedBy: Long): Mono<List<Attachment>>
|
fun listByUploader(uploadedBy: Long): Mono<List<Attachment>>
|
||||||
fun createAttachment(attachment: Attachment): Mono<Boolean>
|
fun createAttachment(attachment: Attachment): Mono<Boolean>
|
||||||
|
fun updateAttachment(attachment: Attachment): Mono<Boolean>
|
||||||
fun deleteAttachment(id: Long): Mono<Boolean>
|
fun deleteAttachment(id: Long): Mono<Boolean>
|
||||||
fun deleteByRelated(relatedTable: String, relatedId: Long): Mono<Boolean>
|
fun deleteByRelated(relatedTable: String, relatedId: Long): Mono<Boolean>
|
||||||
fun exportAllAttachments(): Mono<List<Attachment>>
|
fun exportAllAttachments(): Mono<List<Attachment>>
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package club.itstudio.itmanager.service
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService
|
import com.baomidou.mybatisplus.extension.service.IService
|
||||||
import club.itstudio.itmanager.entity.dto.BorrowRecord
|
import club.itstudio.itmanager.entity.dto.BorrowRecord
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
||||||
import reactor.core.publisher.Mono
|
import reactor.core.publisher.Mono
|
||||||
|
|
||||||
interface BorrowRecordService : IService<BorrowRecord> {
|
interface BorrowRecordService : IService<BorrowRecord> {
|
||||||
fun getBorrowRecordById(id: Long): Mono<BorrowRecord>
|
fun getBorrowRecordById(id: Long): Mono<BorrowRecord>
|
||||||
|
fun pageUsages(page: Page<BorrowRecord>, keyword: String?, status: String?): Mono<Page<BorrowRecord>>
|
||||||
fun listByItem(itemId: Long): Mono<List<BorrowRecord>>
|
fun listByItem(itemId: Long): Mono<List<BorrowRecord>>
|
||||||
fun listByBorrower(borrower: String): Mono<List<BorrowRecord>>
|
fun listByBorrower(borrower: String): Mono<List<BorrowRecord>>
|
||||||
fun listByStatus(status: String): Mono<List<BorrowRecord>>
|
fun listByStatus(status: String): Mono<List<BorrowRecord>>
|
||||||
|
|||||||
@@ -2,10 +2,20 @@ package club.itstudio.itmanager.service
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService
|
import com.baomidou.mybatisplus.extension.service.IService
|
||||||
import club.itstudio.itmanager.entity.dto.FinanceRecord
|
import club.itstudio.itmanager.entity.dto.FinanceRecord
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
||||||
import reactor.core.publisher.Mono
|
import reactor.core.publisher.Mono
|
||||||
|
|
||||||
interface FinanceRecordService : IService<FinanceRecord> {
|
interface FinanceRecordService : IService<FinanceRecord> {
|
||||||
fun getFinanceRecordById(id: Long): Mono<FinanceRecord>
|
fun getFinanceRecordById(id: Long): Mono<FinanceRecord>
|
||||||
|
fun pageFinanceRecords(
|
||||||
|
page: Page<FinanceRecord>,
|
||||||
|
keyword: String?,
|
||||||
|
type: String?,
|
||||||
|
start: String?,
|
||||||
|
end: String?,
|
||||||
|
vendor: String?,
|
||||||
|
itemId: Long?
|
||||||
|
): Mono<Page<FinanceRecord>>
|
||||||
fun listByType(type: String): Mono<List<FinanceRecord>>
|
fun listByType(type: String): Mono<List<FinanceRecord>>
|
||||||
fun listByDateRange(start: String, end: String): Mono<List<FinanceRecord>>
|
fun listByDateRange(start: String, end: String): Mono<List<FinanceRecord>>
|
||||||
fun listByVendor(vendor: String): Mono<List<FinanceRecord>>
|
fun listByVendor(vendor: String): Mono<List<FinanceRecord>>
|
||||||
|
|||||||
+12
@@ -47,6 +47,12 @@ class AccountServiceImpl : ServiceImpl<AccountMapper, Account>(), AccountService
|
|||||||
.one()
|
.one()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun findAccountById(id: Long): Mono<Account> =
|
||||||
|
blockingCall {
|
||||||
|
logger.info("Searching account by id")
|
||||||
|
ktQuery().eq(Account::id, id).one()
|
||||||
|
}
|
||||||
|
|
||||||
override fun findAccountByEmail(email: String): Mono<Account> =
|
override fun findAccountByEmail(email: String): Mono<Account> =
|
||||||
findAccount("email") {
|
findAccount("email") {
|
||||||
ktQuery()
|
ktQuery()
|
||||||
@@ -141,4 +147,10 @@ class AccountServiceImpl : ServiceImpl<AccountMapper, Account>(), AccountService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun createAccount(account: Account): Mono<Boolean> =
|
||||||
|
blockingCall {
|
||||||
|
logger.info("Creating account")
|
||||||
|
save(account)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+6
@@ -42,6 +42,12 @@ class AttachmentServiceImpl : ServiceImpl<AttachmentMapper, Attachment>(), Attac
|
|||||||
save(attachment)
|
save(attachment)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun updateAttachment(attachment: Attachment): Mono<Boolean> =
|
||||||
|
blockingCall {
|
||||||
|
logger.info("Updating attachment")
|
||||||
|
updateById(attachment)
|
||||||
|
}
|
||||||
|
|
||||||
override fun deleteAttachment(id: Long): Mono<Boolean> =
|
override fun deleteAttachment(id: Long): Mono<Boolean> =
|
||||||
blockingCall {
|
blockingCall {
|
||||||
logger.info("Deleting attachment by id")
|
logger.info("Deleting attachment by id")
|
||||||
|
|||||||
+19
@@ -3,6 +3,7 @@ package club.itstudio.itmanager.service.impl
|
|||||||
import club.itstudio.itmanager.entity.dto.BorrowRecord
|
import club.itstudio.itmanager.entity.dto.BorrowRecord
|
||||||
import club.itstudio.itmanager.mapper.BorrowRecordMapper
|
import club.itstudio.itmanager.mapper.BorrowRecordMapper
|
||||||
import club.itstudio.itmanager.service.BorrowRecordService
|
import club.itstudio.itmanager.service.BorrowRecordService
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
@@ -24,6 +25,24 @@ class BorrowRecordServiceImpl : ServiceImpl<BorrowRecordMapper, BorrowRecord>(),
|
|||||||
ktQuery().eq(BorrowRecord::id, id).one()
|
ktQuery().eq(BorrowRecord::id, id).one()
|
||||||
}.switchIfEmpty(Mono.error(NoSuchElementException("BorrowRecord not found")))
|
}.switchIfEmpty(Mono.error(NoSuchElementException("BorrowRecord not found")))
|
||||||
|
|
||||||
|
override fun pageUsages(
|
||||||
|
page: Page<BorrowRecord>,
|
||||||
|
keyword: String?,
|
||||||
|
status: String?
|
||||||
|
): Mono<Page<BorrowRecord>> =
|
||||||
|
blockingCall {
|
||||||
|
logger.info("Paging borrow records")
|
||||||
|
val wrapper = ktQuery()
|
||||||
|
if (!keyword.isNullOrBlank()) {
|
||||||
|
wrapper.like(BorrowRecord::borrower, keyword)
|
||||||
|
}
|
||||||
|
if (!status.isNullOrBlank()) {
|
||||||
|
wrapper.eq(BorrowRecord::status, status)
|
||||||
|
}
|
||||||
|
wrapper.orderByDesc(BorrowRecord::createdAt)
|
||||||
|
page(page, wrapper)
|
||||||
|
}
|
||||||
|
|
||||||
override fun listByItem(itemId: Long): Mono<List<BorrowRecord>> =
|
override fun listByItem(itemId: Long): Mono<List<BorrowRecord>> =
|
||||||
blockingCall {
|
blockingCall {
|
||||||
logger.info("Searching borrow records by item id")
|
logger.info("Searching borrow records by item id")
|
||||||
|
|||||||
+39
@@ -3,6 +3,7 @@ package club.itstudio.itmanager.service.impl
|
|||||||
import club.itstudio.itmanager.entity.dto.FinanceRecord
|
import club.itstudio.itmanager.entity.dto.FinanceRecord
|
||||||
import club.itstudio.itmanager.mapper.FinanceRecordMapper
|
import club.itstudio.itmanager.mapper.FinanceRecordMapper
|
||||||
import club.itstudio.itmanager.service.FinanceRecordService
|
import club.itstudio.itmanager.service.FinanceRecordService
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
@@ -24,6 +25,44 @@ class FinanceRecordServiceImpl : ServiceImpl<FinanceRecordMapper, FinanceRecord>
|
|||||||
ktQuery().eq(FinanceRecord::id, id).one()
|
ktQuery().eq(FinanceRecord::id, id).one()
|
||||||
}.switchIfEmpty(Mono.error(NoSuchElementException("FinanceRecord not found")))
|
}.switchIfEmpty(Mono.error(NoSuchElementException("FinanceRecord not found")))
|
||||||
|
|
||||||
|
override fun pageFinanceRecords(
|
||||||
|
page: Page<FinanceRecord>,
|
||||||
|
keyword: String?,
|
||||||
|
type: String?,
|
||||||
|
start: String?,
|
||||||
|
end: String?,
|
||||||
|
vendor: String?,
|
||||||
|
itemId: Long?
|
||||||
|
): Mono<Page<FinanceRecord>> =
|
||||||
|
blockingCall {
|
||||||
|
logger.info("Paging finance records")
|
||||||
|
val wrapper = ktQuery()
|
||||||
|
if (!keyword.isNullOrBlank()) {
|
||||||
|
wrapper.and {
|
||||||
|
it.like(FinanceRecord::recordNo, keyword)
|
||||||
|
.or().like(FinanceRecord::vendor, keyword)
|
||||||
|
.or().like(FinanceRecord::note, keyword)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!type.isNullOrBlank()) {
|
||||||
|
wrapper.eq(FinanceRecord::type, type)
|
||||||
|
}
|
||||||
|
if (!start.isNullOrBlank() && !end.isNullOrBlank()) {
|
||||||
|
wrapper.apply("occurred_at BETWEEN {0} AND {1}", start, end)
|
||||||
|
} else if (!start.isNullOrBlank()) {
|
||||||
|
wrapper.ge(FinanceRecord::occurredAt, start)
|
||||||
|
} else if (!end.isNullOrBlank()) {
|
||||||
|
wrapper.le(FinanceRecord::occurredAt, end)
|
||||||
|
}
|
||||||
|
if (!vendor.isNullOrBlank()) {
|
||||||
|
wrapper.eq(FinanceRecord::vendor, vendor)
|
||||||
|
}
|
||||||
|
if (itemId != null) {
|
||||||
|
wrapper.eq(FinanceRecord::relatedItemId, itemId)
|
||||||
|
}
|
||||||
|
page(page, wrapper)
|
||||||
|
}
|
||||||
|
|
||||||
override fun listByType(type: String): Mono<List<FinanceRecord>> =
|
override fun listByType(type: String): Mono<List<FinanceRecord>> =
|
||||||
blockingCall {
|
blockingCall {
|
||||||
logger.info("Searching finance records by type")
|
logger.info("Searching finance records by type")
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ class AuthorizationService(
|
|||||||
isStaff = false,
|
isStaff = false,
|
||||||
createdAt = getCurrentDateTime()
|
createdAt = getCurrentDateTime()
|
||||||
)
|
)
|
||||||
Mono.fromCallable { accountService.save(account) }
|
accountService.createAccount(account)
|
||||||
.flatMap { success ->
|
.flatMap { success ->
|
||||||
if (success) {
|
if (success) {
|
||||||
stringRedisTemplate.delete(Const.VERIFY_EMAIL_DATA + email)
|
stringRedisTemplate.delete(Const.VERIFY_EMAIL_DATA + email)
|
||||||
|
|||||||
+2
-40
@@ -49,46 +49,9 @@ class FinanceApiService(
|
|||||||
itemId: Long?
|
itemId: Long?
|
||||||
): Mono<Page<FinanceRecord>> {
|
): Mono<Page<FinanceRecord>> {
|
||||||
logger.info("Listing finance records")
|
logger.info("Listing finance records")
|
||||||
return pageFinanceRecords(page, keyword, type, start, end, vendor, itemId)
|
return financeRecordService.pageFinanceRecords(page, keyword, type, start, end, vendor, itemId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun pageFinanceRecords(
|
|
||||||
page: Page<FinanceRecord>,
|
|
||||||
keyword: String?,
|
|
||||||
type: String?,
|
|
||||||
start: String?,
|
|
||||||
end: String?,
|
|
||||||
vendor: String?,
|
|
||||||
itemId: Long?
|
|
||||||
): Mono<Page<FinanceRecord>> =
|
|
||||||
Mono.fromCallable {
|
|
||||||
val wrapper = financeRecordService.ktQuery()
|
|
||||||
if (!keyword.isNullOrBlank()) {
|
|
||||||
wrapper.and {
|
|
||||||
it.like(FinanceRecord::recordNo, keyword)
|
|
||||||
.or().like(FinanceRecord::vendor, keyword)
|
|
||||||
.or().like(FinanceRecord::note, keyword)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!type.isNullOrBlank()) {
|
|
||||||
wrapper.eq(FinanceRecord::type, type)
|
|
||||||
}
|
|
||||||
if (!start.isNullOrBlank() && !end.isNullOrBlank()) {
|
|
||||||
wrapper.apply("occurred_at BETWEEN {0} AND {1}", start, end)
|
|
||||||
} else if (!start.isNullOrBlank()) {
|
|
||||||
wrapper.ge(FinanceRecord::occurredAt, start)
|
|
||||||
} else if (!end.isNullOrBlank()) {
|
|
||||||
wrapper.le(FinanceRecord::occurredAt, end)
|
|
||||||
}
|
|
||||||
if (!vendor.isNullOrBlank()) {
|
|
||||||
wrapper.eq(FinanceRecord::vendor, vendor)
|
|
||||||
}
|
|
||||||
if (itemId != null) {
|
|
||||||
wrapper.eq(FinanceRecord::relatedItemId, itemId)
|
|
||||||
}
|
|
||||||
financeRecordService.page(page, wrapper)
|
|
||||||
}.subscribeOn(Schedulers.boundedElastic())
|
|
||||||
|
|
||||||
fun createFinanceRecord(record: FinanceRecord): Mono<String> {
|
fun createFinanceRecord(record: FinanceRecord): Mono<String> {
|
||||||
logger.info("Creating finance record")
|
logger.info("Creating finance record")
|
||||||
val rightNow = getCurrentDateTime()
|
val rightNow = getCurrentDateTime()
|
||||||
@@ -253,8 +216,7 @@ class FinanceApiService(
|
|||||||
|
|
||||||
private fun sendFinanceDeleteNotification(record: FinanceRecord): Mono<Void> {
|
private fun sendFinanceDeleteNotification(record: FinanceRecord): Mono<Void> {
|
||||||
val recordedBy = record.recordedBy ?: return Mono.empty()
|
val recordedBy = record.recordedBy ?: return Mono.empty()
|
||||||
return Mono.fromCallable { accountService.getById(recordedBy) }
|
return accountService.findAccountById(recordedBy)
|
||||||
.subscribeOn(Schedulers.boundedElastic())
|
|
||||||
.flatMap { account ->
|
.flatMap { account ->
|
||||||
val email = account.email
|
val email = account.email
|
||||||
if (email.isNullOrBlank()) {
|
if (email.isNullOrBlank()) {
|
||||||
|
|||||||
@@ -262,8 +262,7 @@ class ItemsApiService(
|
|||||||
fun updateItemImage(attachment: Attachment): Mono<String> {
|
fun updateItemImage(attachment: Attachment): Mono<String> {
|
||||||
logger.info("Updating item image")
|
logger.info("Updating item image")
|
||||||
if (attachment.id == null) return Mono.just("item image id is required.")
|
if (attachment.id == null) return Mono.just("item image id is required.")
|
||||||
return Mono.fromCallable { attachmentService.updateById(attachment) }
|
return attachmentService.updateAttachment(attachment)
|
||||||
.subscribeOn(Schedulers.boundedElastic())
|
|
||||||
.flatMap { success ->
|
.flatMap { success ->
|
||||||
if (success) Mono.just("")
|
if (success) Mono.just("")
|
||||||
else Mono.just("item image update failed.")
|
else Mono.just("item image update failed.")
|
||||||
|
|||||||
+1
-2
@@ -41,8 +41,7 @@ class ProofImagesApiService(
|
|||||||
fun updateProofImage(attachment: Attachment): Mono<String> {
|
fun updateProofImage(attachment: Attachment): Mono<String> {
|
||||||
logger.info("Updating proof image")
|
logger.info("Updating proof image")
|
||||||
if (attachment.id == null) return Mono.just("proof image id is required.")
|
if (attachment.id == null) return Mono.just("proof image id is required.")
|
||||||
return Mono.fromCallable { attachmentService.updateById(attachment) }
|
return attachmentService.updateAttachment(attachment)
|
||||||
.subscribeOn(Schedulers.boundedElastic())
|
|
||||||
.flatMap { success ->
|
.flatMap { success ->
|
||||||
if (success) Mono.just("")
|
if (success) Mono.just("")
|
||||||
else Mono.just("proof image update failed.")
|
else Mono.just("proof image update failed.")
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import club.itstudio.itmanager.service.AttachmentService
|
|||||||
import club.itstudio.itmanager.service.BorrowRecordService
|
import club.itstudio.itmanager.service.BorrowRecordService
|
||||||
import club.itstudio.itmanager.utils.Const
|
import club.itstudio.itmanager.utils.Const
|
||||||
import club.itstudio.itmanager.utils.DateUtils.getCurrentDateTime
|
import club.itstudio.itmanager.utils.DateUtils.getCurrentDateTime
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.beans.factory.annotation.Value
|
import org.springframework.beans.factory.annotation.Value
|
||||||
@@ -33,17 +32,7 @@ class UsagesApiService(
|
|||||||
|
|
||||||
fun getUsages(page: Page<BorrowRecord>, keyword: String?, status: String?): Mono<Page<BorrowRecord>> {
|
fun getUsages(page: Page<BorrowRecord>, keyword: String?, status: String?): Mono<Page<BorrowRecord>> {
|
||||||
logger.info("Paging usages with keyword and status")
|
logger.info("Paging usages with keyword and status")
|
||||||
return Mono.fromCallable {
|
return borrowRecordService.pageUsages(page, keyword, status)
|
||||||
val wrapper = Wrappers.lambdaQuery<BorrowRecord>()
|
|
||||||
if (!keyword.isNullOrBlank()) {
|
|
||||||
wrapper.like(BorrowRecord::borrower, keyword)
|
|
||||||
}
|
|
||||||
if (!status.isNullOrBlank()) {
|
|
||||||
wrapper.eq(BorrowRecord::status, status)
|
|
||||||
}
|
|
||||||
wrapper.orderByDesc(BorrowRecord::createdAt)
|
|
||||||
borrowRecordService.page(page, wrapper)
|
|
||||||
}.subscribeOn(Schedulers.boundedElastic())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createUsage(record: BorrowRecord): Mono<String> {
|
fun createUsage(record: BorrowRecord): Mono<String> {
|
||||||
@@ -145,8 +134,7 @@ class UsagesApiService(
|
|||||||
fun updateUsageImage(attachment: Attachment): Mono<String> {
|
fun updateUsageImage(attachment: Attachment): Mono<String> {
|
||||||
logger.info("Updating usage image")
|
logger.info("Updating usage image")
|
||||||
if (attachment.id == null) return Mono.just("usage image id is required.")
|
if (attachment.id == null) return Mono.just("usage image id is required.")
|
||||||
return Mono.fromCallable { attachmentService.updateById(attachment) }
|
return attachmentService.updateAttachment(attachment)
|
||||||
.subscribeOn(Schedulers.boundedElastic())
|
|
||||||
.flatMap { success ->
|
.flatMap { success ->
|
||||||
if (success) Mono.just("")
|
if (success) Mono.just("")
|
||||||
else Mono.just("usage image update failed.")
|
else Mono.just("usage image update failed.")
|
||||||
|
|||||||
Reference in New Issue
Block a user