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

GrottoCenter / grottocenter-api / 5631056675

pending completion
5631056675

push

github

vmarseguerra
refactor(right): replaces rights with a static groups system

751 of 1944 branches covered (38.63%)

Branch coverage included in aggregate %.

59 of 59 new or added lines in 35 files covered. (100.0%)

2702 of 5007 relevant lines covered (53.96%)

14.64 hits per line

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

11.11
/api/controllers/v1/document-duplicate/delete-one.js
1
const RightService = require('../../../services/RightService');
1✔
2

3
module.exports = async (req, res) => {
1✔
4
  const hasRight = RightService.hasGroup(
×
5
    req.token.groups,
6
    RightService.G.MODERATOR
7
  );
8
  if (!hasRight) {
×
9
    return res.forbidden(
×
10
      'You are not authorized to delete a document duplicate.'
11
    );
12
  }
13
  const id = req.param('id');
×
14
  if (!id) {
×
15
    return res.badRequest('You must provide the id of the duplicate.');
×
16
  }
17

18
  if (
×
19
    !(await sails.helpers.checkIfExists.with({
20
      attributeName: 'id',
21
      attributeValue: req.param('id'),
22
      sailsModel: TDocumentDuplicate,
23
    }))
24
  ) {
25
    return res.badRequest(
×
26
      `Could not find duplicate with id ${req.param('id')}.`
27
    );
28
  }
29

30
  await TDocumentDuplicate.destroyOne(id);
×
31
  return res.ok();
×
32
};
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