handlers.js 12.9 KB
Newer Older
krlsnvz93's avatar
krlsnvz93 committed
1 2
import { rest } from 'msw'
import { REQUEST_DIR } from '../utils/constants'
3 4

export default [
krlsnvz93's avatar
krlsnvz93 committed
5
  rest.get(REQUEST_DIR + 'centros?page=1', (req, res, ctx) => {
6 7 8 9 10
    return res(
      ctx.json({
        centros: [
          {
            id_centro: 1,
krlsnvz93's avatar
krlsnvz93 committed
11 12 13 14 15 16
            nombre_centro: 'Verda Robel',
            municipio: 'Santa Clara',
            organismo: 'MINED',
            created_at: '2021-07-06 21:45:51',
            updated_at: '2021-07-06 21:45:51',
            categoria: 1,
17 18 19
          },
          {
            id_centro: 2,
krlsnvz93's avatar
krlsnvz93 committed
20 21 22 23 24 25
            nombre_centro: 'Mina Braun',
            municipio: 'Placetas',
            organismo: 'MES',
            created_at: '2021-07-06 21:45:51',
            updated_at: '2021-07-06 21:45:51',
            categoria: 1,
26 27 28
          },
          {
            id_centro: 3,
krlsnvz93's avatar
krlsnvz93 committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
            nombre_centro: 'Clarabelle Bednar',
            municipio: 'Placetas',
            organismo: 'MES',
            created_at: '2021-07-06 21:45:51',
            updated_at: '2021-07-06 21:45:51',
            categoria: 2,
          },
          {
            id_centro: 4,
            nombre_centro: 'Some Site',
            municipio: 'Santo Domingo',
            organismo: 'CARACOL',
            created_at: '2021-07-06 21:45:51',
            updated_at: '2021-07-06 21:45:51',
            categoria: 0,
          },
          {
            id_centro: 5,
            nombre_centro: 'Another Place',
            municipio: 'Caibarien',
            organismo: 'MINED',
            created_at: '2021-07-06 21:45:51',
            updated_at: '2021-07-06 21:45:51',
            categoria: 0,
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
53
          }
54 55 56 57 58 59 60
        ],
        meta: {
          current_page: 1,
          from: 1,
          last_page: 2,
          per_page: 10,
          to: 10,
krlsnvz93's avatar
krlsnvz93 committed
61 62 63 64
          total: 4,
        },
      }),
    )
65
  }),
krlsnvz93's avatar
krlsnvz93 committed
66
  rest.post(REQUEST_DIR + 'centros', (req, res, ctx) => {
67 68 69 70
    return res(
      ctx.json({
        centro: {
          id_centro: 9,
krlsnvz93's avatar
krlsnvz93 committed
71 72 73 74 75
          nombre_centro: 'Mrs. Katharina Feeney',
          municipio: 'Sagua',
          organismo: 'MES',
          created_at: '2021-07-06 21:45:51',
          updated_at: '2021-07-06 21:45:51',
76
        },
krlsnvz93's avatar
krlsnvz93 committed
77 78 79
        message: 'Success',
      }),
    )
80
  }),
krlsnvz93's avatar
krlsnvz93 committed
81
  rest.put(REQUEST_DIR + 'centros/1', (req, res, ctx) => {
82 83 84 85
    return res(
      ctx.json({
        centro: {
          id_centro: 10,
krlsnvz93's avatar
krlsnvz93 committed
86 87 88 89 90
          nombre_centro: 'Panchito3',
          municipio: 'Sagua',
          organismo: 'MES',
          created_at: '2021-07-06 21:45:51',
          updated_at: '2021-07-07 01:45:37',
91
        },
krlsnvz93's avatar
krlsnvz93 committed
92 93 94
        message: 'Centro Actualizado',
      }),
    )
95
  }),
krlsnvz93's avatar
krlsnvz93 committed
96
  rest.delete(REQUEST_DIR + 'centros/1', (req, res, ctx) => {
97 98 99 100
    return res(
      ctx.json({
        centro: {
          id_centro: 10,
krlsnvz93's avatar
krlsnvz93 committed
101 102 103 104 105
          nombre_centro: 'Panchito3',
          municipio: 'Sagua',
          organismo: 'MES',
          created_at: '2021-07-06 21:45:51',
          updated_at: '2021-07-07 01:45:37',
106
        },
krlsnvz93's avatar
krlsnvz93 committed
107 108 109
        message: 'Centro Eliminado',
      }),
    )
110
  }),
krlsnvz93's avatar
krlsnvz93 committed
111
  rest.get(REQUEST_DIR + 'centros/1/areas?page=1', (req, res, ctx) => {
112 113 114 115 116 117
    return res(
      ctx.json({
        areas: [
          {
            id_area: 1,
            id_centro: 1,
krlsnvz93's avatar
krlsnvz93 committed
118 119 120 121 122
            nombre: 'Chad Bins',
            categoria: 'Alto Riesgo',
            created_at: '2021-07-07 03:20:18',
            updated_at: '2021-07-07 03:20:18',
          },
123 124 125 126 127 128 129
        ],
        meta: {
          current_page: 1,
          from: 1,
          last_page: 1,
          per_page: 10,
          to: 1,
krlsnvz93's avatar
krlsnvz93 committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
          total: 1,
        },
      }),
    )
  }),
  rest.get(REQUEST_DIR + 'nomenclador/clasificacion', (req, res, ctx) => {
    return res(
      ctx.json([
          {
            id: 1,
            nombre: 'ALTO RIESGO',
          },
          {
            id: 2,
            nombre: 'RIESGO MEDIO',
          },
          {
            id: 3,
            nombre: 'RIESGO BAJO',
          },
          {
            id: 0,
            nombre: 'SOSPECHOSO',
          },
        ],
      ),
    )
  }),
  rest.get(REQUEST_DIR + 'nomenclador/categoria', (req, res, ctx) => {
    return res(
      ctx.json([
          {
            id: 1,
            nombre: 'ALTO RIESGO',
          },
          {
            id: 2,
            nombre: 'RIESGO MEDIO',
          },
          {
            id: 3,
            nombre: 'RIESGO BAJO',
          },
          {
            id: 0,
            nombre: 'SOSPECHOSO',
          },
        ],
      ),
    )
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
180
  }),
krlsnvz93's avatar
krlsnvz93 committed
181
  rest.post(REQUEST_DIR + 'centros/1/areas', (req, res, ctx) => {
182 183 184 185
    return res(
      ctx.json({
        area: {
          id_centro: 9,
krlsnvz93's avatar
krlsnvz93 committed
186 187 188 189 190
          nombre_centro: 'Mrs. Katharina Feeney',
          municipio: 'Sagua',
          organismo: 'MES',
          created_at: '2021-07-06 21:45:51',
          updated_at: '2021-07-06 21:45:51',
191
        },
krlsnvz93's avatar
krlsnvz93 committed
192 193 194
        message: 'Success',
      }),
    )
195
  }),
krlsnvz93's avatar
krlsnvz93 committed
196
  rest.put(REQUEST_DIR + 'areas/1', (req, res, ctx) => {
197 198 199 200
    return res(
      ctx.json({
        area: {
          id_centro: 9,
krlsnvz93's avatar
krlsnvz93 committed
201 202 203 204 205
          nombre_centro: 'Mrs. Katharina Feeney',
          municipio: 'Sagua',
          organismo: 'MES',
          created_at: '2021-07-06 21:45:51',
          updated_at: '2021-07-06 21:45:51',
206
        },
krlsnvz93's avatar
krlsnvz93 committed
207 208 209
        message: 'Success',
      }),
    )
210
  }),
krlsnvz93's avatar
krlsnvz93 committed
211
  rest.delete(REQUEST_DIR + 'areas/1', (req, res, ctx) => {
212 213 214 215
    return res(
      ctx.json({
        centro: {
          id_centro: 10,
krlsnvz93's avatar
krlsnvz93 committed
216 217 218 219 220
          nombre_centro: 'Panchito3',
          municipio: 'Sagua',
          organismo: 'MES',
          created_at: '2021-07-06 21:45:51',
          updated_at: '2021-07-07 01:45:37',
221
        },
krlsnvz93's avatar
krlsnvz93 committed
222 223 224
        message: 'Area Eliminado',
      }),
    )
225
  }),
krlsnvz93's avatar
krlsnvz93 committed
226
  rest.get(REQUEST_DIR + 'pacientes?page=1', (req, res, ctx) => {
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
227 228 229 230
    return res(
      ctx.json({
        pacientes: [
          {
krlsnvz93's avatar
krlsnvz93 committed
231
            id_paciente: '1',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
232
            ci: 92121234063,
krlsnvz93's avatar
krlsnvz93 committed
233 234 235
            nombre: 'Pepe',
            apellidos: 'Glez Hdez',
            categoria: 3,
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
236 237
          },
          {
krlsnvz93's avatar
krlsnvz93 committed
238
            id_paciente: '2',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
239
            ci: 92121234063,
krlsnvz93's avatar
krlsnvz93 committed
240 241 242
            nombre: 'Pepe',
            apellidos: 'Glez Hdez',
            categoria: 2,
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
243 244
          },
          {
krlsnvz93's avatar
krlsnvz93 committed
245
            id_paciente: '3',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
246
            ci: 92121234063,
krlsnvz93's avatar
krlsnvz93 committed
247 248 249 250 251 252 253 254 255 256 257
            nombre: 'Pepe',
            apellidos: 'Glez Hdez',
            categoria: 2,
          },
          {
            id_paciente: '4',
            ci: 92121234063,
            nombre: 'Amancio',
            apellidos: 'Perez Perez',
            categoria: 0,
          },
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
258 259 260 261 262 263 264
        ],
        meta: {
          current_page: 1,
          from: 1,
          last_page: 2,
          per_page: 10,
          to: 10,
krlsnvz93's avatar
krlsnvz93 committed
265 266 267 268
          total: 20,
        },
      }),
    )
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
269
  }),
krlsnvz93's avatar
krlsnvz93 committed
270
  rest.post(REQUEST_DIR + 'pacientes', (req, res, ctx) => {
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
271 272 273 274
    return res(
      ctx.json({
        paciente: {
          id_paciente: 2,
krlsnvz93's avatar
krlsnvz93 committed
275 276 277 278 279 280
          nombre: 'Test store',
          apellidos: 'Test',
          edad: '25',
          ci: '12312312312',
          sexo: 'M',
          direccion: 'Test',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
281 282 283 284
          cmf: null,
          remite_caso: null,
          hospital: null,
          estado_salud: null,
krlsnvz93's avatar
krlsnvz93 committed
285
          categoria: '1',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
286
          estado_sistema: null,
krlsnvz93's avatar
krlsnvz93 committed
287 288 289 290 291
          trabajador_salud: '0',
          embarazada: '0',
          ninho: '0',
          test_antigeno: '1',
          vacunado: '0',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
292 293 294 295 296 297 298 299 300
          apps: {
            id_app: 2,
            id_paciente: 2,
            hipertension: 0,
            diabetes: 0,
            asma: 1,
            obesidad: 0,
            insuficiencia_renal: 0,
            oncologia: 0,
krlsnvz93's avatar
krlsnvz93 committed
301 302 303
            otros: '',
            created_at: '2021-07-15 03:36:39',
            updated_at: '2021-07-15 03:36:39',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
304 305 306 307 308 309 310 311 312 313 314 315 316
          },
          sintomas: {
            id_sintomas: 2,
            id_paciente: 2,
            fecha_sintomas: null,
            fiebre: 1,
            rinorrea: 0,
            congestion_nasal: 0,
            tos: 0,
            expectoracion: 0,
            dificultad_respiratoria: 0,
            cefalea: 0,
            dolor_garganta: 0,
krlsnvz93's avatar
krlsnvz93 committed
317 318 319
            otros: '',
            created_at: '2021-07-15 03:36:39',
            updated_at: '2021-07-15 03:36:39',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
320 321 322 323 324 325
          },
          contacto: {
            id_contactos: 2,
            id_paciente: 2,
            fecha_contacto: null,
            tipo_contacto: null,
krlsnvz93's avatar
krlsnvz93 committed
326 327 328 329
            lugar_contacto: 'Test',
            created_at: '2021-07-15 03:36:39',
            updated_at: '2021-07-15 03:36:39',
          },
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
330
        },
krlsnvz93's avatar
krlsnvz93 committed
331 332 333
        message: 'Paciente registrado',
      }),
    )
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
334
  }),
krlsnvz93's avatar
krlsnvz93 committed
335
  rest.get(REQUEST_DIR + 'pacientes/1', (req, res, ctx) => {
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
336 337 338 339
    return res(
      ctx.json({
        paciente: {
          id_paciente: 1,
krlsnvz93's avatar
krlsnvz93 committed
340 341
          nombre: 'Yoelvis',
          apellidos: 'Gonzalez',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
342
          edad: 28,
krlsnvz93's avatar
krlsnvz93 committed
343 344 345 346 347
          ci: '92121234063',
          sexo: 'M',
          direccion: 'Oquendo 109 e/ Ateneo y Cornelio. Rpro Virginia',
          cmf: '20.31',
          remite_caso: 'Policlinico',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
348
          hospital: null,
krlsnvz93's avatar
krlsnvz93 committed
349
          estado_salud: 'De cuidado',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
350 351
          provincia: 1,
          municipio: 1,
krlsnvz93's avatar
krlsnvz93 committed
352 353 354 355 356 357 358
          categoria: 'Loco',
          estado_sistema: 'Negativo_PCR',
          trabajador_salud: 0,
          embarazada: 0,
          ninho: 0,
          test_antigeno: 'Negativo',
          vacunado: 1,
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
359 360 361
          apps: {
            id_app: 1,
            id_paciente: 1,
krlsnvz93's avatar
krlsnvz93 committed
362 363 364 365 366 367 368 369 370
            hipertension: 0,
            diabetes: 0,
            asma: 1,
            obesidad: 0,
            insuficiencia_renal: 0,
            oncologia: 0,
            otros: '',
            created_at: '2021-07-15 20:12:20',
            updated_at: '2021-07-15 20:12:20',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
371 372 373 374 375
          },
          sintomas: {
            id_sintomas: 1,
            id_paciente: 1,
            fecha_sintomas: null,
krlsnvz93's avatar
krlsnvz93 committed
376 377 378 379 380 381 382 383 384 385 386
            fiebre: 0,
            rinorrea: 1,
            congestion_nasal: 0,
            tos: 0,
            expectoracion: 0,
            dificultad_respiratoria: 0,
            cefalea: 0,
            dolor_garganta: 0,
            otros: '',
            created_at: '2021-07-15 20:12:20',
            updated_at: '2021-07-15 20:12:20',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
387 388 389 390 391 392 393
          },
          contacto: {
            id_contactos: 1,
            id_paciente: 1,
            fecha_contacto: null,
            tipo_contacto: null,
            lugar_contacto: null,
krlsnvz93's avatar
krlsnvz93 committed
394 395
            created_at: '2021-07-15 20:12:20',
            updated_at: '2021-07-15 20:12:20',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
396 397 398 399 400 401 402
          },
          arribo: {
            id_arribo: 1,
            id_paciente: 1,
            pais_procedencia: null,
            lugar_estancia: null,
            fecha_arribo: null,
krlsnvz93's avatar
krlsnvz93 committed
403 404 405
            created_at: '2021-07-15 20:12:20',
            updated_at: '2021-07-15 20:12:20',
          },
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
406
        },
krlsnvz93's avatar
krlsnvz93 committed
407 408 409
        message: 'Success',
      }),
    )
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
410
  }),
krlsnvz93's avatar
krlsnvz93 committed
411
  rest.put(REQUEST_DIR + 'pacientes/1', (req, res, ctx) => {
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
412 413 414 415
    return res(
      ctx.json({
        paciente: {
          id_paciente: 1,
krlsnvz93's avatar
krlsnvz93 committed
416 417
          nombre: 'Test store',
          apellidos: 'Test',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
418
          edad: 25,
krlsnvz93's avatar
krlsnvz93 committed
419 420 421
          ci: '12312312316',
          sexo: 'M',
          direccion: 'Test',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
422 423 424
          cmf: null,
          remite_caso: null,
          hospital: null,
krlsnvz93's avatar
krlsnvz93 committed
425 426 427
          estado_salud: 'Test',
          categoria: 'Test',
          estado_sistema: 'Test',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
428 429 430
          trabajador_salud: 0,
          embarazada: 0,
          ninho: 0,
krlsnvz93's avatar
krlsnvz93 committed
431
          test_antigeno: 'Test',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
432 433 434 435 436 437 438 439 440 441
          vacunado: 0,
          apps: {
            id_app: 1,
            id_paciente: 1,
            hipertension: 0,
            diabetes: 0,
            asma: 1,
            obesidad: 0,
            insuficiencia_renal: 0,
            oncologia: 0,
krlsnvz93's avatar
krlsnvz93 committed
442 443 444
            otros: '',
            created_at: '2021-07-15 20:12:20',
            updated_at: '2021-07-15 20:12:20',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
445 446 447 448 449 450 451 452 453 454 455 456 457
          },
          sintomas: {
            id_sintomas: 1,
            id_paciente: 1,
            fecha_sintomas: null,
            fiebre: 1,
            rinorrea: 0,
            congestion_nasal: 0,
            tos: 0,
            expectoracion: 0,
            dificultad_respiratoria: 0,
            cefalea: 0,
            dolor_garganta: 0,
krlsnvz93's avatar
krlsnvz93 committed
458 459 460
            otros: '',
            created_at: '2021-07-15 20:12:20',
            updated_at: '2021-07-15 20:12:20',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
461 462 463 464 465 466
          },
          contacto: {
            id_contactos: 1,
            id_paciente: 1,
            fecha_contacto: null,
            tipo_contacto: null,
krlsnvz93's avatar
krlsnvz93 committed
467 468 469
            lugar_contacto: 'Test',
            created_at: '2021-07-15 20:12:20',
            updated_at: '2021-07-15 20:12:20',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
470 471 472 473
          },
          arribo: {
            id_arribo: 1,
            id_paciente: 1,
krlsnvz93's avatar
krlsnvz93 committed
474
            pais_procedencia: 'Italia',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
475 476
            lugar_estancia: null,
            fecha_arribo: null,
krlsnvz93's avatar
krlsnvz93 committed
477 478 479
            created_at: '2021-07-15 20:12:20',
            updated_at: '2021-07-15 20:12:20',
          },
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
480
        },
krlsnvz93's avatar
krlsnvz93 committed
481 482 483
        message: 'Success',
      }),
    )
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
484
  }),
krlsnvz93's avatar
krlsnvz93 committed
485
  rest.delete(REQUEST_DIR + 'pacientes/1', (req, res, ctx) => {
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
486 487
    return res(
      ctx.json({
krlsnvz93's avatar
krlsnvz93 committed
488 489
        message: 'Success',
      }),
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
490
    )
krlsnvz93's avatar
krlsnvz93 committed
491 492
  }),
  rest.get(REQUEST_DIR + 'nomenclador/antigeno', (req, res, ctx) =>
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
493 494 495 496
    res(
      ctx.json([
        {
          id: 1,
krlsnvz93's avatar
krlsnvz93 committed
497
          nombre: 'Positivo',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
498 499 500
        },
        {
          id: 2,
krlsnvz93's avatar
krlsnvz93 committed
501
          nombre: 'Negativo',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
502 503 504
        },
        {
          id: 3,
krlsnvz93's avatar
krlsnvz93 committed
505
          nombre: 'No realizado',
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
506
        },
krlsnvz93's avatar
krlsnvz93 committed
507 508
      ]),
    ),
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
509
  ),
krlsnvz93's avatar
krlsnvz93 committed
510
]