Add tasks.get_by_id_ex and models.get_by_id_ex

This commit is contained in:
allegroai 2021-01-05 17:44:59 +02:00
parent b89de43373
commit cf441987af
4 changed files with 38 additions and 0 deletions

View File

@ -144,6 +144,10 @@ get_by_task_id {
}
}
}
get_by_id_ex {
internal: true
"2.11": ${get_all_ex."2.1"}
}
get_all_ex {
internal: true
"2.1": ${get_all."2.1"}

View File

@ -554,6 +554,10 @@ get_by_id {
}
}
}
get_by_id_ex {
internal: true
"2.11": ${get_all_ex."2.1"}
}
get_all_ex {
internal: true
"2.1": ${get_all."2.1"}

View File

@ -96,6 +96,18 @@ def get_all_ex(call: APICall, company_id, _):
call.result.data = {"models": models}
@endpoint("models.get_by_id_ex", required_fields=["id"])
def get_by_id_ex(call: APICall, company_id, _):
conform_tag_fields(call, call.data)
with translate_errors_context():
with TimingContext("mongo", "models_get_by_id_ex"):
models = Model.get_many_with_join(
company=company_id, query_dict=call.data, allow_public=True
)
conform_output_tags(call, models)
call.result.data = {"models": models}
@endpoint("models.get_all", required_fields=[])
def get_all(call: APICall, company_id, _):
conform_tag_fields(call, call.data)

View File

@ -163,6 +163,24 @@ def get_all_ex(call: APICall, company_id, _):
call.result.data = {"tasks": tasks}
@endpoint("tasks.get_by_id_ex", required_fields=["id"])
def get_by_id_ex(call: APICall, company_id, _):
conform_tag_fields(call, call.data)
escape_execution_parameters(call)
with translate_errors_context():
with TimingContext("mongo", "task_get_by_id_ex"):
tasks = Task.get_many_with_join(
company=company_id,
query_dict=call.data,
allow_public=True,
)
unprepare_from_saved(call, tasks)
call.result.data = {"tasks": tasks}
@endpoint("tasks.get_all", required_fields=[])
def get_all(call: APICall, company_id, _):
conform_tag_fields(call, call.data)