finished unit page

This commit is contained in:
smilerz
2021-09-06 14:00:32 -05:00
parent 84744560e0
commit c9d1a9b551
17 changed files with 76 additions and 31 deletions

View File

@@ -24,6 +24,11 @@ class RecipeSchema(AutoSchema):
"description": 'Id of food a recipe should have. For multiple repeat parameter.',
'schema': {'type': 'string', },
})
parameters.append({
"name": 'units', "in": "query", "required": False,
"description": 'Id of unit a recipe should have.',
'schema': {'type': 'int', },
})
parameters.append({
"name": 'books', "in": "query", "required": False,
"description": 'Id of book a recipe should have. For multiple repeat parameter.',
@@ -85,3 +90,18 @@ class TreeSchema(AutoSchema):
'schema': {'type': 'int', },
})
return parameters
class FilterSchema(AutoSchema):
def get_path_parameters(self, path, method):
if not is_list_view(path, method, self.view):
return super(FilterSchema, self).get_path_parameters(path, method)
api_name = path.split('/')[2]
parameters = super().get_path_parameters(path, method)
parameters.append({
"name": 'query', "in": "query", "required": False,
"description": 'Query string matched against {} name.'.format(api_name),
'schema': {'type': 'string', },
})
return parameters