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