Skip to content

Commit

Permalink
feat: route storage
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Oct 18, 2024
1 parent 5b63f49 commit 1b94951
Show file tree
Hide file tree
Showing 48 changed files with 277 additions and 604 deletions.
26 changes: 17 additions & 9 deletions internal/api/v2/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,53 @@ func getPITOOTFilter(r *http.Request) (*ledgercontroller.PITFilter, error) {
pitString := r.URL.Query().Get("endTime")
ootString := r.URL.Query().Get("startTime")

pit := time.Time{}
oot := time.Time{}
var (
pit *time.Time
oot *time.Time
)

if pitString != "" {
var err error
pit, err = time.ParseTime(pitString)
_pit, err := time.ParseTime(pitString)
if err != nil {
return nil, err
}

pit = &_pit
}

if ootString != "" {
var err error
oot, err = time.ParseTime(ootString)
_oot, err := time.ParseTime(ootString)
if err != nil {
return nil, err
}

oot = &_oot
}

return &ledgercontroller.PITFilter{
PIT: &pit,
OOT: &oot,
PIT: pit,
OOT: oot,
}, nil
}

func getPITFilter(r *http.Request) (*ledgercontroller.PITFilter, error) {
pitString := r.URL.Query().Get("pit")

pit := time.Time{}
var pit *time.Time
if pitString != "" {
var err error
pit, err = time.ParseTime(pitString)
_pit, err := time.ParseTime(pitString)
if err != nil {
return nil, err
}

pit = &_pit
}

return &ledgercontroller.PITFilter{
PIT: &pit,
PIT: pit,
}, nil
}

Expand Down
7 changes: 0 additions & 7 deletions internal/api/v2/controllers_volumes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ func TestGetVolumes(t *testing.T) {
expectedErrorCode string
}
before := time.Now()
zero := time.Time{}

testCases := []testCase{
{
name: "basic",
expectQuery: ledgercontroller.NewPaginatedQueryOptions(ledgercontroller.FiltersForVolumes{
PITFilter: ledgercontroller.PITFilter{
PIT: &before,
OOT: &zero,
},

UseInsertionDate: false,
Expand All @@ -55,7 +53,6 @@ func TestGetVolumes(t *testing.T) {
expectQuery: ledgercontroller.NewPaginatedQueryOptions(ledgercontroller.FiltersForVolumes{
PITFilter: ledgercontroller.PITFilter{
PIT: &before,
OOT: &zero,
},
}).
WithQueryBuilder(query.Match("metadata[roles]", "admin")).
Expand All @@ -67,7 +64,6 @@ func TestGetVolumes(t *testing.T) {
expectQuery: ledgercontroller.NewPaginatedQueryOptions(ledgercontroller.FiltersForVolumes{
PITFilter: ledgercontroller.PITFilter{
PIT: &before,
OOT: &zero,
},
}).
WithQueryBuilder(query.Match("account", "foo")).
Expand All @@ -88,7 +84,6 @@ func TestGetVolumes(t *testing.T) {
expectQuery: ledgercontroller.NewPaginatedQueryOptions(ledgercontroller.FiltersForVolumes{
PITFilter: ledgercontroller.PITFilter{
PIT: &before,
OOT: &zero,
},
GroupLvl: 3,
}).WithPageSize(DefaultPageSize),
Expand All @@ -99,7 +94,6 @@ func TestGetVolumes(t *testing.T) {
expectQuery: ledgercontroller.NewPaginatedQueryOptions(ledgercontroller.FiltersForVolumes{
PITFilter: ledgercontroller.PITFilter{
PIT: &before,
OOT: &zero,
},
}).WithPageSize(DefaultPageSize).WithQueryBuilder(query.Exists("metadata", "foo")),
},
Expand All @@ -109,7 +103,6 @@ func TestGetVolumes(t *testing.T) {
expectQuery: ledgercontroller.NewPaginatedQueryOptions(ledgercontroller.FiltersForVolumes{
PITFilter: ledgercontroller.PITFilter{
PIT: &before,
OOT: &zero,
},
}).WithQueryBuilder(query.Gte("balance[EUR]", float64(50))).
WithPageSize(DefaultPageSize),
Expand Down
34 changes: 0 additions & 34 deletions internal/storage/bucket/old/11-drop-triggers.sql

This file was deleted.

15 changes: 0 additions & 15 deletions internal/storage/bucket/old/12-moves-add-transaction-id.sql

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions internal/storage/bucket/old/15-moves-remove-accounts-seq.sql

This file was deleted.

2 changes: 0 additions & 2 deletions internal/storage/bucket/old/16-transactions-fix-reference.sql

This file was deleted.

23 changes: 0 additions & 23 deletions internal/storage/bucket/old/17-transactions-add-pvc.sql

This file was deleted.

2 changes: 0 additions & 2 deletions internal/storage/bucket/old/18-logs-add-idempotency-hash.sql

This file was deleted.

This file was deleted.

26 changes: 0 additions & 26 deletions internal/storage/bucket/old/20-add-accounts-volumes-table.sql

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions internal/storage/bucket/old/22-accounts-metadata-add-address.sql

This file was deleted.

6 changes: 0 additions & 6 deletions internal/storage/bucket/old/23-transactions-clean-table.sql

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions internal/storage/bucket/old/25-logs-set-hash-nullable.sql

This file was deleted.

12 changes: 0 additions & 12 deletions internal/storage/bucket/old/26-clean-index.sql

This file was deleted.

Loading

0 comments on commit 1b94951

Please sign in to comment.