Showing
3 changed files
with
16 additions
and
12 deletions
| ... | @@ -40,14 +40,14 @@ app = FastAPI( | ... | @@ -40,14 +40,14 @@ app = FastAPI( |
| 40 | CacheMiddleware, | 40 | CacheMiddleware, |
| 41 | cache=cache.cache, | 41 | cache=cache.cache, |
| 42 | rules=[ | 42 | rules=[ |
| 43 | - Rule(match=re.compile(r"^/prespuesto/api/_metrics/.*"), ttl=0), | 43 | + Rule(match=re.compile(r"^/presupuesto/api/_metrics/.*"), ttl=0), |
| 44 | - Rule(match=re.compile(r"^/prespuesto/api/search/.*"), ttl=0), | 44 | + Rule(match=re.compile(r"^/presupuesto/api/search/.*"), ttl=0), |
| 45 | - Rule(match=re.compile(r"^/prespuesto/api/programa_proyecto/.*"), ttl=0), | 45 | + Rule(match=re.compile(r"^/presupuesto/api/programa_proyecto/.*"), ttl=0), |
| 46 | - Rule(match=re.compile(r'^/prespuesto/api/.+'), ttl=86400, status=200), | 46 | + Rule(match=re.compile(r'^/presupuesto/api/.+'), ttl=86400, status=200), |
| 47 | ], | 47 | ], |
| 48 | ), | 48 | ), |
| 49 | ], | 49 | ], |
| 50 | - root_path='/prespuesto/api' | 50 | + root_path='/presupuesto/api' |
| 51 | ) | 51 | ) |
| 52 | 52 | ||
| 53 | app.include_router(entity.router_entidad) | 53 | app.include_router(entity.router_entidad) | ... | ... |
| ... | @@ -73,7 +73,7 @@ def fetch_programa_proyecto_proyectos( | ... | @@ -73,7 +73,7 @@ def fetch_programa_proyecto_proyectos( |
| 73 | 73 | ||
| 74 | @router.get('/{project_id}/objetos', response_model=List[schemas.project.ProyectoClasificadores]) | 74 | @router.get('/{project_id}/objetos', response_model=List[schemas.project.ProyectoClasificadores]) |
| 75 | def fetch_programa_proyecto_objetos( | 75 | def fetch_programa_proyecto_objetos( |
| 76 | - project_id: int, | 76 | + project_id: str, |
| 77 | db: Session = Depends(model.get_db), | 77 | db: Session = Depends(model.get_db), |
| 78 | query: schema.QueryParamsPaginated = Depends(), | 78 | query: schema.QueryParamsPaginated = Depends(), |
| 79 | ): | 79 | ): |
| ... | @@ -82,7 +82,7 @@ def fetch_programa_proyecto_objetos( | ... | @@ -82,7 +82,7 @@ def fetch_programa_proyecto_objetos( |
| 82 | 82 | ||
| 83 | @router.get('/{project_id}/finfuns', response_model=List[schemas.project.ProyectoClasificadores]) | 83 | @router.get('/{project_id}/finfuns', response_model=List[schemas.project.ProyectoClasificadores]) |
| 84 | def fetch_programa_proyecto_finfuns( | 84 | def fetch_programa_proyecto_finfuns( |
| 85 | - project_id: int, | 85 | + project_id: str, |
| 86 | db: Session = Depends(model.get_db), | 86 | db: Session = Depends(model.get_db), |
| 87 | query: schema.QueryParamsPaginated = Depends(), | 87 | query: schema.QueryParamsPaginated = Depends(), |
| 88 | ): | 88 | ): |
| ... | @@ -91,7 +91,7 @@ def fetch_programa_proyecto_finfuns( | ... | @@ -91,7 +91,7 @@ def fetch_programa_proyecto_finfuns( |
| 91 | 91 | ||
| 92 | @router.get('/{project_id}/actecos', response_model=List[schemas.project.ProyectoClasificadores]) | 92 | @router.get('/{project_id}/actecos', response_model=List[schemas.project.ProyectoClasificadores]) |
| 93 | def fetch_programa_proyecto_actecos( | 93 | def fetch_programa_proyecto_actecos( |
| 94 | - project_id: int, | 94 | + project_id: str, |
| 95 | db: Session = Depends(model.get_db), | 95 | db: Session = Depends(model.get_db), |
| 96 | query: schema.QueryParamsPaginated = Depends(), | 96 | query: schema.QueryParamsPaginated = Depends(), |
| 97 | ): | 97 | ): |
| ... | @@ -120,6 +120,8 @@ def get_clasificadores(db, tipo_codigo, programa_proyecto, query): | ... | @@ -120,6 +120,8 @@ def get_clasificadores(db, tipo_codigo, programa_proyecto, query): |
| 120 | if query.gestion is not None: | 120 | if query.gestion is not None: |
| 121 | filters.append(ProyectoClasificadores.gestion == query.gestion) | 121 | filters.append(ProyectoClasificadores.gestion == query.gestion) |
| 122 | 122 | ||
| 123 | - return select(*cols).where(*filters).offset( | 123 | + return db.execute( |
| 124 | - (page - 1) * page_size | 124 | + select(*cols).where(*filters).offset( |
| 125 | - ).limit(page_size).mappings().all() | 125 | + (page - 1) * page_size |
| 126 | + ).limit(page_size) | ||
| 127 | + ).mappings().all() | ... | ... |
| ... | @@ -15,6 +15,7 @@ class SearchQueryParams(BaseModel): | ... | @@ -15,6 +15,7 @@ class SearchQueryParams(BaseModel): |
| 15 | is_class: Optional[bool] = Query(default=None) | 15 | is_class: Optional[bool] = Query(default=None) |
| 16 | class_: Optional[str] = Query(default=None) | 16 | class_: Optional[str] = Query(default=None) |
| 17 | 17 | ||
| 18 | + | ||
| 18 | class QueryParams(BaseModel): | 19 | class QueryParams(BaseModel): |
| 19 | id: Optional[str] = Query(default=None) | 20 | id: Optional[str] = Query(default=None) |
| 20 | gestion: Optional[int] = Query(default=None) | 21 | gestion: Optional[int] = Query(default=None) |
| ... | @@ -22,7 +23,8 @@ class QueryParams(BaseModel): | ... | @@ -22,7 +23,8 @@ class QueryParams(BaseModel): |
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | class QueryParamsPaginated(QueryParams): | 25 | class QueryParamsPaginated(QueryParams): |
| 25 | - page: Optiona[int] = Query(default=None) | 26 | + page: Optional[int] = Query(default=None) |
| 27 | + | ||
| 26 | 28 | ||
| 27 | class DailyParams(BaseModel): | 29 | class DailyParams(BaseModel): |
| 28 | transferencias: Optional[bool] = Query(default=False) | 30 | transferencias: Optional[bool] = Query(default=False) | ... | ... |
-
Please register or login to post a comment