Skip to content

Commit 31853a2

Browse files
authored
Fixes upload via dict fucntion for tokenization (#317)
1 parent 6eb2f7a commit 31853a2

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

controller/transfer/record_transfer_manager.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
record,
1717
record_label_association,
1818
upload_task,
19+
project,
1920
)
2021

2122
from controller.upload_task import manager as upload_task_manager
@@ -28,6 +29,7 @@
2829
from util import notification
2930
from controller.transfer.util import convert_to_record_dict
3031
import os
32+
from controller.task_master import manager as task_master_manager
3133

3234

3335
logger = logging.getLogger(__name__)
@@ -182,6 +184,19 @@ def import_file_record_dict(
182184
tmp_file_name = file.store_records_as_json_file(records)
183185
file_type = "json"
184186
__import_file(project_id, upload_task, file_type, tmp_file_name)
187+
project_item = project.get(project_id)
188+
org_id = project_item.organization_id
189+
task_master_manager.queue_task(
190+
str(org_id),
191+
str(upload_task.user_id),
192+
enums.TaskType.TOKENIZATION,
193+
{
194+
"project_id": str(project_id),
195+
"scope": enums.RecordTokenizationScope.PROJECT.value,
196+
"include_rats": True,
197+
"only_uploaded_attributes": True,
198+
},
199+
)
185200

186201

187202
def __import_file(

tests/fast_api/routes/test_invite_users.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from controller.auth.kratos import delete_user_kratos
33

44
from submodules.model.models import Organization
5+
from submodules.model.enums import UserRoles
56
import requests
67
import time
78

@@ -52,7 +53,11 @@ def test_invite_users(client: TestClient, org: Organization):
5253
valid_emails_to_test = ["test@kern.ai"]
5354
response = client.post(
5455
"/api/v1/misc/invite-users",
55-
json={"organization_name": org.name, "emails": valid_emails_to_test},
56+
json={
57+
"organization_name": org.name,
58+
"emails": valid_emails_to_test,
59+
"user_role": UserRoles.ENGINEER.value,
60+
},
5661
)
5762
assert response.status_code == 200
5863
created_user_ids = response.json()

0 commit comments

Comments
 (0)