def get(self):

        try:

            results = DB_query.get(insurance_partdamage)
            # print("results--------",results)
            response = {}

            for index, res in enumerate(results):
                response[index] = {
                    "id": res.id,
                    "side": res.side,
                    "ref_num": res.ref_num,
                    "part_name": res.part_name,
                    "coordinates": res.coordinates,
                    "picture": res.picture,
                    "intensity": res.intensity,
                    "created_at": str(res.created_at),
                    "updated_at": str(res.updated_at),
                    "part_id": res.part_id,
                    "vehicle_id": res.vehicle_id,
                    "file_name": res.file_name,
                    "is_fp": res.is_fp,
                    "source_name": res.source_name
                }

            return jsonify(response)

        except Exception as e:
            return {"error": str(e)}
    def get(self):

        try:

            results = DB_query.get(insurance_vehicle)
            response = {}

            for index, res in enumerate(results):
                response[index] = {
                    "id": res.id,
                    "ref_num": res.ref_num,
                    "make": res.make,
                    "model": res.model,
                    "score": res.score,
                    "result": res.result,
                    "num_plate": res.num_plate,
                    "comment": res.comment,
                    "created_at": str(res.created_at),
                    "updated_at": str(res.updated_at),
                    "source_name": res.source_name,
                    "claim_state": res.claim_state,
                    "user_id": res.user_id,
                    "image_count": res.image_count,
                    "reviewer_comment": res.reviewer_comment
                }

            return jsonify(response)

        except Exception as e:
            return {"Error": str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))
    def get(self):
        try:
            results = DB_query.get(insurance_damage)

            response = {}

            for index, res in enumerate(results):
                print(res.ref_num)
                path = "media/car_image/" + res.ref_num + '/' + res.file_name

                response[index] = {
                    "coordinates": res.original_coordinates,
                    "image_path": path,
                }

            return jsonify(response)

        except Exception as e:
            return {"error": str(e)}
    def get(self):
        try:
            results = DB_query.get(insurance_carimage)
            response = {}
            for index, res in enumerate(results):
                response[index] = {
                "id": res.id,
                "name": res.name,
                "ref_num": res.ref_num,
                "picture": res.picture,
                "created_at": res.created_at,
                "updated_at": res.updated_at,
                "vehicle_id": res.vehicle_id,
                "side": res.side
                }
            return jsonify(response)

        except Exception as e:
            return {"Error" : str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))
Exemple #5
0
    def get(self):

        try:
            results = DB_query.get(insurance_partdamage)
            print("results------------", results)

            response = {}

            for index, res in enumerate(results):
                part_id = res.part_id
                result_part = db.session.query(insurance_part.picture).filter_by(id = part_id)
                response[index] = {
                "coordinates": res.coordinates,
                "image_path": result_part[0].picture,
                }

            return jsonify(response)

        except Exception as e:
            return {"error" : str(e)}
    def get(self):
        try:
            results = DB_query.get(insurance_damage)
            response = {}
            for index, res in enumerate(results):
                response[index] = {
                    "id": res.id,
                    "side": res.side,
                    "ref_num": res.ref_num,
                    "bounds": res.bounds,
                    "original_coordinates": res.original_coordinates,
                    "edited_coordinates": res.edited_coordinates,
                    "picture": res.picture,
                    "created_at": res.created_at,
                    "updated_at": res.updated_at,
                    "vehicle_id": res.vehicle_id,
                    "file_name": res.file_name
                }
            return jsonify(response)

        except Exception as e:
            return {"Error": str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))