pr0nstar

XI

...@@ -26,7 +26,6 @@ router_finfun = APIRouter( ...@@ -26,7 +26,6 @@ router_finfun = APIRouter(
26 ) 26 )
27 27
28 28
29 -
30 ############################################################################### 29 ###############################################################################
31 # GET 30 # GET
32 ############################################################################### 31 ###############################################################################
......
...@@ -7,12 +7,10 @@ from sqlalchemy.orm import Session ...@@ -7,12 +7,10 @@ from sqlalchemy.orm import Session
7 7
8 from presupuestov1 import model, schema, constant, schemas, models, search 8 from presupuestov1 import model, schema, constant, schemas, models, search
9 9
10 -from aiocache import cached
11 -
12 10
13 router = APIRouter( 11 router = APIRouter(
14 - prefix='/proyecto', 12 + prefix='/programa_proyecto',
15 - tags=['proyecto'], 13 + tags=['programa_proyecto'],
16 ) 14 )
17 15
18 16
...@@ -20,37 +18,50 @@ router = APIRouter( ...@@ -20,37 +18,50 @@ router = APIRouter(
20 # GET 18 # GET
21 ############################################################################### 19 ###############################################################################
22 20
23 -# @router.get('/{project_id}', response_model=schemas.project.Project) 21 +@router.get('/{project_id}')
24 -# def fetch_branch( 22 +@not_found
25 -# project_id: int, 23 +def fetch_programa_proyecto(
26 -# db: Session = Depends(model.get_db), 24 + project_id: int,
27 -# ): 25 + db: Session = Depends(model.get_db),
28 -# return models.project.get_project(db, project_id) 26 +):
27 + return []
29 28
30 29
30 +@router.get('/{project_id}/proyectos')
31 +@not_found
32 +def fetch_programa_proyecto_projectos(
33 + project_id: int,
34 + db: Session = Depends(model.get_db),
35 + query: schema.QueryParams = Depends(),
36 +):
37 + return []
31 38
32 -@router.get('/search', response_model=schemas.project.Search) 39 +
33 -def fetch_search( 40 +@router.get('/{project_id}/objetos')
34 - query: schema.SearchQueryParams = Depends(), 41 +@not_found
42 +def fetch_programa_proyecto_objetos(
43 + project_id: int,
44 + db: Session = Depends(model.get_db),
45 + query: schema.QueryParams = Depends(),
35 ): 46 ):
36 - if query.q is None or len(query.q.strip()) < 3: 47 + return []
37 - return {
38 - 'facet_counts': [],
39 - 'found': 0,
40 - 'out_of': 0,
41 - 'page': 0,
42 - 'search_time_ms': 0,
43 - 'hits': [],
44 - }
45 48
46 - return search.do_search(
47 - query.q, query.page, query.is_class, query.class_, query.order
48 - )
49 49
50 +@router.get('/{project_id}/finfuns')
51 +@not_found
52 +def fetch_programa_proyecto_finfuns(
53 + project_id: int,
54 + db: Session = Depends(model.get_db),
55 + query: schema.QueryParams = Depends(),
56 +):
57 + return []
50 58
51 -###############################################################################
52 -# GET
53 -###############################################################################
54 59
55 -def do_search(query, page, is_class, class_): 60 +@router.get('/{project_id}/actecos')
56 - return search.do_search(query, page, is_class, class_) 61 +@not_found
62 +def fetch_programa_proyecto_actecos(
63 + project_id: int,
64 + db: Session = Depends(model.get_db),
65 + query: schema.QueryParams = Depends(),
66 +):
67 + return []
......
1 +from typing import List, Any, Optional, Union
2 +
3 +from fastapi import APIRouter, Depends, Request, HTTPException, Body
4 +from sqlalchemy.orm import Session
5 +
6 +from presupuestov1 import model, schema, constant, schemas, models, search
7 +
8 +
9 +router = APIRouter(
10 + tags=['search']
11 +)
12 +
13 +###############################################################################
14 +# GET
15 +###############################################################################
16 +
17 +@router.get('/search', response_model=schemas.project.Search)
18 +def fetch_search(
19 + query: schema.SearchQueryParams = Depends(),
20 +):
21 + if query.q is None or len(query.q.strip()) < 3:
22 + return {
23 + 'facet_counts': [],
24 + 'found': 0,
25 + 'out_of': 0,
26 + 'page': 0,
27 + 'search_time_ms': 0,
28 + 'hits': [],
29 + }
30 +
31 + return search.do_search(
32 + query.q, query.page, query.is_class, query.class_, query.order
33 + )