def get(self):
        ''' To fetch several observations (Informes de Resultados de la ASENL). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages '''
        try:
            verify_token(request.headers)
        except Exception as err:
            ns.abort(401, message=err)

        offset = request.args.get('offset', '0')
        limit = request.args.get('limit', '10')
        order_by = request.args.get('order_by', 'id')
        order = request.args.get('order', 'ASC')
        per_page = request.args.get('per_page', '10')
        page = request.args.get('page', '1')

        search_params = get_search_params(
            request.args,
            ['tipo_observacion_id', 'observacion_final', 'num_observacion']
        )
        indirect_search_params = get_search_params(
            request.args,
            ['direccion_id', 'auditoria_id', 'dependencia_id', 'anio_cuenta_pub']
        )

        try:
            obs_ires_asenl_list, total_items, total_pages = observaciones_ires_asenl.read_per_page(
                offset, limit, order_by, order, search_params, per_page, page, indirect_search_params
            )
        except psycopg2.Error as err:
            ns.abort(400, message=get_msg_pgerror(err))
        except Exception as err:
            ns.abort(400, message=err)
        
        return obs_ires_asenl_list, 200, {'X-SOA-Total-Items': total_items, 'X-SOA-Total-Pages': total_pages}
Esempio n. 2
0
    def get(self):
        ''' Listado de estatus. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages '''
        try:
            verify_token(request.headers)
        except Exception as err:
            ns.abort(401, message=err)

        offset = request.args.get('offset', '0')
        limit = request.args.get('limit', '10')
        order_by = request.args.get('order_by', 'id')
        order = request.args.get('order', 'ASC')
        per_page = request.args.get('per_page', '10')
        page = request.args.get('page', '1')

        search_params = get_search_params(
            request.args, ['org_fiscal_id', 'pre_ires', 'title'])

        try:
            estatus_list, total_items, total_pages = estatus.read_per_page(
                offset, limit, order_by, order, search_params, per_page, page)
        except EmptySetError as err:
            ns.abort(404, message=err)
        except Exception as err:
            ns.abort(400, message=err)

        return estatus_list, 200, {
            'X-SOA-Total-Items': total_items,
            'X-SOA-Total-Pages': total_pages
        }
    def get(self):
        ''' Listado de programas sociales. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages '''
        try:
            verify_token(request.headers)
        except Exception as err:
            ns.abort(401, message=err)

        offset = request.args.get('offset', '0')
        limit = request.args.get('limit', '10')
        order_by = request.args.get('order_by', 'id')
        order = request.args.get('order', 'ASC')
        per_page = request.args.get('per_page', '10')
        page = request.args.get('page', '1')

        search_params = get_search_params(
            request.args,
            ['title', 'description', 'central', 'paraestatal', 'obra_pub'])

        try:
            programa_soc_list, total_items, total_pages = programas_sociales.read_per_page(
                offset, limit, order_by, order, search_params, per_page, page)
        except psycopg2.Error as err:
            ns.abort(400, message=get_msg_pgerror(err))
        except Exception as err:
            ns.abort(400, message=err)

        return programa_soc_list, 200, {
            'X-SOA-Total-Items': total_items,
            'X-SOA-Total-Pages': total_pages
        }
Esempio n. 4
0
    def get(self):
        ''' To fetch several observations. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages '''

        offset = request.args.get('offset', '0')
        limit = request.args.get('limit', '10')
        order_by = request.args.get('order_by', 'id')
        order = request.args.get('order', 'ASC')
        per_page = request.args.get('per_page', '10')
        page = request.args.get('page', '1')

        search_params = get_search_params(
            request.args,
            [
                'observation_type_id', 'social_program_id', 'audit_id', 'fiscal_id', 'title',
                'observation_code_id', 'observation_bis_code_id', 'doc_a', 'doc_b', 'doc_c',
                'division_id', 'hdr_doc', 'hdr_reception_date', 'hdr_expiration1_date', 'hdr_expiration2_date'
            ]
        )

        try:
            obs_list, total_items, total_pages = observations.read_per_page(
                offset, limit, order_by, order, search_params, per_page, page
            )
        except psycopg2.Error as err:
            ns.abort(400, message=get_msg_pgerror(err))
        except Exception as err:
            ns.abort(400, message=err)

        return obs_list, 200, {'X-SOA-Total-Items': total_items, 'X-SOA-Total-Pages': total_pages}
