• 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

31.58
/api/controllers/v1/location/create.js
1
const ControllerService = require('../../../services/ControllerService');
1✔
2
const NotificationService = require('../../../services/NotificationService');
1✔
3
const ParametersValidatorService = require('../../../services/ParametersValidatorService');
1✔
4
const LocationService = require('../../../services/LocationService');
1✔
5
const { toSimpleLocation } = require('../../../services/mapping/converters');
1✔
6

7
module.exports = async (req, res) => {
1✔
NEW
8
  const mandatoryParams = ParametersValidatorService.checkAllExist(req, res, [
×
9
    'entrance',
10
    'body',
11
    'language',
12
  ]);
NEW
13
  if (!mandatoryParams) return null;
×
NEW
14
  const [entranceId, body, languageId] = mandatoryParams;
×
15

NEW
16
  const linkedEntity = await ParametersValidatorService.checkOneOfEntityExist(
×
17
    req,
18
    res,
19
    ['entrance']
20
  );
NEW
21
  if (!linkedEntity) return null;
×
22

NEW
23
  const newLocation = await TLocation.create({
×
24
    author: req.token.id,
25
    body,
26
    dateInscription: new Date(),
27
    entrance: entranceId,
28
    language: languageId,
29
    title: req.param('title', null),
30
    // TODO compute relevance
31
  }).fetch();
32

NEW
33
  const locationPopulated = await LocationService.getLocation(newLocation.id);
×
NEW
34
  await NotificationService.notifySubscribers(
×
35
    req,
36
    locationPopulated,
37
    req.token.id,
38
    NotificationService.NOTIFICATION_TYPES.CREATE,
39
    NotificationService.NOTIFICATION_ENTITIES.LOCATION
40
  );
41

NEW
42
  return ControllerService.treatAndConvert(
×
43
    req,
44
    null,
45
    locationPopulated,
46
    { controllerMethod: 'LocationController.create' },
47
    res,
48
    toSimpleLocation
49
  );
50
};
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