Пример #1
0
def get_user(user_id):
    # user = users.find_one({"userId": user_id})
    # if user is None:
    #     return None
    # else:
    #     return User.parse_obj(user)
    # return template.find_one(USERS, {"userId": user_id}, User)
    return find_by_id(user_id, User, USERS)
def load_enum_by_id(enum_id) -> Enum:
    # result = template.find_one(ENUMS, {"enumId": enum_id}, Enum)
    result = find_by_id(enum_id, Enum, ENUMS)
    result.items = load_enum_items_by_enum_id(enum_id)
    return result
def load_enum_items_by_enum_id(enum_id) -> List[EnumItem]:
    # return template.find(ENUM_ITEMS, {"enumId": enum_id}, EnumItem)
    return find_by_id(enum_id, EnumItem, ENUM_ITEMS)
def get_topic_by_id(topic_id: str) -> Topic:
    # return template.find_one(TOPICS, {"topicId": topic_id}, Topic)
    return find_by_id(topic_id, Topic, TOPICS)
Пример #5
0
def load_report_by_id(report_id):
    # return template.find_one(CONSOLE_REPORTS, {"reportId": report_id}, Report)
    return find_by_id(report_id, Report, CONSOLE_REPORTS)
Пример #6
0
def get_space_by_id(space_id: str) -> Space:
    # return template.find_one(SPACES, {"spaceId": space_id}, Space)
    return find_by_id(space_id, Space, SPACES)
def load_pipeline_by_id(pipeline_id):
    # return template.find_one(PIPELINES, {"pipelineId": pipeline_id}, Pipeline)
    return find_by_id(pipeline_id, Pipeline, PIPELINES)
def load_pipeline_graph(user_id):
    # return template.find_one(PIPELINE_GRAPH, {USER_ID: user_id}, PipelinesGraphics)
    return find_by_id(user_id, PipelinesGraphics, PIPELINE_GRAPH)
Пример #9
0
def load_console_subject_by_id(subject_id) -> ConsoleSpaceSubject:
    # return template.find_one(CONSOLE_SPACE_SUBJECTS, {"subjectId": subject_id}, ConsoleSpaceSubject)
    return find_by_id(subject_id, ConsoleSpaceSubject, CONSOLE_SPACE_SUBJECTS)
def load_enum_by_id(enum_id) -> Enum:
    # result = template.find_one(ENUMS, {"enumId": enum_id}, Enum)
    enum = find_by_id(enum_id, Enum, ENUMS)
    enum.items = load_enum_items_by_enum_name(enum.name)
    return enum
def load_dashboard_by_id(dashboard_id) -> ConsoleDashboard:
    # return template.find_one(DASHBOARDS, {DASHBOARD_ID: dashboard_id}, ConsoleDashboard)
    return find_by_id(dashboard_id, ConsoleDashboard, DASHBOARDS)
Пример #12
0
def load_favorite(user_id):
    # return template.find_one(CONSOLE_SPACE_FAVORITES, {"userId": user_id}, Favorite)
    return find_by_id(user_id, Favorite, CONSOLE_SPACE_FAVORITES)
def load_console_subject_by_id(subject_id) -> ConsoleSpaceSubject:
    return find_by_id(subject_id, ConsoleSpaceSubject, CONSOLE_SPACE_SUBJECTS)