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

GrottoCenter / grottocenter-api / 10996013011

23 Sep 2024 02:06PM UTC coverage: 46.158% (-2.8%) from 48.952%
10996013011

Pull #1306

github

vmarseguerra
feat(entities): adds delete / restore for document
Pull Request #1306: Adds delete / restore for entrance sub entities

740 of 2203 branches covered (33.59%)

Branch coverage included in aggregate %.

528 of 1295 new or added lines in 114 files covered. (40.77%)

23 existing lines in 18 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

16.67
/api/controllers/v1/document-duplicate/create-from-duplicate.js
1
const DocumentService = require('../../../services/DocumentService');
1✔
2
const RightService = require('../../../services/RightService');
1✔
3

4
// Create a new document from an existing duplicate document content
5
module.exports = async (req, res) => {
1✔
6
  const hasRight = RightService.hasGroup(
×
7
    req.token.groups,
8
    RightService.G.MODERATOR
9
  );
10
  if (!hasRight) {
×
11
    return res.forbidden(
×
12
      'You are not authorized to create a document duplicate.'
13
    );
14
  }
15

16
  const id = req.param('id');
×
NEW
17
  const documentDuplicate = await TDocumentDuplicate.findOne({ id });
×
NEW
18
  if (!documentDuplicate) {
×
NEW
19
    return res.badRequest(`Could not find duplicate with id ${id}.`);
×
20
  }
21

NEW
22
  const { document, description } = documentDuplicate.content;
×
23
  await DocumentService.createDocument(req, document, description);
×
24
  await TDocumentDuplicate.destroyOne(id);
×
25
  return res.ok();
×
26
};
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