Exemple #1
0
    def build_query(cls, args):
        vendor = VendorController.get({"name": args.get("vendor")})

        query = Product.query.filter_by(vendor=vendor)

        # Search by term
        if args.get("search"):
            search = args.get("search").lower().replace("%",
                                                        "").replace("_", "")
            query = query.filter(Product.name.like("%{}%".format(search)))

        return query, {}
Exemple #2
0
    def build_query(cls, args):
        if "vendor" in args:
            vendor = VendorController.get({"name": args.get("vendor")})
            query = cls.model.query.filter_by(vendor=vendor)
        else:
            query = cls.model.query

        # Search by term
        if args.get("search"):
            search = (args.get("search").lower().replace("%", "").replace(
                "_", "").replace(" ", "_"))
            query = query.filter(Product.name.like("%{}%".format(search)))

        return query, {}
Exemple #3
0
 def get(cls, filters):
     vendor = VendorController.get({"name": filters.get("vendor")})
     return super(ProductController, cls).get({
         "vendor_id": vendor.id,
         "name": filters.get("product")
     })
Exemple #4
0
 def get(self, name):
     VendorController.get({"name": name})
     return CveController.list_items({**request.args, "vendor": name})
Exemple #5
0
 def get(self, name):
     return VendorController.get({"name": name})