move superpage to eduseg.com.br repo

This commit is contained in:
2025-05-16 19:17:01 -03:00
parent cc9bd08daa
commit 26b1e618b6
150 changed files with 23 additions and 15658 deletions

View File

@@ -26,6 +26,7 @@ Example
from dataclasses import asdict, dataclass
from typing import Any
import boto3
from aws_lambda_powertools import Logger, Tracer
from aws_lambda_powertools.utilities.data_classes import event_source
from aws_lambda_powertools.utilities.data_classes.api_gateway_authorizer_event import (
@@ -33,7 +34,6 @@ from aws_lambda_powertools.utilities.data_classes.api_gateway_authorizer_event i
APIGatewayAuthorizerResponseV2,
)
from aws_lambda_powertools.utilities.typing import LambdaContext
import boto3
from botocore.endpoint_provider import Enum
from layercake.dynamodb import DynamoDBCollection, DynamoDBPersistenceLayer, KeyPair
from layercake.funcs import pick
@@ -56,7 +56,8 @@ user_collect = DynamoDBCollection(user_layer)
@event_source(data_class=APIGatewayAuthorizerEventV2)
def lambda_handler(event: APIGatewayAuthorizerEventV2, context: LambdaContext) -> dict:
"""Authenticates a user using a bearer token (for user or API).
Only handles authentication; any additional logic (e.g., tenant) is performed afterward."""
Only handles authentication; any additional logic (e.g., tenant)
is performed afterward."""
bearer = _parse_bearer_token(event.headers.get('authorization', ''))
if not bearer:

View File

@@ -33,5 +33,7 @@ def get_vacancies():
tenant: Tenant = router.context['tenant']
return enrollment_collect.query(
PartitionKey(ComposeKey(str(tenant.id), prefix='vacancies'))
PartitionKey(
ComposeKey(str(tenant.id), prefix='vacancies'),
)
)

View File

@@ -1,8 +1,8 @@
from typing import Any, Generator
import boto3
from elasticsearch import Elasticsearch
import jsonlines
from elasticsearch import Elasticsearch
from layercake.dynamodb import deserialize
from tqdm import tqdm

View File

@@ -1,6 +1,7 @@
import gzip
from pathlib import Path
def unzip_gzip(file: Path, target: str):
with gzip.open(file, 'rb') as r:
with open(target, 'wb') as w:

View File

@@ -29,10 +29,6 @@ quote-style = "single"
[tool.ruff.lint]
select = ["E", "F", "I"]
[tool.ruff.lint.isort]
lines-between-types = 1
force-sort-within-sections = true
[tool.uv.sources]
layercake = { path = "../layercake" }

View File

@@ -1,5 +1,5 @@
from http import HTTPMethod, HTTPStatus
import json
from http import HTTPMethod, HTTPStatus
from layercake.dynamodb import (
ComposeKey,

View File

@@ -10,6 +10,7 @@ from layercake.dynamodb import (
from ..conftest import HttpApiProxy, LambdaContext
def test_vacancies(
mock_app,
dynamodb_seeds,

View File

@@ -1,8 +1,9 @@
from http import HTTPMethod, HTTPStatus
import json
from http import HTTPMethod, HTTPStatus
from ..conftest import HttpApiProxy, LambdaContext
def test_lookup(
mock_app,
http_api_proxy: HttpApiProxy,

View File

@@ -1,10 +1,11 @@
from http import HTTPMethod, HTTPStatus
import json
from http import HTTPMethod, HTTPStatus
from layercake.dynamodb import DynamoDBCollection, DynamoDBPersistenceLayer, KeyPair
from ..conftest import HttpApiProxy, LambdaContext
def test_get_policies(
mock_app,
dynamodb_seeds,

View File

@@ -1,8 +1,9 @@
from http import HTTPMethod, HTTPStatus
import json
from http import HTTPMethod, HTTPStatus
from ..conftest import HttpApiProxy, LambdaContext
def test_settings(
mock_app,
dynamodb_seeds,

View File

@@ -1,5 +1,5 @@
from http import HTTPMethod, HTTPStatus
import json
from http import HTTPMethod, HTTPStatus
from layercake.dynamodb import (
DynamoDBCollection,
@@ -11,6 +11,7 @@ from layercake.dynamodb import (
from ..conftest import HttpApiProxy, LambdaContext
def test_update_user_cpf(
mock_app,
dynamodb_seeds,

View File

@@ -3,6 +3,7 @@ from auth import _parse_bearer_token
from .conftest import LambdaContext
def test_bearer_jwt(lambda_context: LambdaContext):
# You should mock the Cognito user to pass the test
app.get_user = lambda *args, **kwargs: {

View File

@@ -1,5 +1,5 @@
from conf import KONVIVA_API_URL
import konviva
from conf import KONVIVA_API_URL
def test_konviva_token():

View File

@@ -1,12 +1,14 @@
from http import HTTPMethod
import pytest
from aws_lambda_powertools.event_handler.api_gateway import APIGatewayHttpResolver
from layercake.dynamodb import DynamoDBCollection, DynamoDBPersistenceLayer
from middlewares import AuthenticationMiddleware, TenantMiddleware
import pytest
from .conftest import HttpApiProxy, LambdaContext
@pytest.fixture
def mock_app(dynamodb_persistence_layer: DynamoDBPersistenceLayer):
collect = DynamoDBCollection(dynamodb_persistence_layer)