Example #1
0
async def import_topic(topic: Topic):
    result = get_topic_by_id(topic.topicId)
    if result is None:
        # import_topic_to_db(topic)
        create_topic_schema(topic)
    else:
        update_topic_schema(topic.topicId, topic)
async def update_topic(topic_id,
                       topic: Topic = Body(...),
                       current_user: User = Depends(deps.get_current_user)):
    topic = Topic.parse_obj(topic)
    data = update_topic_schema(topic_id, topic)
    # remove_presto_schema_by_name(topic.name)
    create_or_update_presto_schema_fields(data)
    return data
Example #3
0
async def save_topic(topic: Topic, current_user: User = Depends(deps.get_current_user)):
    if check_fake_id(topic.topicId):
        result = create_topic_schema(topic)
        create_or_update_presto_schema_fields(result)
        return result
    else:
        topic = Topic.parse_obj(topic)
        data = update_topic_schema(topic.topicId, topic)
        create_or_update_presto_schema_fields(data)
        return data