Skip to content

Commit

Permalink
Support for filtering interior by category
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinPayravi committed Nov 13, 2024
1 parent aefebf9 commit 2aa8f50
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
13 changes: 13 additions & 0 deletions nookipedia/cargo.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,19 @@ def get_tool_list(limit, tables, fields):
def get_interior_list(limit, tables, fields):
where = []

if "category" in request.args:
categories_list = ["rugs", "wallpaper", "floors"]
category = request.args.get("category").lower()
if category not in categories_list:
abort(
400,
description=error_response(
"Could not recognize provided category.",
"Ensure category is either rugs, wallpaper, or floors.",
),
)
where.append('category = "{0}"'.format(category))

if "color" in request.args:
colors_list = [
"aqua",
Expand Down
12 changes: 11 additions & 1 deletion static/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ paths:
- Housewares
- Miscellaneous
- Wall-mounted
description: Specify the category of furniture to return (houswares, miscellaneous, or wall-mounted).
description: Specify the category of furniture to return (housewares, miscellaneous, or wall-mounted).
- in: query
name: color
required: false
Expand Down Expand Up @@ -983,6 +983,16 @@ paths:
schema:
type: string
description: 'The version of the API you are calling, written as `1.0.0`. This is specified as required as good practice, but it is not actually enforced by the API. If you do not specify a version, you will be served the latest version, which may eventually result in breaking changes.'
- in: query
name: category
required: false
schema:
type: string
enum:
- Rugs
- Wallpaper
- Floors
description: Specify the category of interior items to return (rugs, wallpaper, or floors).
- in: query
name: color
required: false
Expand Down

0 comments on commit 2aa8f50

Please sign in to comment.