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

GrottoCenter / grottocenter-api / 10995932235

23 Sep 2024 02:02PM UTC coverage: 46.158% (-1.7%) from 47.822%
10995932235

Pull #1307

github

vmarseguerra
feat(entities): adds delete / restore for document
Pull Request #1307: Adds delete / restore for Organization and Massif + Refactoring

740 of 2203 branches covered (33.59%)

Branch coverage included in aggregate %.

338 of 866 new or added lines in 83 files covered. (39.03%)

20 existing lines in 15 files now uncovered.

2462 of 4734 relevant lines covered (52.01%)

4.5 hits per line

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

8.7
/api/controllers/v1/cave/unlink-document.js
1
const RightService = require('../../../services/RightService');
1✔
2

3
module.exports = async (req, res) => {
1✔
NEW
4
  const hasRight = RightService.hasGroup(
×
5
    req.token.groups,
6
    RightService.G.MODERATOR
7
  );
NEW
8
  if (!hasRight) {
×
NEW
9
    return res.forbidden(
×
10
      'You are not authorized to remove a document from an entrance.'
11
    );
12
  }
13

NEW
14
  const caveId = req.param('caveId');
×
NEW
15
  const cave = await TCave.findOne(caveId);
×
NEW
16
  if (!cave || cave.isDeleted) {
×
NEW
17
    return res.notFound({ message: `Cave of id ${caveId} not found.` });
×
18
  }
19

NEW
20
  const documentId = req.param('documentId');
×
NEW
21
  const document = await TDocument.findOne({ id: documentId });
×
NEW
22
  if (!document) {
×
NEW
23
    return res.notFound({ message: `Document of id ${documentId} not found.` });
×
24
  }
25

NEW
26
  await TCave.removeFromCollection(caveId, 'documents', documentId);
×
27

NEW
28
  return res.ok();
×
29
};
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