const response = await ddbClient
.query({
TableName: tableName,
KeyConditionExpression: '#owner = :owner and #createdAt BETWEEN :start and :end',
FilterExpression: '#imageQualityScore > :score',
ExpressionAttributeNames: {
'#imageQualityScore': 'image_quality_score',
'#owner': 'owner',
'#createdAt': 'createdAt'
},
ExpressionAttributeValues: {
':score': 0.3,
':owner': "6c3d137a-575b-4a57-86b9-5a87ba3b465f",
':start': '1970-01-01T00:00:00Z',
':end': '2999-01-01T00:00:00Z'
},
IndexName: 'ByOwner',
ScanIndexForward: false
})
.promise();
//fullScan
const users = [];
let nextToken;
do {
const response: AWS.DynamoDB.DocumentClient.ScanOutput = await ddbClient
.scan({
TableName: `User-${appsyncApiId}-${env}`,
ExclusiveStartKey: nextToken,
})
.promise();
users.push(...response.Items!);
nextToken = response.LastEvaluatedKey;
} while (nextToken);