Esempio n. 5
0
    def get(self):
        ''' To fetch an object containing data for screen fields (key: table name, value: list of table rows) '''
        try:
            verify_token(request.headers)
        except Exception as err:
            ns.abort(401, message=err)

        search_params = get_search_params(request.args, ['direccion_id'])

        try:
            field_catalog = observaciones_sfp.get_catalogs([
                'divisions',
                'audits',
                'dependencies',
                'social_programs',
                'autoridades_invest',
                'clasifs_internas_cytg',
                'observation_types',
                'estatus_sfp',
            ], search_params)
        except psycopg2.Error as err:
            ns.abort(500, message=get_msg_pgerror(err))
        except Exception as err:
            ns.abort(500, message=err)

        return field_catalog
Esempio n. 6
0
    def get(self):
        ''' To fetch several audits. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages '''
        try:
            verify_token(request.headers)
        except Exception as err:
            ns.abort(401, message=err)

        offset = request.args.get('offset', '0')
        limit = request.args.get('limit', '10')
        order_by = request.args.get('order_by', 'id')
        order = request.args.get('order', 'ASC')
        per_page = request.args.get('per_page', '10')
        page = request.args.get('page', '1')

        search_params = get_search_params(request.args,
                                          ['title', 'direccion_id'])

        try:
            audits_list, total_items, total_pages = audits.read_per_page(
                offset, limit, order_by, order, search_params, per_page, page)
        except psycopg2.Error as err:
            ns.abort(400, message=get_msg_pgerror(err))
        except Exception as err:
            ns.abort(400, message=err)

        return audits_list, 200, {
            'X-SOA-Total-Items': total_items,
            'X-SOA-Total-Pages': total_pages
        }
Esempio n. 7
0
    def get(self):
        ''' Listado de clasificaciones internas de CyTG. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages '''
        try:
            verify_token(request.headers)
        except Exception as err:
            ns.abort(401, message=err)

        offset   = request.args.get('offset',   '0'  )
        limit    = request.args.get('limit',    '10' )
        order_by = request.args.get('order_by', 'sorting_val')
        order    = request.args.get('order',    'ASC')
        per_page = request.args.get('per_page', '10' )
        page     = request.args.get('page',     '1'  )

        search_params = get_search_params(
            request.args,
            ['org_fiscal_id', 'direccion_id', 'title']
        )

        try:
            clasif_interna_list, total_items, total_pages = clasifs_internas_cytg.read_per_page(
                offset, limit, order_by, order, search_params, per_page, page
            )
        except psycopg2.Error as err:
            ns.abort(400, message=get_msg_pgerror(err))
        except Exception as err:
            ns.abort(400, message=err)
        
        return clasif_interna_list, 200, {'X-SOA-Total-Items': total_items, 'X-SOA-Total-Pages': total_pages}
Esempio n. 8
0
    def get(self):
        ''' To fetch an object containing data for screen fields (key: table name, value: list of table rows) '''
        try:
            verify_token(request.headers)
        except Exception as err:
            ns.abort(401, message=err)

        search_params = get_search_params(request.args, ['direccion_id'])

        try:
            field_catalog = audits.get_catalogs(
                [
                    'fiscals',
                    'divisions',
                    'dependencies',
                ],
                search_params,
            )
        except psycopg2.Error as err:
            ns.abort(500, message=get_msg_pgerror(err))
        except Exception as err:
            ns.abort(500, message=err)

        return field_catalog