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}
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}
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 }
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_pre_cytg.get_catalogs( [ 'divisions', 'audits', 'auditoria_tipos_cytg', 'dependencies', 'social_programs', 'clasifs_internas_cytg', 'observation_types', 'estatus_pre_cytg', ], 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
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) try: field_catalog = observaciones_ires_asf.get_catalogs([ 'medios_notif_seguimiento_asf', 'estatus_ires_asf', 'autoridades_invest', 'clasifs_internas_cytg', 'observation_types', 'audits', 'dependencies', 'divisions', 'social_programs', 'acciones_asf', ]) 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
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 }
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) try: field_catalog = estatus.get_catalogs(['fiscals']) except Exception as err: ns.abort(500, message=err) return field_catalog
def delete(self, org_fiscal_id, pre_ires, id): ''' Eliminar un Estatus ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: estat = estatus.delete(org_fiscal_id, pre_ires, id) except EmptySetError: ns.abort(404, message=self.estatus_not_found) except Exception as err: ns.abort(400, message=err) return estat
def delete(self, org_fiscal_id, direccion_id, id): ''' Eliminar una Clasificación interna ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: clasif = clasifs_internas_cytg.delete(org_fiscal_id, direccion_id, id) except EmptySetError: ns.abort(404, message=self.clasif_not_found) except Exception as err: ns.abort(400, message=err) return clasif
def delete(self, org_fiscal_id, id): ''' Eliminar una Acción ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: acc = acciones.delete(org_fiscal_id, id) except EmptySetError: ns.abort(404, message=self.accion_not_found) except Exception as err: ns.abort(400, message=err) return acc
def delete(self, id): ''' Eliminar un programa social ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: prog = programas_sociales.delete(id) except EmptySetError: ns.abort(404, message=self.progr_not_found) except Exception as err: ns.abort(400, message=err) return prog
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) try: field_catalog = users.get_catalogs( ['divisions', 'orgchart_roles', 'authorities']) 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
def get(self, org_fiscal_id, direccion_id, id): ''' Recuperar una Clasificación interna ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: clasif = clasifs_internas_cytg.read(org_fiscal_id, direccion_id, id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySetError: ns.abort(404, message=self.clasif_not_found) except Exception as err: ns.abort(400, message=err) return clasif
def post(self): ''' Crear una Clasificación interna ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: clasif = clasifs_internas_cytg.create(**api.payload) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except KeyError as err: ns.abort(400, message='Review the attributes in your payload: {}'.format(err)) except Exception as err: ns.abort(400, message=err) return clasif, 201
def delete(self, id): ''' To delete an observation (CyTG (resultados)) ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_ires_cytg.delete(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySetError: ns.abort(404, message=ObservacionCyTG.obs_not_found) except Exception as err: ns.abort(400, message=err) return obs
def post(self): ''' To create an observation (Informe de Resultados de la ASENL). ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_ires_asenl.create(**api.payload) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except KeyError as err: ns.abort(400, message='Review the keys in your payload: {}'.format(err)) except Exception as err: ns.abort(400, message=err) return obs, 201
def delete(self, id): ''' To delete a user ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: usr = users.delete(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySetError: ns.abort(404, message=User.user_not_found) except Exception as err: ns.abort(400, message=err) return usr
def post(self): ''' To create an observation (preliminar de la CyTG). ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_pre_cytg.create(**api.payload) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except KeyError as err: ns.abort(400, message='Review the keys in your payload: {}'.format(err)) except Exception as err: ns.abort(400, message=err) return obs, 201
def delete(self, id): ''' To delete an audit ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: aud = audits.delete(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySetError: ns.abort(404, message=Audit.audit_not_found) except Exception as err: ns.abort(400, message=err) return aud
def get(self, id): ''' To fetch an observation (SFP) ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_sfp.read(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySetError: ns.abort(404, message=ObservacionSfp.obs_not_found) except Exception as err: ns.abort(400, message=err) return obs
def delete(self, id): ''' To delete an observation (Informe de Resultados de la ASENL) ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_ires_asenl.delete(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySetError: ns.abort(404, message=ObservacionIResAsenl.obs_not_found) except Exception as err: ns.abort(400, message=err) return obs
def get(self, id): ''' Recuperar un programa social ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: prog = programas_sociales.read(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySetError: ns.abort(404, message=self.progr_not_found) except Exception as err: ns.abort(400, message=err) return prog
def post(self): ''' To create an audit ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: aud = audits.create(**api.payload) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except KeyError as err: ns.abort(400, message='Review the keys in your payload: {}'.format(err)) except Exception as err: ns.abort(400, message=err) return aud, 201
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) try: field_catalog = clasifs_internas_cytg.get_catalogs([ 'fiscals', 'divisions', ]) 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
def post(self): ''' Crear un Estatus ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: estat = estatus.create(**api.payload) except KeyError as err: ns.abort( 400, message='Review the attributes in your payload: {}'.format( err)) except Exception as err: ns.abort(400, message=err) return estat, 201
def post(self): ''' To create a user. Key \'disabled\' is ignored as this is automatically set to false at creation ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: usr = users.create(**api.payload) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except KeyError as err: ns.abort(400, message='Review the keys in your payload: {}'.format(err)) except Exception as err: ns.abort(400, message=err) return usr, 201
def put(self, org_fiscal_id, direccion_id, id): ''' Actualizar una Clasificación interna ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: clasif = clasifs_internas_cytg.update(org_fiscal_id, direccion_id, id, **api.payload) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except KeyError as err: ns.abort(400, message='Review the attributes in your payload: {}'.format(err)) except EmptySetError as err: ns.abort(404, message=self.clasif_not_found + '. ' + str(err)) except Exception as err: ns.abort(400, message=err) return clasif
def put(self, id): ''' To update an observation (preliminar de la CyTG) ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_pre_cytg.update(id, **api.payload) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except KeyError as err: ns.abort(400, message='Review the keys in your payload: {}'.format(err)) except EmptySetError as err: ns.abort(404, message=ObservacionPreCytg.obs_not_found + '. ' + str(err)) except Exception as err: ns.abort(400, message=err) return obs
def put(self, id): ''' To update an observation (Informe de Resultados de la ASENL) ''' try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: obs = observaciones_ires_asenl.update(id, **api.payload) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except KeyError as err: ns.abort(400, message='Review the keys in your payload: {}'.format(err)) except EmptySetError as err: ns.abort(404, message=ObservacionIResAsenl.obs_not_found + '. ' + str(err)) except Exception as err: ns.abort(400, message=err) return obs