-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: test code forum ads api (#340)
* feat: test code for forum ads api * feat: test code for lambda function syncadsimgs * feat: new test code for lambda function syncadsimgs * feat: new test code for lambda function syncadsimgs * feat: test code for lambda function get-omgs-list * feat: test code for lambda function get-omgs-list 2 * feat: test code for lambda get imgs list * feat: test code for lambda get imgs list 2
- Loading branch information
1 parent
30e164c
commit 9fd3e4e
Showing
10 changed files
with
323 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from boto3.dynamodb.conditions import Key | ||
from utils import JsonPayloadBuilder | ||
from utils import resp_handler | ||
from utils import table | ||
|
||
|
||
@resp_handler | ||
def get_imgs_list(board_id): | ||
|
||
if board_id: | ||
response = table.query(KeyConditionExpression=Key( | ||
"board_id").eq(board_id), ScanIndexForward=False) | ||
else: | ||
response = table.scan(ConsistentRead=False) | ||
|
||
results = response.get('Items', []) | ||
|
||
# response = table.scan() | ||
# results = response.get('Items', []) | ||
|
||
body = JsonPayloadBuilder().add_status( | ||
True).add_data(results).add_message('').compile() | ||
return body | ||
|
||
|
||
def handler(event, context): | ||
|
||
params = event["queryStringParameters"] | ||
board_id = params.get("board_id", "") | ||
return get_imgs_list(board_id) |
Oops, something went wrong.