def remove_tag(tag_id: str) -> ResultWithData: tag = Tag.get(tag_id=tag_id) if tag is None: return get_result_with_error(TAG_ID_NOT_EXIST) else: tag.delete() return get_result_with_data("The tag was successfully deleted")
def get_tag_by_id(tag_id: str) -> ResultWithData[TagObject]: tag = Tag.get(tag_id=tag_id) if tag is None: return get_result_with_error(TAG_ID_NOT_EXIST) else: return get_result_with_data(db_tag_to_tag_object(tag))