Skip to content

Commit

Permalink
fix: left join table name
Browse files Browse the repository at this point in the history
  • Loading branch information
Candinya committed Jun 1, 2024
1 parent 4c3c0d6 commit 7e2af78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/service/hub/model/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (acc *Account) GetUsageByDate(ctx context.Context, since time.Time, until t

err := acc.databaseClient.WithContext(ctx).
Model(&table.GatewayConsumptionLog{}).
Joins("LEFT JOIN gateway.key ON consumption_log.key_id = key.id").
Joins("LEFT JOIN key ON consumption_log.key_id = key.id").
Where("account_address = ? AND consumption_date BETWEEN ? AND ?", acc.Address, since, until).
Select("SUM(ru_used) AS ru_used, SUM(api_calls) AS api_calls, (EXTRACT(EPOCH FROM consumption_date)*1000)::BIGINT AS consumption_date").
Group("consumption_date").
Expand Down

0 comments on commit 7e2af78

Please sign in to comment.