Moving things to use the common_route_params and unified functions for SQL enable and SQL LIMIT OFFSET

This commit is contained in:
Scott Idem
2022-01-17 18:57:31 -05:00
parent 9efaa2bf61
commit 6b21a33625
9 changed files with 139 additions and 134 deletions

View File

@@ -33,16 +33,18 @@ class Common_Route_Params:
self,
x_account_id: int,
x_account_id_random: str,
limit: int = 10,
enabled: str = 'enabled',
limit: int = 10,
offset: int = 0,
by_alias: bool = True,
exclude_unset: bool = True,
response = None,
):
self.x_account_id = x_account_id
self.x_account_id_random = x_account_id_random
self.limit = limit
self.enabled = enabled
self.limit = limit
self.offset = offset
self.by_alias = by_alias
self.exclude_unset = exclude_unset
self.response = response
@@ -56,6 +58,7 @@ async def common_route_params(
x_account_id: str = Header(..., min_length=11, max_length=22),
enabled: str = 'enabled', # all, enabled, disabled
limit: int = 100,
offset: int = 0,
by_alias: bool = True,
exclude_none: Optional[bool] = True,
exclude_unset: bool = True,
@@ -82,7 +85,7 @@ async def common_route_params(
log.warning(f'The x-account-id Account ID was not found. Account ID: {x_account_id}')
raise HTTPException(status_code=403, detail='The x-account-id Account ID was not found.') # Forbidden
commons = Common_Route_Params( x_account_id=x_account_id, x_account_id_random=x_account_id_random, limit=limit, enabled=enabled, by_alias=by_alias, exclude_unset=exclude_unset, response=response )
commons = Common_Route_Params( x_account_id=x_account_id, x_account_id_random=x_account_id_random, limit=limit, offset=offset, enabled=enabled, by_alias=by_alias, exclude_unset=exclude_unset, response=response )
log.debug(commons)