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

GrottoCenter / grottocenter-api / 10996310862

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

push

github

vmarseguerra
feat(entities): adds delete / restore for document

740 of 2203 branches covered (33.59%)

Branch coverage included in aggregate %.

24 of 153 new or added lines in 17 files covered. (15.69%)

484 existing lines in 49 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

59.26
/api/services/LocationService.js
1
module.exports = {
2✔
2
  getEntranceLocations: async (entranceId, where = {}) => {
1✔
3
    if (!entranceId) return [];
9!
4
    return TLocation.find({ ...where, entrance: entranceId })
9✔
5
      .populate('author')
6
      .populate('reviewer');
7
  },
8
  getEntranceHLocations: async (
9
    entranceId,
10
    hasCompleteViewRight,
11
    where = {}
×
12
  ) => {
UNCOV
13
    if (!entranceId) return [];
×
UNCOV
14
    const loactionIds = await TLocation.find({
×
15
      where: { ...where, entrance: entranceId },
16
      select: ['id'],
17
    });
UNCOV
18
    return module.exports.getHLocation(
×
UNCOV
19
      loactionIds.map((e) => e.id),
×
20
      hasCompleteViewRight
21
    );
22
  },
23

24
  getLocation: async (locationId) =>
UNCOV
25
    TLocation.findOne({ id: locationId })
×
26
      .populate('author')
27
      .populate('reviewer'),
28

29
  getHLocation: async (locationId, hasCompleteViewRight) => {
30
    const CHECK_SENSITIVTY_OF_ENTRANCE_FROM_LOCATION_ID = `
3✔
31
    SELECT TE.is_sensitive
32
    FROM h_location HL
33
          JOIN t_entrance TE ON HL.id_entrance = TE.id
34
    WHERE HL.id = $1;`;
35

36
    if (!hasCompleteViewRight) {
3!
37
      // For non admin user, we do not return locations for sensitive entrance
38
      const sensitivity = await HLocation.getDatastore().sendNativeQuery(
3✔
39
        CHECK_SENSITIVTY_OF_ENTRANCE_FROM_LOCATION_ID,
40
        [Array.isArray(locationId) ? locationId[0] : locationId]
3!
41
      );
42

43
      if (!sensitivity.rows[0] || sensitivity.rows[0].is_sensitive) return [];
3✔
44
    }
45

46
    return HLocation.find({ t_id: locationId })
1✔
47
      .populate('reviewer')
48
      .populate('author');
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