Skip to content

Commit 7c7c43b

Browse files
authored
feat: allow requesting egress data for a full year (#42)
1 parent f1f58d6 commit 7c7c43b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

internal/service/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func (s *service) getAccountStats(
265265
return stats, err
266266
}
267267

268-
const maxPeriodDays = 60
268+
const maxPeriodDays = 365
269269

270270
// defaultPeriod returns a period from the first day of the last complete month to today
271271
func defaultPeriod() Period {

internal/service/service_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func TestGetAccountEgress(t *testing.T) {
244244
require.ErrorAs(t, err, &periodErr)
245245
})
246246

247-
t.Run("returns period not acceptable error when period exceeds 60 days", func(t *testing.T) {
247+
t.Run("returns period not acceptable error when period exceeds 365 days", func(t *testing.T) {
248248
accountDID := testutil.RandomDID(t)
249249
space := testutil.RandomDID(t)
250250

@@ -266,7 +266,7 @@ func TestGetAccountEgress(t *testing.T) {
266266
}
267267

268268
from := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC)
269-
to := time.Date(2024, 3, 2, 0, 0, 0, 0, time.UTC) // 61 days
269+
to := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) // 366 days
270270
period := &Period{From: from, To: to}
271271

272272
result, err := svc.GetAccountEgress(context.Background(), accountDID, nil, period)
@@ -275,7 +275,7 @@ func TestGetAccountEgress(t *testing.T) {
275275
require.Nil(t, result)
276276
var periodErr ErrPeriodNotAcceptable
277277
require.ErrorAs(t, err, &periodErr)
278-
assert.Contains(t, periodErr.msg, "60 days")
278+
assert.Contains(t, periodErr.msg, "365 days")
279279
})
280280

281281
t.Run("successfully returns empty result for account with no spaces", func(t *testing.T) {

0 commit comments

Comments
 (0)