-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update-cd-dev
- Loading branch information
Showing
30 changed files
with
1,565 additions
and
3,378 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
omit = **/__init__.py |
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,2 @@ | ||
STRIPE_SECRET_KEY='<redacted>' | ||
FRONTEND_HOST='http://localhost:3000' |
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,27 @@ | ||
import boto3 | ||
from datetime import datetime | ||
import os | ||
from utils.aws.dynamodb import dynamodb | ||
import sys | ||
|
||
|
||
table_name = os.environ["ORDER_HOLD_TABLE_NAME"] | ||
|
||
def handler(event, context): | ||
table = dynamodb.Table(table_name) | ||
|
||
# Get the current epoch time | ||
now = int(datetime.now().timestamp()) | ||
|
||
# Scan the table to find all expired documents | ||
result = table.scan( | ||
FilterExpression="expiry < :now", | ||
ExpressionAttributeValues={":now": now} | ||
) | ||
|
||
# Delete the expired documents | ||
with table.batch_writer() as batch: | ||
for item in result["Items"]: | ||
batch.delete_item(Key={"transactionID": item["transactionID"]}) | ||
|
||
return dict() |
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,34 @@ | ||
from unittest.mock import patch | ||
import pytest | ||
from datetime import datetime | ||
from utils.test_app import createTestClient | ||
from be.api.v1.endpoints.orders.get import router | ||
|
||
from be.api.v1.models.orders import Order, OrderStatus | ||
|
||
client = createTestClient(router) | ||
|
||
mock_order_data = Order( | ||
orderID="123", | ||
orderDateTime=datetime.fromisoformat("2023-02-10 10:26:43.387520"), | ||
customerEmail="test@example.com", | ||
transactionID="", | ||
paymentGateway="", | ||
orderItems=[], | ||
status=OrderStatus(1)) | ||
|
||
expected_api_res = {'customerEmail': 'te**@example.com', | ||
'orderDateTime': '2023-02-10T10:26:43.387520', | ||
'orderID': '123', | ||
'orderItems': [], | ||
'paymentGateway': '', | ||
'status': 1, | ||
'transactionID': ''} | ||
|
||
|
||
def test_get_order(): | ||
with patch("be.api.v1.endpoints.orders.get.dal_read_order", return_value=mock_order_data): | ||
response = client.get("/orders/123") | ||
assert response.status_code == 200 | ||
print(response.json()) | ||
assert response.json() == expected_api_res |
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
class CartItem(BaseModel): | ||
productId: str | ||
size: Optional[str] | ||
size: str | ||
quantity: int | ||
colorway: str | ||
|
||
|
Oops, something went wrong.
4229df7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report