• 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

93.33
/src/controller/staff/deleteStaffByIdController.ts
1
import { Request, Response } from 'express';
2
import { deleteStaffById } from '../../services/staff/deleteStaffById.js';
3
import mongoose from 'mongoose';
4

5
/**
6
 * Elimina un miembro del personal por su ID médico.
7
 * @param req - Request
8
 * @param res - Response
9
 * @returns Retorna un error o la confirmacion de eliminacion.
10
 */
11
export async function deleteStaffByIdController(req : {params : {id : string}}, res : Response) {
12
    try {
4✔
13
        const { id } = req.params;
4✔
14
        if (!mongoose.Types.ObjectId.isValid(id)) {
4✔
15
            return res.status(400).json({ error: 'Invalid ID format' });
1✔
16
        }
17
        const objetcId_ = new mongoose.Types.ObjectId(id);
3✔
18
        const result = await deleteStaffById(objetcId_);
3✔
19
        if (!result) {
2✔
20
            return res.status(404).json({ error: 'Staff member not found' });
1✔
21
        }
22
        return res.status(200).json({ message: 'Staff member deleted successfully' });
1✔
23
    }
24
    catch (error : unknown) {
25
        if (error instanceof Error) {
1✔
26
            return res.status(500).json({ error: error.message });
1✔
27
        }
NEW
28
        return res.status(500).json({ error: 'Internal Server Error' });
×
29
    }
30
}
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