bugfix for budgets

This commit is contained in:
GEXCE
2020-01-07 17:02:49 +01:00
parent 95d0b7b285
commit 419a0dce32
@@ -21,12 +21,12 @@ public interface CategoryRepository extends PagingAndSortingRepository<Category,
// http://localhost:8084/api/categories/search/expenseLevelYear?accountId=1&categoryId=1
@RestResource(path = "expenseLevelYear")
@Query("SELECT sum(t.amount) FROM Transaction t WHERE t.account.id = :accountId AND t.category.id = :categoryId and DATE > (CURRENT_DATE() - DAY_OF_YEAR(CURRENT_DATE()))")
@Query("SELECT sum(t.amount) FROM Transaction t WHERE t.account.id = :accountId AND t.category.id = :categoryId and DATE > (CURRENT_DATE() - DAY_OF_YEAR(CURRENT_DATE()) + 1)")
Double getYearExpenseLevelForCategory(@Param("accountId") Long accountId, @Param("categoryId") Long categoryId);
// http://localhost:8084/api/categories/search/expenseLevelMonth?accountId=2&categoryId=5
@RestResource(path = "expenseLevelMonth")
@Query("SELECT sum(t.amount) FROM Transaction t WHERE t.account.id = :accountId AND t.category.id = :categoryId and DATE > (CURRENT_DATE() - DAY_OF_MONTH(CURRENT_DATE()))")
@Query("SELECT sum(t.amount) FROM Transaction t WHERE t.account.id = :accountId AND t.category.id = :categoryId and DATE > (CURRENT_DATE() - DAY_OF_MONTH(CURRENT_DATE()) + 1)")
Double getMonthExpenseLevelForCategory(@Param("accountId") Long accountId, @Param("categoryId") Long categoryId);
@PreAuthorize("hasRole('ROLE_ADMIN')")