Exemplo n.º 1
0
 def mutate(root, info, area_data=None):
     try:
         area = AreaModel(**area_data)
         db_session.add(area)
         db_session.commit()
     except BaseException as err:
         db_session.rollback()
         raise GraphQLError("Error inserting Area... {}".format(err))
Exemplo n.º 2
0
 def mutate(root, info, catalog_data=None):
     try:
         catalog = CatalogModel(**catalog_data)
         db_session.add(catalog)
         db_session.commit()
     except BaseException as err:
         db_session.rollback()
         raise GraphQLError("Error inserting Catalog... {}".format(err))
Exemplo n.º 3
0
 def mutate(root, info, item_data=None):
     try:
         item = ItemModel(**item_data)
         db_session.add(item)
         db_session.commit()
     except BaseException as err:
         db_session.rollback()
         raise GraphQLError("Error inserting Item... {}".format(err))
Exemplo n.º 4
0
 def mutate(root, info, task_data=None):
     try:
         task = TaskModel(**task_data)
         db_session.add(task)
         db_session.commit()
         return CreateTask(task=task, status=True)
     except BaseException as err:
         db_session.rollback()
         raise GraphQLError("Error inserting Task... {}".format(err))
Exemplo n.º 5
0
 def mutate(root, info, task_data=None):
     try:
         query = Task.get_query(info)
         task = TaskModel(task_id=task_data.task_id)
         query.filter(TaskModel.task_id == task.task_id).update(task_data)
         db_session.commit()
         return EditTask(task=task, status=True)
     except BaseException as err:
         db_session.rollback()
         raise GraphQLError("Error edit Task... {}".format(err))