Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Fix issue 2762 #2926

Merged
merged 35 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2168fcc
implemented local transaction datasource
Rick-AB Oct 24, 2023
06c8b6e
implement transaction mapper
Rick-AB Oct 24, 2023
59158c5
update transaction mapper to use new transaction model
Rick-AB Oct 25, 2023
f1a4fbb
added functions for explicit transaction models
Rick-AB Oct 25, 2023
03a9415
implemented functions for explicit transaction models
Rick-AB Oct 25, 2023
43cc621
updated transaction mapper
Rick-AB Oct 25, 2023
07c9e98
updated transaction mapper
Rick-AB Oct 25, 2023
a10dfeb
removed redundant functions in transaction repo
Rick-AB Oct 25, 2023
eee5c89
updated transaction model
Rick-AB Oct 26, 2023
c277b5a
updated transaction mapper
Rick-AB Oct 26, 2023
eab49be
added transaction mapper test
Rick-AB Oct 26, 2023
61d8b49
fixed function return type
Rick-AB Oct 26, 2023
cb1e0c9
implemented fake transaction repository
Rick-AB Oct 26, 2023
1d26e82
updated transaction repo to include transfer target account asset code
Rick-AB Jan 31, 2024
890cf23
updated transaction mapper
Rick-AB Feb 1, 2024
01f1bb7
transaction repo impl test
Rick-AB Feb 4, 2024
576f282
transaction mapper update
Rick-AB Feb 4, 2024
9889c29
fake transaction repo test stub
Rick-AB Feb 4, 2024
14edbd1
update fake transaction repo
Rick-AB Feb 6, 2024
3fadc70
fake transaction repo test impl
Rick-AB Feb 6, 2024
df852a2
Merge branch 'main' into fix-issue-2762
Rick-AB Feb 7, 2024
f6d8cce
update transaction mapper to include accountId
Rick-AB Feb 7, 2024
ce0d590
update transaction mapper test to include accountId
Rick-AB Feb 7, 2024
8ebf3f6
update transaction repo impl test to include accountId
Rick-AB Feb 7, 2024
0780325
update fake transaction repo test to include accountId
Rick-AB Feb 7, 2024
91d1522
removed fake transaction repo test
Rick-AB Feb 8, 2024
e652102
removed transaction datasource
Rick-AB Feb 8, 2024
6bd5770
update transaction mapper
Rick-AB Feb 8, 2024
0dc2c1b
update transaction mapper test
Rick-AB Feb 8, 2024
5520af9
update transaction impl test
Rick-AB Feb 8, 2024
8011fcc
implemented fake transaction dao
Rick-AB Feb 8, 2024
4c38863
removed fake transaction repository
Rick-AB Feb 8, 2024
cbd3e6b
fixed detekt issues
Rick-AB Feb 8, 2024
ce16ce7
removed unnecessary parameters in transaction repo impl
Rick-AB Feb 8, 2024
29e1854
clear detekt errors
Rick-AB Feb 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ILIYANGERMANOV marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

ILIYANGERMANOV marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions shared/data/src/main/java/com/ivy/data/model/Transaction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ data class Transfer(
) : Transaction

data class TransactionMetadata(
val recurringRuleId: UUID,
val recurringRuleId: UUID?,
// This refers to the loan id that is linked with a transaction
val loanId: UUID? = null,
// This refers to the loan record id that is linked with a transaction
val loanRecordId: UUID,
)
val loanRecordId: UUID?,
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,237 @@
package com.ivy.data.repository

import com.ivy.data.model.AccountId
import com.ivy.data.model.CategoryId
import com.ivy.data.model.Expense
import com.ivy.data.model.Income
import com.ivy.data.model.Transaction
import com.ivy.data.model.TransactionId
import com.ivy.data.model.Transfer
import java.time.LocalDateTime
import java.util.UUID

