fix block
add check name to subscription
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
from datetime import date, datetime, time, timedelta
|
||||
from http import HTTPStatus
|
||||
from typing import Annotated, TypedDict
|
||||
from uuid import uuid4
|
||||
|
||||
import pytz
|
||||
from aws_lambda_powertools import Logger
|
||||
from aws_lambda_powertools.event_handler.api_gateway import Router
|
||||
from aws_lambda_powertools.event_handler.exceptions import (
|
||||
ServiceError,
|
||||
)
|
||||
from aws_lambda_powertools.event_handler.openapi.params import Body
|
||||
from aws_lambda_powertools.shared.functions import extract_event_from_common_models
|
||||
from layercake.batch import BatchProcessor
|
||||
@@ -20,7 +16,7 @@ from pydantic import UUID4, BaseModel, EmailStr, Field, FutureDate
|
||||
|
||||
from boto3clients import dynamodb_client
|
||||
from config import DEDUP_WINDOW_OFFSET_DAYS, ENROLLMENT_TABLE, TZ, USER_TABLE
|
||||
from exceptions import ConflictError
|
||||
from exceptions import ConflictError, SubscriptionFrozenError, SubscriptionRequiredError
|
||||
from middlewares.authentication_middleware import User as Authenticated
|
||||
|
||||
logger = Logger(__name__)
|
||||
@@ -29,16 +25,6 @@ dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
||||
processor = BatchProcessor()
|
||||
|
||||
|
||||
class SubscriptionRequiredError(ServiceError):
|
||||
def __init__(self, msg: str | dict):
|
||||
super().__init__(HTTPStatus.NOT_ACCEPTABLE, msg)
|
||||
|
||||
|
||||
class SubscriptionFrozenError(ServiceError):
|
||||
def __init__(self, msg: str | dict):
|
||||
super().__init__(HTTPStatus.NOT_ACCEPTABLE, msg)
|
||||
|
||||
|
||||
class DeduplicationConflictError(ConflictError): ...
|
||||
|
||||
|
||||
@@ -139,7 +125,7 @@ def enroll(
|
||||
dyn.put_item(item=item)
|
||||
except Exception as exc:
|
||||
logger.exception(exc)
|
||||
finally:
|
||||
else:
|
||||
return item
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user