• 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

92.86
/src/controller/staff/readStaffByIdController.ts
1
import mongoose from 'mongoose';
2
import { Response } from 'express';
3
import { readStaffById } from '../../services/staff/readStaffById.js';
4
/**
5
 * 
6
 * @param req - Request
7
 * @param res - Response
8
 * @returns Retorna un error o el miembro del personal encontrado por su ID médico.
9
 */
10
export async function readStaffByIdController(req : { params: { id: string } }, res : Response) {
11
    try {
3✔
12
        const { id } = req.params;
3✔
13
        const objectId_ = new mongoose.Types.ObjectId(id);
3✔
14
        const result = await readStaffById(objectId_);
3✔
15
        if (!result) {
2✔
16
            return res.status(404).json({ error: 'Staff member not found' });
1✔
17
        }
18
        return res.status(200).json(result);
1✔
19
    } catch (error : unknown) {
20
        if (error instanceof mongoose.Error.CastError) {
1✔
NEW
21
            return res.status(400).json({ error: 'Invalid ID format' });
×
22
        }
23
        if (error instanceof Error) {
1✔
24
            return res.status(500).json({ error: error.message });
1✔
25
        }
26
    }
27
}
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