interface TransactionRepository {
// TODO: Implement

suspend fun findAll(): List<Transaction>

suspend fun findAll_LIMIT_1(): List<Transaction>

suspend fun findAllIncome(): List<Income>

suspend fun findAllExpense(): List<Expense>

suspend fun findAllTransfer(): List<Transfer>

suspend fun findAllIncomeByAccount(accountId: AccountId): List<Income>

suspend fun findAllExpenseByAccount(accountId: AccountId): List<Expense>

suspend fun findAllTransferByAccount(accountId: AccountId): List<Transfer>

suspend fun findAllIncomeByAccountBetween(
accountId: AccountId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Income>

suspend fun findAllExpenseByAccountBetween(
accountId: AccountId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Expense>

suspend fun findAllTransferByAccountBetween(
accountId: AccountId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transfer>

suspend fun findAllTransfersToAccount(
toAccountId: AccountId,
): List<Transfer>

suspend fun findAllTransfersToAccountBetween(
toAccountId: AccountId,
startDate: LocalDateTime,
endDate: LocalDateTime,
): List<Transfer>

suspend fun findAllBetween(
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transaction>


suspend fun findAllByAccountAndBetween(
accountId: AccountId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transaction>


suspend fun findAllByCategoryAndBetween(
categoryId: CategoryId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transaction>


suspend fun findAllUnspecifiedAndBetween(
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transaction>

suspend fun findAllIncomeByCategoryAndBetween(
categoryId: CategoryId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Income>

suspend fun findAllExpenseByCategoryAndBetween(
categoryId: CategoryId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Expense>

suspend fun findAllTransferByCategoryAndBetween(
categoryId: CategoryId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transfer>

suspend fun findAllUnspecifiedIncomeAndBetween(
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Income>

suspend fun findAllUnspecifiedExpenseAndBetween(
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Expense>

suspend fun findAllUnspecifiedTransferAndBetween(
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transfer>

suspend fun findAllToAccountAndBetween(
toAccountId: AccountId,
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transaction>


suspend fun findAllDueToBetween(
startDate: LocalDateTime,
endDate: LocalDateTime
): List<Transaction>


suspend fun findAllDueToBetweenByCategory(
startDate: LocalDateTime,
endDate: LocalDateTime,
categoryId: CategoryId
): List<Transaction>


suspend fun findAllDueToBetweenByCategoryUnspecified(
startDate: LocalDateTime,
endDate: LocalDateTime,
): List<Transaction>


suspend fun findAllDueToBetweenByAccount(
startDate: LocalDateTime,
endDate: LocalDateTime,
accountId: AccountId
): List<Transaction>


suspend fun findAllByRecurringRuleId(recurringRuleId: UUID): List<Transaction>

suspend fun findAllIncomeBetween(
startDate: LocalDateTime,
endDate: LocalDateTime,
): List<Income>

suspend fun findAllExpenseBetween(
startDate: LocalDateTime,
endDate: LocalDateTime,
): List<Expense>

suspend fun findAllTransferBetween(
startDate: LocalDateTime,
endDate: LocalDateTime,
): List<Transfer>

suspend fun findAllBetweenAndRecurringRuleId(
startDate: LocalDateTime,
endDate: LocalDateTime,
recurringRuleId: UUID
): List<Transaction>

suspend fun findById(id: TransactionId): Transaction?

suspend fun findByIsSyncedAndIsDeleted(
synced: Boolean,
deleted: Boolean = false
): List<Transaction>

suspend fun countHappenedTransactions(): Long

suspend fun findAllByTitleMatchingPattern(pattern: String): List<Transaction>

suspend fun countByTitleMatchingPattern(
pattern: String,
): Long

suspend fun findAllByCategory(
categoryId: CategoryId,
): List<Transaction>

suspend fun countByTitleMatchingPatternAndCategoryId(
pattern: String,
categoryId: CategoryId
): Long


suspend fun findAllByAccount(
accountId: AccountId
): List<Transaction>


suspend fun countByTitleMatchingPatternAndAccountId(
pattern: String,
accountId: AccountId
): Long


suspend fun findLoanTransaction(
loanId: UUID
): Transaction?


suspend fun findLoanRecordTransaction(
loanRecordId: UUID
): Transaction?


suspend fun findAllByLoanId(
loanId: UUID
): List<Transaction>

suspend fun save(accountId: AccountId, value: Transaction)

suspend fun saveMany(accountId: AccountId, value: List<Transaction>)

suspend fun flagDeleted(id: TransactionId)
suspend fun flagDeletedByRecurringRuleIdAndNoDateTime(recurringRuleId: UUID)

suspend fun flagDeletedByAccountId(accountId: AccountId)

suspend fun deleteById(id: TransactionId)

suspend fun deleteAllByAccountId(accountId: AccountId)

suspend fun deleteAll()
}
Loading
Loading