@@ -55,6 +55,24 @@ class SeguimientoPacienteResource extends ResourceBase {
5555 }
5656}
5757
58+ const search = async ( req , res , next ) => {
59+ const options = req . apiOptions ( ) ;
60+ const conditions = { ...req . query } ;
61+ Object . keys ( options ) . map ( opt => delete conditions [ opt ] ) ;
62+ const [ results , total ] = await Promise . all ( [
63+ SeguimientoPacienteCtr . search ( conditions , options ) ,
64+ SeguimientoPacienteCtr . search ( conditions )
65+ ] ) ;
66+ res . json ( {
67+ pagination : {
68+ offset : options . skip ,
69+ limit : options . limit ,
70+ total : total . length ,
71+ } ,
72+ data : results
73+ } ) ;
74+ } ;
75+
5876const patchAsignacion = async ( req , res , next ) => {
5977 try {
6078 const { seguimientos, profesional } = req . body ;
@@ -74,5 +92,7 @@ const patchAsignacion = async (req, res, next) => {
7492
7593export const SeguimientoPacienteCtr = new SeguimientoPacienteResource ( { } ) ;
7694const seguimientoPacienteRouter = SeguimientoPacienteCtr . makeRoutes ( ) ;
77- seguimientoPacienteRouter . post ( '/seguimientoPaciente/asignaciones' , Auth . authenticate ( ) , asyncHandler ( patchAsignacion ) ) ;
7895export const SeguimientoPacienteRouter = seguimientoPacienteRouter ;
96+
97+ seguimientoPacienteRouter . get ( '/seguimientoPaciente/search/v2' , Auth . authenticate ( ) , asyncHandler ( search ) ) ;
98+ seguimientoPacienteRouter . post ( '/seguimientoPaciente/asignaciones' , Auth . authenticate ( ) , asyncHandler ( patchAsignacion ) ) ;
0 commit comments