-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
473 additions
and
187 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
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/io/github/smaugfm/monobudget/common/account/TransferCache.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.github.smaugfm.monobudget.common.account | ||
|
||
import io.github.smaugfm.monobudget.common.misc.ConcurrentExpiringMap | ||
import io.github.smaugfm.monobudget.common.model.financial.StatementItem | ||
import kotlinx.coroutines.Deferred | ||
import kotlin.time.Duration.Companion.minutes | ||
|
||
abstract class TransferCache<TTransaction> : | ||
ConcurrentExpiringMap<StatementItem, Deferred<TTransaction>>(1.minutes) |
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
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
2 changes: 0 additions & 2 deletions
2
src/main/kotlin/io/github/smaugfm/monobudget/common/util/JsonUtils.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
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
25 changes: 0 additions & 25 deletions
25
.../io/github/smaugfm/monobudget/lunchmoney/LunchmoneyMonoTransferBetweenAccountsDetector.kt
This file was deleted.
Oops, something went wrong.
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
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/io/github/smaugfm/monobudget/lunchmoney/LunchmoneyTransferCache.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.github.smaugfm.monobudget.lunchmoney | ||
|
||
import io.github.smaugfm.lunchmoney.model.LunchmoneyTransaction | ||
import io.github.smaugfm.monobudget.common.account.TransferCache | ||
import org.koin.core.annotation.Single | ||
|
||
@Single | ||
class LunchmoneyTransferCache : TransferCache<LunchmoneyTransaction>() |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/io/github/smaugfm/monobudget/lunchmoney/LunchmoneyTransferDetector.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.github.smaugfm.monobudget.lunchmoney | ||
|
||
import io.github.smaugfm.lunchmoney.model.LunchmoneyTransaction | ||
import io.github.smaugfm.monobudget.common.account.BankAccountService | ||
import io.github.smaugfm.monobudget.common.account.TransferDetector | ||
import io.github.smaugfm.monobudget.common.lifecycle.StatementProcessingContext | ||
import io.github.smaugfm.monobudget.common.lifecycle.StatementProcessingScopeComponent | ||
import org.koin.core.annotation.Scope | ||
import org.koin.core.annotation.Scoped | ||
|
||
@Scoped | ||
@Scope(StatementProcessingScopeComponent::class) | ||
class LunchmoneyTransferDetector( | ||
bankAccounts: BankAccountService, | ||
ctx: StatementProcessingContext, | ||
cache: LunchmoneyTransferCache, | ||
) : TransferDetector<LunchmoneyTransaction>(bankAccounts, ctx, cache) |
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
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/io/github/smaugfm/monobudget/ynab/YnabTransferCache.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.github.smaugfm.monobudget.ynab | ||
|
||
import io.github.smaugfm.monobudget.common.account.TransferCache | ||
import io.github.smaugfm.monobudget.ynab.model.YnabTransactionDetail | ||
import org.koin.core.annotation.Single | ||
|
||
@Single | ||
class YnabTransferCache : TransferCache<YnabTransactionDetail>() |
18 changes: 5 additions & 13 deletions
18
...nabMonoTransferBetweenAccountsDetector.kt → ...m/monobudget/ynab/YnabTransferDetector.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,29 +1,21 @@ | ||
package io.github.smaugfm.monobudget.ynab | ||
|
||
import io.github.smaugfm.monobudget.common.account.BankAccountService | ||
import io.github.smaugfm.monobudget.common.account.TransferBetweenAccountsDetector | ||
import io.github.smaugfm.monobudget.common.account.TransferDetector | ||
import io.github.smaugfm.monobudget.common.lifecycle.StatementProcessingContext | ||
import io.github.smaugfm.monobudget.common.lifecycle.StatementProcessingScopeComponent | ||
import io.github.smaugfm.monobudget.common.misc.ConcurrentExpiringMap | ||
import io.github.smaugfm.monobudget.common.model.financial.StatementItem | ||
import io.github.smaugfm.monobudget.ynab.model.YnabTransactionDetail | ||
import kotlinx.coroutines.Deferred | ||
import org.koin.core.annotation.Scope | ||
import org.koin.core.annotation.Scoped | ||
import kotlin.time.Duration.Companion.minutes | ||
|
||
@Scoped | ||
@Scope(StatementProcessingScopeComponent::class) | ||
class YnabMonoTransferBetweenAccountsDetector( | ||
class YnabTransferDetector( | ||
bankAccounts: BankAccountService, | ||
ctx: StatementProcessingContext, | ||
) : TransferBetweenAccountsDetector<YnabTransactionDetail>( | ||
cache: YnabTransferCache, | ||
) : TransferDetector<YnabTransactionDetail>( | ||
bankAccounts, | ||
ctx, | ||
cache, | ||
) { | ||
companion object { | ||
private val cache = | ||
ConcurrentExpiringMap<StatementItem, Deferred<YnabTransactionDetail>>(1.minutes) | ||
} | ||
} | ||
) |
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
Oops, something went wrong.