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

GrottoCenter / grottocenter-api / 10997837597

23 Sep 2024 03:48PM UTC coverage: 46.105% (-0.05%) from 46.158%
10997837597

Pull #1321

github

vmarseguerra
fix(entrance): cannot delete entrance sub entities with notification
Pull Request #1321: fix cannot delete entrance sub entities with notification

740 of 2203 branches covered (33.59%)

Branch coverage included in aggregate %.

0 of 13 new or added lines in 6 files covered. (0.0%)

5 existing lines in 5 files now uncovered.

2462 of 4742 relevant lines covered (51.92%)

4.49 hits per line

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

18.18
/api/controllers/v1/rigging/delete.js
1
const ControllerService = require('../../../services/ControllerService');
1✔
2
const NotificationService = require('../../../services/NotificationService');
1✔
3
const RiggingService = require('../../../services/RiggingService');
1✔
4
const { toSimpleRigging } = require('../../../services/mapping/converters');
1✔
5
const RightService = require('../../../services/RightService');
1✔
6

7
module.exports = async (req, res) => {
1✔
8
  const hasRight = RightService.hasGroup(
×
9
    req.token.groups,
10
    RightService.G.MODERATOR
11
  );
12
  if (!hasRight)
×
13
    return res.forbidden('You are not authorized to delete rigging.');
×
14

15
  const riggingId = req.param('id');
×
16
  const rigging = await RiggingService.getRigging(riggingId);
×
17
  if (!rigging) {
×
18
    return res.notFound({ message: `Rigging of id ${riggingId} not found.` });
×
19
  }
20

21
  if (!rigging.isDeleted) {
×
22
    await TRigging.destroyOne({ id: riggingId }); // Soft delete
×
23
    rigging.isDeleted = true;
×
24
  }
25

26
  const deletePermanently = !!req.param('isPermanent');
×
27
  if (deletePermanently) {
×
28
    await HRigging.destroy({ t_id: riggingId });
×
NEW
29
    await TNotification.destroy({ rigging: riggingId });
×
UNCOV
30
    await TRigging.destroyOne({ id: riggingId }); // Hard delete
×
31
  }
32

33
  await NotificationService.notifySubscribers(
×
34
    req,
35
    rigging,
36
    req.token.id,
37
    deletePermanently
×
38
      ? NotificationService.NOTIFICATION_TYPES.PERMANENT_DELETE
39
      : NotificationService.NOTIFICATION_TYPES.DELETE,
40
    NotificationService.NOTIFICATION_ENTITIES.RIGGING
41
  );
42

43
  return ControllerService.treatAndConvert(
×
44
    req,
45
    null,
46
    rigging,
47
    { controllerMethod: 'RiggingController.delete' },
48
    res,
49
    toSimpleRigging
50
  );
51
};
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