add default org
This commit is contained in:
@@ -16,6 +16,7 @@ from exceptions import (
|
||||
CPFConflictError,
|
||||
EmailConflictError,
|
||||
OrgNotFoundError,
|
||||
SubscriptionFrozenError,
|
||||
UserConflictError,
|
||||
UserNotFoundError,
|
||||
)
|
||||
@@ -107,6 +108,14 @@ def _create_user(
|
||||
|
||||
try:
|
||||
with dyn.transact_writer() as transact:
|
||||
transact.condition(
|
||||
key=KeyPair(
|
||||
pk='SUBSCRIPTION#FROZEN',
|
||||
sk=f'ORG#{org.id}',
|
||||
),
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
exc_cls=SubscriptionFrozenError,
|
||||
)
|
||||
transact.put(
|
||||
item=user.model_dump()
|
||||
| {
|
||||
@@ -223,6 +232,14 @@ def _add_member(user_id: str, org: Org) -> None:
|
||||
now_ = now()
|
||||
|
||||
with dyn.transact_writer() as transact:
|
||||
transact.condition(
|
||||
key=KeyPair(
|
||||
pk='SUBSCRIPTION#FROZEN',
|
||||
sk=f'ORG#{org.id}',
|
||||
),
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
exc_cls=SubscriptionFrozenError,
|
||||
)
|
||||
transact.update(
|
||||
key=KeyPair(user_id, '0'),
|
||||
# Post-migration (users): uncomment the following line
|
||||
|
||||
Reference in New Issue
Block a user