async def load_topic_by_factor_index(query_name: str, current_user: User = Depends(deps.get_current_user)):
    factor_index_list = factor_index_storage.load_factor_index_by_factor_name(query_name, current_user.tenantId)
    topic_factor_index_list = factor_index_storage.load_factor_index_by_topic_name(query_name, current_user.tenantId)
    all_list = factor_index_list + topic_factor_index_list
    topic_id_list = []

    # print(all_list)
    for factor_index in all_list:
        if factor_index.topicId not in topic_id_list:
            topic_id_list.append(factor_index.topicId)
    #
    # print(topic_id_list)
    if topic_id_list:
        result = get_topic_list_by_ids(topic_id_list, current_user)
        print(result)
        return result
    else:
        return []
async def query_topic_list_by_ids(topic_ids: List[str], current_user: User = Depends(deps.get_current_user)):
    return get_topic_list_by_ids(topic_ids)
Beispiel #3
0
def load_topic_list_by_space_id(space_id, current_user):
    space = get_space_by_id(space_id, current_user)
    if space.topicIds:
        return []
    else:
        return get_topic_list_by_ids(space.topicIds, current_user)
def load_topic_list_by_space_id(space_id):
    space = get_space_by_id(space_id)
    if space.topicIds is None:
        return []
    else:
        return get_topic_list_by_ids(space.topicIds)
Beispiel #5
0
def load_topic_list_by_space_id(space_id):
    space = get_space_by_id(space_id)
    return get_topic_list_by_ids(space.topicIds)