add link to catalog

This commit is contained in:
2025-12-19 12:55:42 -03:00
parent 3be296f1ac
commit 192be98c39
17 changed files with 514 additions and 46 deletions

View File

@@ -1,6 +1,7 @@
from http import HTTPStatus
from aws_lambda_powertools.event_handler.exceptions import (
NotFoundError,
ServiceError,
)
@@ -8,3 +9,24 @@ from aws_lambda_powertools.event_handler.exceptions import (
class ConflictError(ServiceError):
def __init__(self, msg: str | dict):
super().__init__(HTTPStatus.CONFLICT, msg)
class UserNotFoundError(NotFoundError): ...
class EmailNotFoundError(NotFoundError): ...
class EmailVerificationNotFoundError(NotFoundError): ...
class UserConflictError(ConflictError): ...
class EmailConflictError(ConflictError): ...
class CPFConflictError(ConflictError): ...
class CancelPolicyConflictError(ConflictError): ...

View File

@@ -2,15 +2,13 @@ from typing import Annotated
from aws_lambda_powertools import Logger
from aws_lambda_powertools.event_handler.api_gateway import Router
from aws_lambda_powertools.event_handler.exceptions import (
BadRequestError,
)
from aws_lambda_powertools.event_handler.openapi.params import Body
from layercake.dateutils import now
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
from boto3clients import dynamodb_client
from config import ENROLLMENT_TABLE
from exceptions import CancelPolicyConflictError
from middlewares.authentication_middleware import User as Authenticated
logger = Logger(__name__)
@@ -18,9 +16,6 @@ router = Router()
dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
class CancelPolicyConflictError(BadRequestError): ...
@router.patch('/<enrollment_id>/cancel')
def cancel(
enrollment_id: str,

View File

@@ -13,7 +13,12 @@ from pydantic import BaseModel, EmailStr, Field
from api_gateway import JSONResponse
from boto3clients import dynamodb_client
from config import INTERNAL_EMAIL_DOMAIN, USER_TABLE
from exceptions import ConflictError
from exceptions import (
CPFConflictError,
EmailConflictError,
UserConflictError,
UserNotFoundError,
)
from middlewares.authentication_middleware import User as Authenticated
router = Router()
@@ -32,18 +37,6 @@ class User(BaseModel):
email: EmailStr
class CPFConflictError(ConflictError): ...
class EmailConflictError(ConflictError): ...
class UserConflictError(ConflictError): ...
class UserNotFoundError(NotFoundError): ...
class OrgNotFoundError(NotFoundError): ...

View File

@@ -2,9 +2,6 @@ from http import HTTPStatus
from uuid import uuid4
from aws_lambda_powertools.event_handler.api_gateway import Router
from aws_lambda_powertools.event_handler.exceptions import (
NotFoundError,
)
from aws_lambda_powertools.event_handler.openapi.params import Body, Path, Query
from layercake.dateutils import now, ttl
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, SortKey, TransactKey
@@ -14,24 +11,17 @@ from typing_extensions import Annotated
from api_gateway import JSONResponse
from boto3clients import dynamodb_client
from config import USER_TABLE
from exceptions import ConflictError
from exceptions import (
EmailConflictError,
EmailNotFoundError,
EmailVerificationNotFoundError,
UserNotFoundError,
)
router = Router()
dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
class UserNotFoundError(NotFoundError): ...
class EmailNotFoundError(NotFoundError): ...
class EmailVerificationNotFoundError(NotFoundError): ...
class EmailConflictError(ConflictError): ...
@router.get('/<user_id>/emails')
def get_emails(user_id: str, start_key: Annotated[str | None, Query] = None):
return dyn.collection.query(

View File

@@ -2,7 +2,6 @@ from http import HTTPStatus
from typing import Annotated
from aws_lambda_powertools.event_handler.api_gateway import Router
from aws_lambda_powertools.event_handler.exceptions import NotFoundError
from aws_lambda_powertools.event_handler.openapi.params import Body
from layercake.dateutils import now
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
@@ -11,14 +10,12 @@ from passlib.hash import pbkdf2_sha256
from api_gateway import JSONResponse
from boto3clients import dynamodb_client
from config import USER_TABLE
from exceptions import UserNotFoundError
router = Router()
dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
class UserNotFoundError(NotFoundError): ...
@router.post('/<user_id>/password')
def password(
user_id: str,