|
1 | 1 | package data |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "strings" |
| 5 | + |
4 | 6 | "github.com/Optum/dce/pkg/errors" |
5 | 7 | "github.com/Optum/dce/pkg/lease" |
6 | 8 | "github.com/aws/aws-sdk-go/aws" |
7 | 9 | "github.com/aws/aws-sdk-go/service/dynamodb" |
8 | 10 | "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" |
9 | 11 | "github.com/aws/aws-sdk-go/service/dynamodb/expression" |
10 | | - "strings" |
11 | 12 | ) |
12 | 13 |
|
13 | 14 | // queryLeases for doing a query against dynamodb |
@@ -36,6 +37,7 @@ func (a *Lease) queryLeases(query *lease.Lease, keyName string, index string) (* |
36 | 37 | FilterExpression: expr.Filter(), |
37 | 38 | ExpressionAttributeNames: expr.Names(), |
38 | 39 | ExpressionAttributeValues: expr.Values(), |
| 40 | + ScanIndexForward: aws.Bool(false), |
39 | 41 | } |
40 | 42 |
|
41 | 43 | queryInput.SetLimit(*query.Limit) |
@@ -125,7 +127,7 @@ func (a *Lease) List(query *lease.Lease) (*lease.Leases, error) { |
125 | 127 | if query.ID != nil { |
126 | 128 | outputs, err = a.queryLeases(query, "Id", "LeaseId") |
127 | 129 | } else if query.PrincipalID != nil { |
128 | | - outputs, err = a.queryLeases(query, "PrincipalId", "PrincipalId") |
| 130 | + outputs, err = a.queryLeases(query, "PrincipalId", "PrincipalIdLastModifiedOn") |
129 | 131 | } else if query.Status != nil { |
130 | 132 | outputs, err = a.queryLeases(query, "LeaseStatus", "LeaseStatus") |
131 | 133 | } else { |
|
0 commit comments