fix slots

This commit is contained in:
2025-07-17 21:30:27 -03:00
parent 31a8025125
commit 6eafb0f541
8 changed files with 166 additions and 59 deletions

View File

@@ -9,7 +9,7 @@ def test_reminder_no_access_3_days(
):
event = {
'detail': {
'new_image': {
'old_image': {
'id': '47ZxxcVBjvhDS5TE98tpfQ',
'sk': 'schedules#reminder_no_access_3_days',
}

View File

@@ -1,5 +1,3 @@
import pprint
import app.events.stopgap.enroll as app
from aws_lambda_powertools.utilities.typing import LambdaContext
from layercake.dynamodb import (
@@ -37,4 +35,5 @@ def test_enroll(
+ SortKey('metadata#course')
)
pprint.pprint(result)
assert 'metadata#course' in result
assert 'metadata#deduplication_window' in result

View File

@@ -0,0 +1,26 @@
import app.events.allocate_slots as app
from aws_lambda_powertools.utilities.typing import LambdaContext
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
def test_allocate_slots(
dynamodb_seeds,
dynamodb_client,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
lambda_context: LambdaContext,
):
event = {
'detail': {
'new_image': {
'id': 'JeCybf6oiv6CF3PchhBqdG',
'sk': 'generated_items',
}
}
}
assert app.lambda_handler(event, lambda_context) # type: ignore
result = dynamodb_persistence_layer.collection.query(
PartitionKey('vacancies#PWQyjGZeVcoD5zc5eTkvpr')
)
assert len(result['items']) == 4

View File

@@ -1,3 +1,8 @@
{"id": {"S": "47ZxxcVBjvhDS5TE98tpfQ"}, "sk": {"S": "0"}, "course": {"M": {"id": {"S": "42"}, "name": {"S": "NR-35 Segurança nos Trabalhos em Altura (Teórico)"},"time_in_days": {"N": "720"}}},"create_date": {"S": "2025-04-10T11:58:33.303347-03:00"},"konviva:id": {"N": "238662"},"progress": {"N": "16.67"},"score": {"NULL": true},"status": {"S": "IN_PROGRESS"}, "update_date": {"S": "2025-04-10T15:44:03.023054-03:00"}, "user": {"M": {"id": {"S": "5OxmMjL-ujoR5IMGegQz"}, "cpf": {"S": "07879819908"}, "email": {"S": "sergio@somosbeta.com.br"}, "name": {"S": "Sérgio Rafael Siqueira"}}}}
{"id": {"S": "47ZxxcVBjvhDS5TE98tpfQ"}, "sk": {"S": "konviva"}, "create_date": {"S": "2025-04-10T11:58:35.035729-03:00"}, "konviva_id": {"N": "238662"}}
{"id": {"S": "47ZxxcVBjvhDS5TE98tpfQ"}, "sk": {"S": "tenant"}, "create_date": {"S": "2025-04-10T11:58:33.303347-03:00"}, "name": {"S": "Beta Educação"},"org_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}}
{"id": {"S": "47ZxxcVBjvhDS5TE98tpfQ"}, "sk": {"S": "tenant"}, "create_date": {"S": "2025-04-10T11:58:33.303347-03:00"}, "name": {"S": "Beta Educação"},"org_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}}
{"id": {"S": "JeCybf6oiv6CF3PchhBqdG"}, "sk": {"S": "0"}, "assignee": {"M": {"name": {"S": "Rodrigo Silva"}}},"cnpj": {"S": "54183587001708"},"create_date": {"S": "2025-07-16T15:54:24.304566-03:00"},"due_date": {"S": "2025-07-17T15:50:08.139000-03:00"},"email": {"S": "silva.rodrigo@manserv.com.br"},"name": {"S": "MANSERV MONTAGEM E MANUTENCAO S/A"},"payment_date": {"NULL": true},"payment_method": {"S": "MANUAL"},"status": {"S": "PAID"},"tenant_id": {"S": "PWQyjGZeVcoD5zc5eTkvpr"},"total": {"N": "0"},"updated_at": {"S": "2025-07-16T15:54:27.074086-03:00"},"update_date": {"S": "2025-07-16T15:54:26.697884-03:00"}}
{"id": {"S": "JeCybf6oiv6CF3PchhBqdG"}, "sk": {"S": "items"},"items": {"L": [{"M": {"id": {"S": "a955518e-ebcb-4441-b914-ddc9ecef84f0"},"name": {"S": "NR-11 Operador de Munck"},"quantity": {"N": "3"},"unit_price": {"N": "99"}}}, {"M": {"id": {"S": "123"},"name": {"S": "pytest"},"quantity": {"N": "1"},"unit_price": {"N": "99"}}},{"M": {"id": {"S": "23020"},"name": {"S": "Desconto 100%"},"quantity": {"N": "1"},"unit_price": {"N": "-297"}}}]},"updated_at": {"S": "2025-07-16T15:54:27.154404-03:00"}}
{"id": {"S": "JeCybf6oiv6CF3PchhBqdG"},"sk": {"S": "generated_items"},"create_date": {"S": "2025-07-16T15:54:30.160729-03:00"},"scope": {"S": "MULTI_USER"},"status": {"S": "SUCCESS"},"update_date": {"S": "2025-07-16T15:54:33.674670-03:00"}}
{"id": {"S": "a955518e-ebcb-4441-b914-ddc9ecef84f0"},"sk": {"S": "0"},"access_period": {"N": "360"},"cert": {"M": {"exp_interval": {"N": "360"}}},"created_at": {"S": "2025-07-14T15:09:18.559528-03:00"},"metadata__konviva_class_id": {"N": "281"},"name": {"S": "NR-11 Operador de Munck"},"tenant_id": {"S": "*"}}
{"id": {"S": "123"},"sk": {"S": "0"},"access_period": {"N": "360"},"cert": {"M": {"exp_interval": {"N": "360"}}},"created_at": {"S": "2025-07-14T15:09:18.559528-03:00"},"metadata__konviva_class_id": {"N": "281"},"name": {"S": "pytest"},"tenant_id": {"S": "*"}}