Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package com.example.budgeting.android.data.model
data class ExpenseFilters(
val search: String = "",
val category: String = "All",
val sortOption: SortOption = SortOption.NEWEST
val sortOption: SortOption = SortOption.NEWEST,
val minAmount: Float? = null,
val maxAmount: Float? = null,
val startDate: String? = null,
val endDate: String? = null
)

enum class SortOption(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ interface ExpenseApiService {
@Query("category") category: String? = null,
@Query("sort_by") sortBy: String? = "created_at",
@Query("order") order: String? = "desc",
@Query("offset") offset: Int? = 0,
@Query("limit") limit: Int? = 100,
@Query("min_price") minPrice: Float? = null,
@Query("max_price") maxPrice: Float? = null,
@Query("date_from") dateFrom: String? = null,
@Query("date_to") dateTo: String? = null
): Response<ApiResponse<List<Expense>>>
Expand All @@ -30,6 +34,10 @@ interface ExpenseApiService {
@Query("category") category: String? = null,
@Query("sort_by") sortBy: String? = "created_at",
@Query("order") order: String? = "desc",
@Query("offset") offset: Int? = 0,
@Query("limit") limit: Int? = 100,
@Query("min_price") minPrice: Float? = null,
@Query("max_price") maxPrice: Float? = null,
@Query("date_from") dateFrom: String? = null,
@Query("date_to") dateTo: String? = null
): Response<ApiResponse<List<Expense>>>
Expand All @@ -43,6 +51,10 @@ interface ExpenseApiService {
@Query("category") category: String? = null,
@Query("sort_by") sortBy: String? = "created_at",
@Query("order") order: String? = "desc",
@Query("offset") offset: Int? = 0,
@Query("limit") limit: Int? = 100,
@Query("min_price") minPrice: Float? = null,
@Query("max_price") maxPrice: Float? = null,
@Query("date_from") dateFrom: String? = null,
@Query("date_to") dateTo: String? = null
): Response<ApiResponse<List<Expense>>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class ExpenseRepository(
category: String?,
sortBy: String?,
order: String?,
offset: Int?,
limit: Int?,
minPrice: Float?,
maxPrice: Float?,
dateFrom: String?,
dateTo: String?
): List<Expense> {
Expand All @@ -25,6 +29,10 @@ class ExpenseRepository(
category = category,
sortBy = sortBy,
order = order,
offset = offset,
limit = limit,
minPrice = minPrice,
maxPrice = maxPrice,
dateFrom = dateFrom,
dateTo = dateTo
).body()?.data ?: throw Exception("Failed to fetch expenses")
Expand All @@ -37,13 +45,21 @@ class ExpenseRepository(
category: String?,
sortBy: String?,
order: String?,
offset: Int?,
limit: Int?,
minPrice: Float?,
maxPrice: Float?,
dateFrom: String?,
dateTo: String?
): List<Expense> {
return api.getAllExpenses(
category = category,
sortBy = sortBy,
order = order,
offset = offset,
limit = limit,
minPrice = minPrice,
maxPrice = maxPrice,
dateFrom = dateFrom,
dateTo = dateTo
).body()?.data ?: throw Exception("Failed to fetch expenses")
Expand All @@ -57,6 +73,10 @@ class ExpenseRepository(
category: String?,
sortBy: String?,
order: String?,
offset: Int?,
limit: Int?,
minPrice: Float?,
maxPrice: Float?,
dateFrom: String?,
dateTo: String?
): List<Expense> {
Expand All @@ -65,6 +85,10 @@ class ExpenseRepository(
category = category,
sortBy = sortBy,
order = order,
offset = offset,
limit = limit,
minPrice = minPrice,
maxPrice = maxPrice,
dateFrom = dateFrom,
dateTo = dateTo
).body()?.data ?: throw Exception("Failed to fetch expenses")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ fun AnalyticsContent(
CategoryCountBarChart(categoryCounts)
}

AnalyticsCard("Total amount per category") {
AnalyticsCard("Spending by category") {
CategoryAmountBarChart(categoryAmounts)
}

AnalyticsCard("Monthly trend") {
AnalyticsCard("Spending over time") {
MonthlyLineChart(monthlyTotals)
}
}
Expand Down
Loading
Loading