fix menu
This commit is contained in:
@@ -117,9 +117,10 @@ def _create_user(user: User, org: Org) -> bool:
|
||||
'sk': '0',
|
||||
'email_verified': email_verified,
|
||||
'tenant_id': {org.id},
|
||||
# Post-migration: uncomment the folloing line
|
||||
# Post-migration (users): uncomment the folloing line
|
||||
# 'org_id': {org.id},
|
||||
'created_at': now_,
|
||||
# 'created_at': now_,
|
||||
'createDate': now_,
|
||||
},
|
||||
)
|
||||
transact.put(
|
||||
@@ -157,9 +158,10 @@ def _create_user(user: User, org: Org) -> bool:
|
||||
|
||||
transact.put(
|
||||
item={
|
||||
# Post-migration: rename `cpf` to `CPF`
|
||||
# Post-migration (users): rename `cpf` to `CPF`
|
||||
'id': 'cpf',
|
||||
'sk': user.cpf,
|
||||
'user_id': user_id,
|
||||
'created_at': now_,
|
||||
},
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
@@ -167,9 +169,10 @@ def _create_user(user: User, org: Org) -> bool:
|
||||
)
|
||||
transact.put(
|
||||
item={
|
||||
# Post-migration: rename `email` to `EMAIL`
|
||||
# Post-migration (users): rename `email` to `EMAIL`
|
||||
'id': 'email',
|
||||
'sk': user.email,
|
||||
'user_id': user_id,
|
||||
'created_at': now_,
|
||||
},
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
@@ -179,7 +182,7 @@ def _create_user(user: User, org: Org) -> bool:
|
||||
item={
|
||||
'id': user_id,
|
||||
'sk': f'orgs#{org.id}',
|
||||
# Post-migration: uncomment the following line
|
||||
# Post-migration (users): uncomment the following line
|
||||
# pk=f'ORG#{org.id}',
|
||||
'name': org.name,
|
||||
'cnpj': org.cnpj,
|
||||
@@ -189,7 +192,7 @@ def _create_user(user: User, org: Org) -> bool:
|
||||
transact.put(
|
||||
item={
|
||||
'id': f'orgmembers#{org.id}',
|
||||
# Post-migration: uncomment the following line
|
||||
# Post-migration (users): uncomment the following line
|
||||
# pk=f'MEMBER#ORG#{org_id}',
|
||||
'sk': user_id,
|
||||
'created_at': now_,
|
||||
@@ -212,7 +215,7 @@ def _add_member(user_id: str, org: Org) -> None:
|
||||
with dyn.transact_writer() as transact:
|
||||
transact.update(
|
||||
key=KeyPair(user_id, '0'),
|
||||
# Post-migration: uncomment the following line
|
||||
# Post-migration (users): uncomment the following line
|
||||
# update_expr='ADD tenant_id :org_id',
|
||||
update_expr='ADD tenant_id :org_id',
|
||||
expr_attr_values={
|
||||
@@ -224,7 +227,7 @@ def _add_member(user_id: str, org: Org) -> None:
|
||||
transact.put(
|
||||
item={
|
||||
'id': user_id,
|
||||
# Post-migration: rename `orgs` to `ORG`
|
||||
# Post-migration (users): rename `orgs` to `ORG`
|
||||
'sk': f'orgs#{org.id}',
|
||||
'name': org.name,
|
||||
'cnpj': org.cnpj,
|
||||
@@ -233,7 +236,8 @@ def _add_member(user_id: str, org: Org) -> None:
|
||||
)
|
||||
transact.put(
|
||||
item={
|
||||
# Post-migration: rename `orgmembers` to `ORGMEMBER`
|
||||
# Post-migration (users): uncomment the following line
|
||||
# pk=f'MEMBER#ORG#{org_id}',
|
||||
'id': f'orgmembers#{org.id}',
|
||||
'sk': user_id,
|
||||
'created_at': now_,
|
||||
|
||||
@@ -59,7 +59,7 @@ def get_user(user_id: str):
|
||||
)
|
||||
|
||||
if not user:
|
||||
return UserNotFoundError('User not found')
|
||||
raise UserNotFoundError('User not found')
|
||||
|
||||
return user
|
||||
|
||||
@@ -74,10 +74,7 @@ def update(
|
||||
old_cpf = dyn.collection.get_item(
|
||||
KeyPair(
|
||||
pk=user_id,
|
||||
sk=SortKey(
|
||||
'0',
|
||||
path_spec='cpf',
|
||||
),
|
||||
sk=SortKey('0', path_spec='cpf'),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user