• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ULL-ESIT-INF-DSI-2526 / grp02-medcore-api-groupd / 25628398609

10 May 2026 12:08PM UTC coverage: 87.197% (-0.5%) from 87.738%
25628398609

push

github

eduzu
Merge branch 'main' of github.com:ULL-ESIT-INF-DSI-2526/grp02-medcore-api-groupd
Medication controllers and basic testing

99 of 109 branches covered (90.83%)

Branch coverage included in aggregate %.

279 of 320 new or added lines in 31 files covered. (87.19%)

1 existing line in 1 file now uncovered.

405 of 469 relevant lines covered (86.35%)

7.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/controller/staff/readStaffController.ts
1
import type { StaffFilter } from '../../models/staff/types/StaffFilter.js';
2
import { readStaff } from '../../services/staff/readStaff.js';
3
import mongoose from 'mongoose';
4
import { Request, Response } from 'express';
5

6
/**
7
 * Controlador para leer miembros del personal.
8
 * @param req - Request
9
 * @param res - Response
10
 * @returns Retorna una lista de miembros del personal que coinciden con los filtros aplicados.
11
 */
12
export async function readStaffController(req: Request, res: Response) {
NEW
13
  try {
×
NEW
14
    const { name, specialty } = req.query;
×
15

NEW
16
    const filter: StaffFilter = {};
×
NEW
17
    if (typeof name === 'string' && name.trim() !== '') {
×
NEW
18
      filter.name = name;
×
19
    }
NEW
20
    if (typeof specialty === 'string' && specialty.trim() !== '') {
×
NEW
21
      filter.speciality = specialty;
×
22
    }
NEW
23
    const result = await readStaff(filter);
×
NEW
24
    return res.status(200).json(result);
×
25
  } catch (error : unknown) {
NEW
26
      if (error instanceof mongoose.Error.ValidationError) {
×
NEW
27
        return res.status(400).json({
×
28
          error: error.message,
29
        });
30
      }
NEW
31
      if (error instanceof Error) {
×
NEW
32
        return res.status(500).json({
×
33
          error: error.message,
34
        });
35
      }
NEW
36
      return res.status(500).json({
×
37
        error: 'Internal Server Error',
38
      });
39
  }
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc