예제 #1
0
 def post(self):
     args = postParser.parse_args()
     QUERY_POST_RECIPE_TAG = file_processor.read_sql_file(
         "sql/recipe_tag/post_recipe_tag.sql")
     sql_creation = QUERY_POST_RECIPE_TAG.format(args['recipe_id'],
                                                 args['tag_id'])
     sql_creation = sql_processor.handleNone(sql_creation)
     database_processor.insert_data_into_database(sql_creation)
     return 201
예제 #2
0
 def put(self):
     args = updateParser.parse_args()
     QUERY_PUT_INGREDIENT = file_processor.read_sql_file(
         "sql/ingredient/put_ingredient.sql")
     sql_creation = QUERY_PUT_INGREDIENT.format(
         "\'{}\'".format(args['name']),
         "\'{}\'".format(args['description']), args['ingredient_id'])
     sql_creation = sql_processor.handleNone(sql_creation)
     database_processor.insert_data_into_database(sql_creation)
     return 201
예제 #3
0
 def post(self):
     args = postParser.parse_args()
     QUERY_POST_RECIPE = file_processor.read_sql_file(
         "sql/recipe/post_recipe.sql")
     sql_creation = QUERY_POST_RECIPE.format("\'{}\'".format(args['name']))
     sql_creation = sql_processor.handleNone(sql_creation)
     database_processor.insert_data_into_database(sql_creation)
     # START Get nextId
     QUERY_NEXTID_RECIPE = file_processor.read_sql_file(
         "sql/recipe/nextid_recipe.sql")
     sql_creation = QUERY_NEXTID_RECIPE
     nextId = database_processor.fetch_data_in_database(sql_creation)
     # END - Get nextId
     return ({'nextId': nextId[0][0]}, 201)
예제 #4
0
파일: tag.py 프로젝트: BenTStark/recipes
    def post(self):
        args = postParser.parse_args()
        QUERY_POST_TAG = file_processor.read_sql_file("sql/tag/post_tag.sql")

        sql_creation = QUERY_POST_TAG.format(
            "\'{}\'".format(args['tag_group']), "\'{}\'".format(args['name']))
        sql_creation = sql_processor.handleNone(sql_creation)
        database_processor.insert_data_into_database(sql_creation)
        # START Get nextId
        QUERY_NEXTID_TAG = file_processor.read_sql_file(
            "sql/tag/nextid_tag.sql")
        sql_creation = QUERY_NEXTID_TAG
        nextId = database_processor.fetch_data_in_database(sql_creation)
        # END - Get nextId
        return ({'nextId': nextId[0][0]}, 201)
예제 #5
0
 def post(self):
     args = postParser.parse_args()
     QUERY_POST_QUANTITY_TYPE = file_processor.read_sql_file(
         "sql/quantity_type/post_quantity_type.sql")
     sql_creation = QUERY_POST_QUANTITY_TYPE.format(
         "\'{}\'".format(args['quantity_type']),
         "\'{}\'".format(args['abbreviation']))
     sql_creation = sql_processor.handleNone(sql_creation)
     database_processor.insert_data_into_database(sql_creation)
     # START Get nextId
     QUERY_NEXTID_QUANTITY_TYPE = file_processor.read_sql_file(
         "sql/quantity_type/nextid_quantity_type.sql")
     sql_creation = QUERY_NEXTID_QUANTITY_TYPE
     nextId = database_processor.fetch_data_in_database(sql_creation)
     # END - Get nextId
     return ({'nextId': nextId[0][0]}, 201)
예제 #6
0
 def post(self):
     args = postParser.parse_args()
     QUERY_POST_INGREDIENT = file_processor.read_sql_file(
         "sql/ingredient/post_ingredient.sql")
     sql_creation = QUERY_POST_INGREDIENT.format(
         "\'{}\'".format(args['name']),
         "\'{}\'".format(args['description']))
     sql_creation = sql_processor.handleNone(sql_creation)
     database_processor.insert_data_into_database(sql_creation)
     # START Get nextId
     QUERY_NEXTID_INGREDIENT = file_processor.read_sql_file(
         "sql/ingredient/nextid_ingredient.sql")
     sql_creation = QUERY_NEXTID_INGREDIENT
     pk_autofill = database_processor.fetch_data_in_database_pd_dataframe(
         sql_creation)
     # END - Get nextId
     return ({'pk_autofill': pk_autofill}, 201)