Ejemplo n.º 1
0
    def insertWater(self, json):
        supplier_id = json["supplier_id"]
        category_id = json["category_id"]
        water_name = json["water_name"]
        water_brand = json["water_brand"]
        water_quantity = json["water_quantity"]
        water_price = json["water_price"]
        water_size = json["water_size"]
        water_container = json["water_container"]
        water_type = json["water_type"]
        water_exp_date = json["water_exp_date"]

        if supplier_id and category_id and water_name and water_brand and water_quantity and (
                water_price >= 0
        ) and water_size and water_container and water_type and water_exp_date:
            resource_dao = ResourceDAO()
            resource_id = resource_dao.insert(supplier_id, category_id,
                                              water_name, water_brand,
                                              water_quantity, water_price)
            water_dao = WaterDAO()
            water_id = water_dao.insert(resource_id, water_size,
                                        water_container, water_type,
                                        water_exp_date)
            result = self.build_water_attributes(water_id, resource_id,
                                                 supplier_id, category_id,
                                                 water_name, water_brand,
                                                 water_quantity, water_price,
                                                 water_size, water_container,
                                                 water_type, water_exp_date)
            return jsonify(Water=result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 400
Ejemplo n.º 2
0
    def updateWater(self, water_id, json):
        water_dao = WaterDAO()
        if not water_dao.getWaterById(water_id):
            return jsonify(Error="Water not found."), 404
        else:
            supplier_id = json["supplier_id"]
            category_id = json["category_id"]
            water_name = json["water_name"]
            water_brand = json["water_brand"]
            water_quantity = json["water_quantity"]
            water_price = json["water_price"]
            water_size = json["water_size"]
            water_container = json["water_container"]
            water_type = json["water_type"]
            water_exp_date = json["water_exp_date"]

            if supplier_id and category_id and water_name and water_brand and water_quantity and (
                    water_price >= 0
            ) and water_size and water_container and water_type and water_exp_date:
                resource_id = water_dao.update(water_id, water_size,
                                               water_container, water_type,
                                               water_exp_date)
                resource_dao = ResourceDAO()
                resource_dao.update(resource_id, supplier_id, category_id,
                                    water_name, water_brand, water_quantity,
                                    water_price)
                result = self.build_water_attributes(
                    water_id, resource_id, supplier_id, category_id,
                    water_name, water_brand, water_quantity, water_price,
                    water_size, water_container, water_type, water_exp_date)
                return jsonify(Water=result), 200
            else:
                return jsonify(
                    Error="Unexpected attributes in update request"), 400
Ejemplo n.º 3
0
    def updateGenerator(self, generator_id, json):
        generator_dao = GeneratorDAO()
        if not generator_dao.getGeneratorById(generator_id):
            return jsonify(Error="Generator not found."), 404
        else:
            supplier_id = json['supplier_id']
            category_id = json['category_id']
            generator_name = json['generator_name']
            generator_brand = json['generator_brand']
            generator_quantity = json['generator_quantity']
            generator_price = json['generator_price']
            power_capacity = json['power_capacity']
            power_condition = json['power_condition']
            generator_fuel = json['generator_fuel']

            if supplier_id and category_id and generator_name and generator_brand and generator_quantity and (
                    generator_price >= 0
            ) and power_capacity and power_condition and generator_fuel:
                resource_id = generator_dao.update(generator_id,
                                                   power_capacity,
                                                   power_condition,
                                                   generator_fuel)
                res_dao = ResourceDAO()
                res_dao.update(resource_id, supplier_id, category_id,
                               generator_name, generator_brand,
                               generator_quantity, generator_price)
                result = self.build_generator_attributes(
                    supplier_id, resource_id, generator_id, category_id,
                    generator_name, generator_brand, generator_quantity,
                    generator_price, power_capacity, power_condition,
                    generator_fuel)
                return jsonify(Generator=result), 200
            else:
                return jsonify(
                    Error="Unexpected attributes in update request"), 400
Ejemplo n.º 4
0
    def insertFood(self, json):
        supplier_id = json["supplier_id"]
        category_id = json["category_id"]
        food_name = json["food_name"]
        food_brand = json["food_brand"]
        food_quantity = json["food_quantity"]
        food_price = json["food_price"]
        food_category = json["food_category"]
        food_container = json["food_container"]
        food_type = json["food_type"]
        food_ounces = json["food_ounces"]
        food_expdate = json["food_expdate"]

        if supplier_id and category_id and food_name and food_brand and (
                food_quantity >= 0
        ) and (
                food_price >= 0
        ) and food_category and food_container and food_type and food_ounces and food_expdate:
            resource_dao = ResourceDAO()
            resource_id = resource_dao.insert(supplier_id, category_id,
                                              food_name, food_brand,
                                              food_quantity, food_price)
            food_dao = FoodDAO()
            food_id = food_dao.insert(resource_id, food_category,
                                      food_container, food_type, food_ounces,
                                      food_expdate)
            result = self.build_food_attributes(
                food_id, resource_id, supplier_id, category_id, food_name,
                food_brand, food_quantity, food_price, food_category,
                food_container, food_type, food_ounces, food_expdate)
            return jsonify(Food=result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 400
Ejemplo n.º 5
0
    def insertGenerator(self, json):
        supplier_id = json['supplier_id']
        category_id = json['category_id']
        generator_name = json['generator_name']
        generator_brand = json['generator_brand']
        generator_quantity = json['generator_quantity']
        generator_price = json['generator_price']
        power_capacity = json['power_capacity']
        power_condition = json['power_condition']
        generator_fuel = json['generator_fuel']

        if supplier_id and category_id and generator_name and generator_brand and generator_quantity and (
                generator_price >=
                0) and power_capacity and power_condition and generator_fuel:
            res_dao = ResourceDAO()
            resource_id = res_dao.insert(supplier_id, category_id,
                                         generator_name, generator_brand,
                                         generator_quantity, generator_price)
            generator_dao = GeneratorDAO()
            generator_id = generator_dao.insert(resource_id, power_capacity,
                                                power_condition,
                                                generator_fuel)
            result = self.build_generator_attributes(
                supplier_id, resource_id, generator_id, category_id,
                generator_name, generator_brand, generator_quantity,
                generator_price, power_capacity, power_condition,
                generator_fuel)
            return jsonify(Generator=result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 400
Ejemplo n.º 6
0
    def updateHeavyEquip(self, hequip_id, json):
        hequip_dao = HeavyEquipDAO()
        if not hequip_dao.getHeavyEquipById(hequip_id):
            return jsonify(Error="Heavy Equipment not found."), 404
        else:
            supplier_id = json["supplier_id"]
            category_id = json["category_id"]
            hequip_name = json["hequip_name"]
            hequip_brand = json["hequip_brand"]
            hequip_quantity = json["hequip_quantity"]
            hequip_price = json["hequip_price"]
            hequip_type = json["hequip_type"]
            hequip_model = json["hequip_model"]
            hequip_condition = json["hequip_condition"]

            if supplier_id and category_id and hequip_name and hequip_brand and hequip_quantity and (
                    hequip_price >=
                    0) and hequip_type and hequip_model and hequip_condition:
                resource_id = hequip_dao.update(hequip_id, hequip_type,
                                                hequip_model, hequip_condition)
                resource_dao = ResourceDAO()
                resource_dao.update(resource_id, supplier_id, category_id,
                                    hequip_name, hequip_brand, hequip_quantity,
                                    hequip_price)
                result = self.build_hequip_attributes(
                    hequip_id, resource_id, supplier_id, category_id,
                    hequip_name, hequip_brand, hequip_quantity, hequip_price,
                    hequip_type, hequip_model, hequip_condition)
                return jsonify(HeavyEquipment=result), 200
            else:
                return jsonify(
                    Error="Unexpected attributes in update request"), 400
Ejemplo n.º 7
0
    def insertHeavyEquip(self, json):
        supplier_id = json["supplier_id"]
        category_id = json["category_id"]
        hequip_name = json["hequip_name"]
        hequip_brand = json["hequip_brand"]
        hequip_quantity = json["hequip_quantity"]
        hequip_price = json["hequip_price"]
        hequip_type = json["hequip_type"]
        hequip_model = json["hequip_model"]
        hequip_condition = json["hequip_condition"]

        if supplier_id and category_id and hequip_name and hequip_brand and hequip_quantity and (
                hequip_price >=
                0) and hequip_type and hequip_model and hequip_condition:
            resource_dao = ResourceDAO()
            resource_id = resource_dao.insert(supplier_id, category_id,
                                              hequip_name, hequip_brand,
                                              hequip_quantity, hequip_price)
            hequip_dao = HeavyEquipDAO()
            hequip_id = hequip_dao.insert(resource_id, hequip_type,
                                          hequip_model, hequip_condition)
            result = self.build_hequip_attributes(
                hequip_id, resource_id, supplier_id, category_id, hequip_name,
                hequip_brand, hequip_quantity, hequip_price, hequip_type,
                hequip_model, hequip_condition)
            return jsonify(HeavyEquipment=result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 400
Ejemplo n.º 8
0
 def deleteResource(self, r_id):
     dao = ResourceDAO()
     if not dao.getResourceById(r_id):
         return jsonify(Error = "Resource not found."), 404
     else:
         dao.delete(r_id)
         return jsonify(DeleteStatus = "OK"), 200
Ejemplo n.º 9
0
    def insertMedicine(self, json):
        supplier_id = json["supplier_id"]
        category_id = json["category_id"]
        med_name = json["med_name"]
        med_brand = json["med_brand"]
        med_quantity = json["med_quantity"]
        med_price = json["med_price"]
        med_type = json["med_type"]
        med_dose = json["med_dose"]
        med_prescript = json["med_prescript"]
        med_expdate = json["med_expdate"]

        if supplier_id and category_id and med_name and med_brand and med_quantity and (
                med_price >=
                0) and med_type and med_dose and med_prescript and med_expdate:
            resource_dao = ResourceDAO()
            resource_id = resource_dao.insert(supplier_id, category_id,
                                              med_name, med_brand,
                                              med_quantity, med_price)
            med_dao = MedicineDAO()
            med_id = med_dao.insert(resource_id, med_type, med_dose,
                                    med_prescript, med_expdate)
            result = self.build_medicine_attributes(med_id, resource_id,
                                                    supplier_id, category_id,
                                                    med_name, med_brand,
                                                    med_quantity, med_price,
                                                    med_type, med_dose,
                                                    med_prescript, med_expdate)
            return jsonify(Medicine=result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 400
Ejemplo n.º 10
0
 def searchResource(self, args):
     category = args.get("category")
     name = args.get("name")
     type = args.get("type")
     dao = ResourceDAO()
     resources_list = []
     if (len(args) == 3) and category and name and type:
         resources_list = dao.getResourceByCategoryTypeAndName(category, type, name)
     elif (len(args) == 2) and category and name:
         resources_list = dao.getResourceByCategoryAndName(category, name)
     elif (len(args) == 2) and category and type:
         resources_list = dao.getResourceByCategoryAndType(category, type)
     elif (len(args) == 2) and type and name:
         resources_list = dao.getResourceByTypeAndName(type, name)
     elif (len(args) == 1) and category:
         resources_list = dao.getResourceByCategory(category)
     elif (len(args) == 1) and type:
         resources_list = dao.getResourceByType(type)
     elif (len(args) == 1) and name:
         resources_list = dao.getResourceByName(name)
     else:
         return jsonify(Error = "Malformed query string"), 400
     if not resources_list:
         return jsonify(Error="Resource Not Found"), 404
     else:
         result_list = []
         for row in resources_list:
             result = self.build_resource_dict(row)
             result_list.append(result)
     return jsonify(Resources=result_list)
Ejemplo n.º 11
0
 def searchResources(self, args):
     region = args.get('region')
     category = args.get('category')
     name = args.get('name')
     dao = ResourceDAO()
     if (len(args) == 2) and region and name:
         resource_list = dao.getResourcesByRegionAndName(region, name)
     elif (len(args) == 2) and name and category:
         resource_list = dao.getResourcesByCategoryAndName(name, category)
     elif (len(args) == 1) and region:
         resource_list = dao.getResourcesByRegion(region)
     elif (len(args) == 1) and name:
         resource_list = dao.getResourcesByName(name)
     elif (len(args) == 1) and category:
         resource_list = dao.getResourcesByCategory(category)
     else:
         return jsonify(Error="Malformed query string"), 400
     if not resource_list:
         return jsonify(Error="Resource Not Found"), 404
     else:
         result_list = []
         for row in resource_list:
             result = self.build_resource_dict(row)
             result_list.append(result)
     return jsonify(Resource=result_list)
Ejemplo n.º 12
0
    def insertFuel(self, json):
        supplier_id = json["supplier_id"]
        category_id = json["category_id"]
        fuel_name = json["fuel_name"]
        fuel_brand = json["fuel_brand"]
        fuel_quantity = json["fuel_quantity"]
        fuel_price = json["fuel_price"]
        fuel_type = json["fuel_type"]
        fuel_gallons = json["fuel_gallons"]

        if supplier_id and category_id and fuel_name and fuel_brand and (
                fuel_quantity >= 0) and (fuel_price >=
                                         0) and fuel_type and fuel_gallons:
            resource_dao = ResourceDAO()
            resource_id = resource_dao.insert(supplier_id, category_id,
                                              fuel_name, fuel_brand,
                                              fuel_quantity, fuel_price)
            fuel_dao = FuelDAO()
            fuel_id = fuel_dao.insert(resource_id, fuel_type, fuel_gallons)
            result = self.build_fuel_attributes(fuel_id, resource_id,
                                                supplier_id, category_id,
                                                fuel_name, fuel_brand,
                                                fuel_quantity, fuel_price,
                                                fuel_type, fuel_gallons)
            return jsonify(Fuel=result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 400
Ejemplo n.º 13
0
    def updateFuel(self, fuel_id, json):
        fuel_dao = FuelDAO()
        if not fuel_dao.getFuelById(fuel_id):
            return jsonify(Error="Fuel not found."), 404
        else:
            supplier_id = json["supplier_id"]
            category_id = json["category_id"]
            fuel_name = json["fuel_name"]
            fuel_brand = json["fuel_brand"]
            fuel_quantity = json["fuel_quantity"]
            fuel_price = json["fuel_price"]
            fuel_type = json["fuel_type"]
            fuel_gallons = json["fuel_gallons"]

            if supplier_id and category_id and fuel_name and fuel_brand and (
                    fuel_quantity >= 0) and (fuel_price >=
                                             0) and fuel_type and fuel_gallons:
                resource_id = fuel_dao.update(fuel_id, fuel_type, fuel_gallons)
                resource_dao = ResourceDAO()
                resource_dao.update(resource_id, supplier_id, category_id,
                                    fuel_name, fuel_brand, fuel_quantity,
                                    fuel_price)
                result = self.build_fuel_attributes(fuel_id, resource_id,
                                                    supplier_id, category_id,
                                                    fuel_name, fuel_brand,
                                                    fuel_quantity, fuel_price,
                                                    fuel_type, fuel_gallons)
                return jsonify(Fuel=result), 200
            else:
                return jsonify(
                    Error="Unexpected attributes in update request"), 400
Ejemplo n.º 14
0
    def insertCloth(self, json):
        supplier_id = json["supplier_id"]
        category_id = json["category_id"]
        cloth_name = json["cloth_name"]
        cloth_brand = json["cloth_brand"]
        cloth_quantity = json["cloth_quantity"]
        cloth_price = json["cloth_price"]
        cloth_size = json["cloth_size"]
        cloth_material = json["cloth_material"]
        cloth_condition = json["cloth_condition"]
        cloth_gender = json["cloth_gender"]
        cloth_type = json["cloth_type"]

        if supplier_id and category_id and cloth_name and cloth_brand and cloth_quantity and (
                cloth_price >= 0
        ) and cloth_size and cloth_material and cloth_condition and cloth_gender and cloth_type:
            resource_dao = ResourceDAO()
            resource_id = resource_dao.insert(supplier_id, category_id,
                                              cloth_name, cloth_brand,
                                              cloth_quantity, cloth_price)
            cloth_dao = ClothDAO()
            cloth_id = cloth_dao.insert(resource_id, cloth_size,
                                        cloth_material, cloth_condition,
                                        cloth_gender, cloth_type)
            result = self.build_cloth_attributes(
                cloth_id, resource_id, supplier_id, category_id, cloth_name,
                cloth_brand, cloth_quantity, cloth_price, cloth_size,
                cloth_material, cloth_condition, cloth_gender, cloth_type)
            return jsonify(Cloth=result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 400
Ejemplo n.º 15
0
 def getResourceFullInfo(self, resource_id):
     resource_dao = ResourceDAO()
     category = resource_dao.getResourceById(resource_id)[2]
     if category == 1:
         return FuelHandler().getFuelByResourceId(resource_id)
     elif category == 2:
         return FoodHandler().getFoodByResourceId(resource_id)
     elif category == 3:
         return MedicineHandler().getMedicineByResourceId(resource_id)
     elif category == 4:
         return ToolHandler().getToolByResourceId(resource_id)
     elif category == 5:
         return ClothHandler().getClothByResourceId(resource_id)
     elif category == 6:
         return HeavyEquipHandler().getHeavyEquipByResourceId(resource_id)
     elif category == 7:
         return WaterHandler().getWaterByResourceId(resource_id)
     elif category == 8:
         return MedDeviceHandler().getMedDeviceByResourceId(resource_id)
     elif category == 9:
         return BatteryHandler().getBatteryByResourceId(resource_id)
     elif category == 10:
         return GeneratorHandler().getGeneratorByResourceId(resource_id)
     elif category == 11:
         return IceHandler().getIceByResourceId(resource_id)
     else:
         return jsonify(Error="Invalid category"), 400
Ejemplo n.º 16
0
    def updateMedicine(self, med_id, json):
        med_dao = MedicineDAO()
        if not med_dao.getMedicineById(med_id):
            return jsonify(Error="Medicine not found."), 404
        else:
            supplier_id = json["supplier_id"]
            category_id = json["category_id"]
            med_name = json["med_name"]
            med_brand = json["med_brand"]
            med_quantity = json["med_quantity"]
            med_price = json["med_price"]
            med_type = json["med_type"]
            med_dose = json["med_dose"]
            med_prescript = json["med_prescript"]
            med_expdate = json["med_expdate"]

            if supplier_id and category_id and med_name and med_brand and med_quantity and (
                    med_price >= 0
            ) and med_type and med_dose and med_prescript and med_expdate:
                resource_id = med_dao.update(med_id, med_type, med_dose,
                                             med_prescript, med_expdate)
                resource_dao = ResourceDAO()
                resource_dao.update(resource_id, supplier_id, category_id,
                                    med_name, med_brand, med_quantity,
                                    med_price)

                result = self.build_medicine_attributes(
                    med_id, resource_id, supplier_id, category_id, med_name,
                    med_brand, med_quantity, med_price, med_type, med_dose,
                    med_prescript, med_expdate)
                return jsonify(Medicine=result), 200
            else:
                return jsonify(
                    Error="Unexpected attributes in update request"), 400
Ejemplo n.º 17
0
 def getAvailableResourcesByCity(self, args):
     dao = ResourceDAO()
     city = args.get('SCity')
     region = args.get('SRegion')
     resource_name = args.get('RName')
     resource_list = []
     if (len(args) == 1) and city:
         resource_list = dao.getAvailableResourcesByCity(city)
     elif (len(args) == 1) and region:
         resource_list = dao.getAvailableResourcesByRegion(region)
     elif (len(args) == 1) and resource_name:
         resource_list = dao.getAvailableResourcesByName(resource_name)
     elif (len(args) == 2) and resource_name and city:
         resource_list = dao.getAvailableResourcesByNameAndCity(
             resource_name, city)
     elif (len(args) == 2) and resource_name and region:
         resource_list = dao.getAvailableResourcesByNameAndRegion(
             resource_name, region)
     else:
         return jsonify(Error="Malformed query string"), 400
     if not resource_list:
         return jsonify(Error="Resource Not Found"), 404
     result_list = []
     for row in resource_list:
         result = self.build_available_resource_dict(row)
         result_list.append(result)
     return jsonify(Resource=result_list)
Ejemplo n.º 18
0
 def getResourceById(self, resource_id):
     resource_dao = ResourceDAO()
     row = resource_dao.getResourceById(resource_id)
     if not row:
         return jsonify(Error="Resource not found"), 404
     else:
         resource = self.build_resource_dict(row)
         return jsonify(Resource=resource)
Ejemplo n.º 19
0
 def getAllResources(self):
     resouce_dao = ResourceDAO()
     resource_list = resouce_dao.getAllResources()
     result_list = []
     for row in resource_list:
         result = self.build_resource_dict(row)
         result_list.append(result)
     return jsonify(Resources=result_list)
Ejemplo n.º 20
0
    def getAll(self):
        items = ResourceDAO().getAllResource()
        result = []
        for i in items:
            toAdd = self.build_resource_dict(i)
            result.append(toAdd)

        return jsonify(Resources=result)
Ejemplo n.º 21
0
 def getResourceAvailablePerRegion(self):
     dao = ResourceDAO()
     resource_list = dao.getResourceAvailablePerRegion()
     result_list = []
     for row in resource_list:
         result = self.build_reqs_stats_per_region_dict(row)
         result_list.append(result)
     return jsonify(Resource=result_list)
Ejemplo n.º 22
0
 def getResourcesInStock(self):
     dao = ResourceDAO()
     resources_list = dao.getResourcesInStock()
     result_list = []
     for row in resources_list:
         result = self.build_resource_dict(row)
         result_list.append(result)
     return jsonify(Resources=result_list)
Ejemplo n.º 23
0
 def getResourceById(self, r_id):
     dao = ResourceDAO()
     resources_list= dao.getResourceById(r_id)
     if not resources_list:
         return jsonify(Error="Resource Not Found"), 404
     else:
         result = self.build_resource_dict(resources_list)
     return jsonify(Resource=result)
Ejemplo n.º 24
0
 def getResourceByID(self, rid):
     dao = ResourceDAO()
     row = dao.getResourceByID(rid)
     if not row:
         return jsonify(Error="Resource Not Found"), 404
     else:
         resource = self.build_resource_dict(row)
         return jsonify(Resource=resource)
Ejemplo n.º 25
0
 def getAllResourceByKeyword(self, keyword):
     dao = ResourceDAO()
     Resources_list = dao.getResourceByKeyWord(keyword)
     result_list = []
     for row in Resources_list:
         result = self.build_resource_dict(row)
         result_list.append(result)
     return jsonify(Resources=result_list)
Ejemplo n.º 26
0
 def deleteBaterry(self, battery_id):
     battery_dao = BatteryDAO()
     if not battery_dao.getBatteryById(battery_id):
         return jsonify(Error = "Battery not found."), 404
     else:
         resource_id = battery_dao.delete(battery_id)
         res_dao = ResourceDAO()
         res_dao.delete(resource_id)
         return jsonify(DeleteStatus = "OK"), 200
Ejemplo n.º 27
0
 def deleteMedDevice(self, med_device_id):
     med_device_dao = MedDeviceDAO()
     if not med_device_dao.getMedDeviceById(med_device_id):
         return jsonify(Error = "Medical Device not found."), 404
     else:
         resource_id = med_device_dao.delete(med_device_id)
         resource_dao = ResourceDAO()
         resource_dao.delete(resource_id)
         return jsonify(DeleteStatus = "OK"), 200
Ejemplo n.º 28
0
 def deleteWater(self, water_id):
     water_dao = WaterDAO()
     if not water_dao.getWaterById(water_id):
         return jsonify(Error="Water not found."), 404
     else:
         resource_id = water_dao.delete(water_id)
         resource_dao = ResourceDAO()
         resource_dao.delete(resource_id)
         return jsonify(DeleteStatus="OK"), 200
Ejemplo n.º 29
0
 def updateResource(self, r_id, form):
     dao = ResourceDAO()
     if not dao.getResourceById(r_id):
         return jsonify(Error = "Resource not found."), 404
     else:
         if len(form) != 3:
             return jsonify(Error="Malformed update Resource"), 400
         else:
             r_name = form['r_name']
             r_category = form['r_category']
             r_type = form['r_type']
             if r_name and r_category and r_type:
                 dao = ResourceDAO()
                 dao.update(r_id, r_name, r_category, r_type)
                 result = self.build_resource_attributes(r_id, r_name, r_category, r_type)
                 return jsonify(Resource=result), 201
             else:
                 return jsonify(Error="Unexpected attributes in update Resource"), 400
Ejemplo n.º 30
0
 def deleteFuel(self, fuel_id):
     fuel_dao = FuelDAO()
     if not fuel_dao.getFuelById(fuel_id):
         return jsonify(Error="Fuel not found."), 404
     else:
         resource_id = fuel_dao.delete(fuel_id)
         resource_dao = ResourceDAO()
         resource_dao.delete(resource_id)
         return jsonify(DeleteStatus="OK"), 200