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

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
walnuts1018 committed Nov 3, 2023
1 parent baf11d4 commit 9ab1bb7
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions back/usecase/usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ func (u Usecase) NewUser(userid string) (domain.User, error) {
return user, nil
}

func (u Usecase) GetUser(userID string) (domain.User, error) {
return u.db.GetUser(userID)
}

func (u Usecase) NewMoneyPool(moneyPoolName, moneyPoolColor, userID string, isWorldPublic bool) (domain.MoneyPool, error) {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
moneyPoolID := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%v%v%v", moneyPoolName, userID, r.Int63())))
Expand Down Expand Up @@ -62,51 +58,3 @@ func (u Usecase) NewMoneyPool(moneyPoolName, moneyPoolColor, userID string, isWo
}
return moneyPool, nil
}

func (u Usecase) GetMoneyPool(moneyPoolID string) (domain.MoneyPool, error) {
return u.db.GetMoneyPool(moneyPoolID)
}

func (u Usecase) GetMoneyPoolsByUser(user domain.User) ([]domain.MoneyPool, error) {
return u.db.GetMoneyPoolsByUsers(user)
}

func (u Usecase) UpdateMoneyPool(moneyPool domain.MoneyPool) error {
return u.db.UpdateMoneyPool(moneyPool)
}

func (u Usecase) NewTransaction(transaction domain.Transaction, user domain.User) error {
return u.db.NewTransaction(transaction)
}

func (u Usecase) GetTransactionsByTimeRange(UserID string, moneyPoolID string, from time.Time, to time.Time) ([]domain.Transaction, error) {
if moneyPoolID != "" {
PartitioningKeys := []string{}
for t := from; t.Before(to); t = t.AddDate(0, 1, 0) {
PartitioningKeys = append(PartitioningKeys, t.Format("2006-01"))
}
return u.db.GetTransactionsByMoneyPool(moneyPoolID, domain.GetTransactionHints{
PartitioningKeys: PartitioningKeys,
})
} else {
PartitioningKeys := []string{}
for t := from; t.Before(to); t = t.AddDate(0, 1, 0) {
PartitioningKeys = append(PartitioningKeys, t.Format("2006-01"))
}
return u.db.GetTransactionsByUser(UserID, domain.GetTransactionHints{
PartitioningKeys: PartitioningKeys,
})
}
}

func (u Usecase) GetTransaction(transactionID string) (domain.Transaction, error) {
return u.db.GetTransaction(transactionID, domain.GetTransactionHints{})
}

func (u Usecase) UpdateTransaction(transaction domain.Transaction) error {
return u.db.UpdateTransaction(transaction)
}

func (u Usecase) NewItem(item domain.Item, user domain.User) error {
return u.db.NewItem(item)
}

0 comments on commit 9ab1bb7

Please sign in to comment.