wio
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
# If UV does not load this file, try running `export UV_ENV_FILE=.env`
|
||||
# See more details at https://docs.astral.sh/uv/configuration/files/#env
|
||||
|
||||
MEILISEARCH_HOST=http://127.0.0.1:7700
|
||||
@@ -6,8 +6,8 @@ from aws_lambda_powertools.utilities.data_classes import (
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from meilisearch import Client as Meilisearch
|
||||
|
||||
from config import MEILISEARCH_API_KEY, MEILISEARCH_HOST
|
||||
from meili import Op
|
||||
from settings import MEILISEARCH_API_KEY, MEILISEARCH_HOST
|
||||
|
||||
meili_client = Meilisearch(MEILISEARCH_HOST, MEILISEARCH_API_KEY)
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import json
|
||||
from decimal import Decimal
|
||||
from typing import Self
|
||||
|
||||
from aws_lambda_powertools.shared.json_encoder import Encoder
|
||||
from aws_lambda_powertools.utilities.data_classes.dynamo_db_stream_event import (
|
||||
DynamoDBRecordEventName,
|
||||
)
|
||||
@@ -50,20 +49,8 @@ class Op:
|
||||
return self.op[index][op].append(data)
|
||||
|
||||
|
||||
class DecimalEncoder(json.JSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, Decimal):
|
||||
if o % 1 != 0:
|
||||
return float(o.quantize(Decimal('0.00')))
|
||||
return int(o)
|
||||
return super(__class__, self).default(o)
|
||||
|
||||
|
||||
class SetEncoder(json.JSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, set):
|
||||
return list(o)
|
||||
return super(__class__, self).default(o)
|
||||
|
||||
|
||||
class JSONEncoder(SetEncoder, DecimalEncoder): ...
|
||||
class JSONEncoder(Encoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, set):
|
||||
return list(obj)
|
||||
return super(__class__, self).default(obj)
|
||||
|
||||
@@ -8,14 +8,14 @@ Globals:
|
||||
Architectures:
|
||||
- x86_64
|
||||
Layers:
|
||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:35
|
||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:75
|
||||
Environment:
|
||||
Variables:
|
||||
LOG_LEVEL: DEBUG
|
||||
TZ: America/Sao_Paulo
|
||||
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
|
||||
POWERTOOLS_LOGGER_LOG_EVENT: true
|
||||
MEILISEARCH_HOST: https://meili.vps.eduseg.com.br
|
||||
MEILISEARCH_HOST: https://meili.eduseg.com.br
|
||||
MEILISEARCH_API_KEY: "{{resolve:ssm:/saladeaula/meili_api_key}}"
|
||||
|
||||
Resources:
|
||||
@@ -31,32 +31,10 @@ Resources:
|
||||
LoggingConfig:
|
||||
LogGroup: !Ref MeilisearchLog
|
||||
Events:
|
||||
Users:
|
||||
Type: DynamoDB
|
||||
Properties:
|
||||
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-users_d2o3r5gmm4it7j/stream/2022-06-12T21:33:25.634
|
||||
StartingPosition: LATEST
|
||||
MaximumRetryAttempts: 5
|
||||
BatchSize: 25
|
||||
FilterCriteria:
|
||||
Filters:
|
||||
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
|
||||
|
||||
Enrollments:
|
||||
Type: DynamoDB
|
||||
Properties:
|
||||
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-enrollments/stream/2023-08-22T22:56:55.612
|
||||
StartingPosition: LATEST
|
||||
MaximumRetryAttempts: 5
|
||||
BatchSize: 25
|
||||
FilterCriteria:
|
||||
Filters:
|
||||
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
|
||||
|
||||
Orders:
|
||||
Type: DynamoDB
|
||||
Properties:
|
||||
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-orders/stream/2023-09-15T18:58:50.395
|
||||
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/saladeaula_enrollments/stream/2025-06-04T16:44:42.524
|
||||
StartingPosition: LATEST
|
||||
MaximumRetryAttempts: 5
|
||||
BatchSize: 25
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
import json
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
# https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest.hookspec.pytest_configure
|
||||
def pytest_configure():
|
||||
os.environ['TZ'] = 'America/Sao_Paulo'
|
||||
os.environ['MEILISEARCH_HOST'] = 'http://127.0.0.1:7700'
|
||||
|
||||
|
||||
def load_jsonfile(path: str) -> dict:
|
||||
with open(path) as fp:
|
||||
return json.load(fp)
|
||||
|
||||
892
streams/uv.lock
generated
892
streams/uv.lock
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user