update admin name #32

This commit is contained in:
2025-12-05 19:59:43 -03:00
parent c8c12bdde4
commit b136d83f81
11 changed files with 187 additions and 27 deletions

View File

@@ -3,10 +3,7 @@ from typing import Annotated
from uuid import uuid4
from aws_lambda_powertools.event_handler.api_gateway import Router
from aws_lambda_powertools.event_handler.exceptions import (
NotFoundError,
ServiceError,
)
from aws_lambda_powertools.event_handler.exceptions import NotFoundError
from aws_lambda_powertools.event_handler.openapi.params import Body
from layercake.dateutils import now, ttl
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, SortKey
@@ -16,6 +13,7 @@ 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
router = Router()
dyn = DynamoDBPersistenceLayer(USER_TABLE, dynamodb_client)
@@ -33,11 +31,6 @@ class User(BaseModel):
email: EmailStr
class ConflictError(ServiceError):
def __init__(self, msg: str | dict):
super().__init__(HTTPStatus.CONFLICT, msg)
class CPFConflictError(ConflictError): ...
@@ -218,7 +211,7 @@ def _add_member(user_id: str, org: Org) -> None:
transact.update(
key=KeyPair(user_id, '0'),
# Post-migration (users): uncomment the following line
# update_expr='ADD tenant_id :org_id',
# update_expr='ADD org_id :org_id',
update_expr='ADD tenant_id :org_id',
expr_attr_values={
':org_id': {org.id},