mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 15:37:33 +08:00
data management page shows all user data statistics
This commit is contained in:
@@ -30,6 +30,17 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// GetTotalAccountCountByUid returns total account count of user
|
||||
func (s *AccountService) GetTotalAccountCountByUid(uid int64) (int64, error) {
|
||||
if uid <= 0 {
|
||||
return 0, errs.ErrUserIdInvalid
|
||||
}
|
||||
|
||||
count, err := s.UserDataDB(uid).Where("uid=? AND deleted=?", uid, false).Count(&models.Account{})
|
||||
|
||||
return count, err
|
||||
}
|
||||
|
||||
// GetAllAccountsByUid returns all account models of user
|
||||
func (s *AccountService) GetAllAccountsByUid(uid int64) ([]*models.Account, error) {
|
||||
if uid <= 0 {
|
||||
|
||||
@@ -29,6 +29,17 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// GetTotalCategoryCountByUid returns total category count of user
|
||||
func (s *TransactionCategoryService) GetTotalCategoryCountByUid(uid int64) (int64, error) {
|
||||
if uid <= 0 {
|
||||
return 0, errs.ErrUserIdInvalid
|
||||
}
|
||||
|
||||
count, err := s.UserDataDB(uid).Where("uid=? AND deleted=?", uid, false).Count(&models.TransactionCategory{})
|
||||
|
||||
return count, err
|
||||
}
|
||||
|
||||
// GetAllCategoriesByUid returns all transaction category models of user
|
||||
func (s *TransactionCategoryService) GetAllCategoriesByUid(uid int64, categoryType models.TransactionCategoryType, parentCategoryId int64) ([]*models.TransactionCategory, error) {
|
||||
if uid <= 0 {
|
||||
|
||||
@@ -29,6 +29,17 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// GetTotalTagCountByUid returns total tag count of user
|
||||
func (s *TransactionTagService) GetTotalTagCountByUid(uid int64) (int64, error) {
|
||||
if uid <= 0 {
|
||||
return 0, errs.ErrUserIdInvalid
|
||||
}
|
||||
|
||||
count, err := s.UserDataDB(uid).Where("uid=? AND deleted=?", uid, false).Count(&models.TransactionTag{})
|
||||
|
||||
return count, err
|
||||
}
|
||||
|
||||
// GetAllTagsByUid returns all transaction tag models of user
|
||||
func (s *TransactionTagService) GetAllTagsByUid(uid int64) ([]*models.TransactionTag, error) {
|
||||
if uid <= 0 {
|
||||
|
||||
@@ -32,6 +32,17 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// GetTotalTransactionCountByUid returns total transaction count of user
|
||||
func (s *TransactionService) GetTotalTransactionCountByUid(uid int64) (int64, error) {
|
||||
if uid <= 0 {
|
||||
return 0, errs.ErrUserIdInvalid
|
||||
}
|
||||
|
||||
count, err := s.UserDataDB(uid).Where("uid=? AND deleted=?", uid, false).Count(&models.Transaction{})
|
||||
|
||||
return count, err
|
||||
}
|
||||
|
||||
// GetAllTransactions returns all transactions
|
||||
func (s *TransactionService) GetAllTransactions(uid int64, pageCount int32, noDuplicated bool) ([]*models.Transaction, error) {
|
||||
maxTransactionTime := utils.GetMaxTransactionTimeFromUnixTime(time.Now().Unix())
|
||||
|
||||
Reference in New Issue
Block a user