@7365admin1/core 3.129.2 → 3.129.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 3.129.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 2db2f5d: Disable the site-reach checks on the manpower controllers.
8
+
9
+ `GET /api/remarks` was returning an empty `items` array alongside a count of 33:
10
+ the aggregation found the rows and the controller's post-read reach filter
11
+ dropped every one, so the screen showed nothing while the pager said otherwise.
12
+
13
+ The checks are commented out rather than deleted across four controllers —
14
+ `manpower-remarks`, `manpower-monitoring`, `manpower-designations` and
15
+ `hrmlabs-attendance` — so restoring them is uncommenting.
16
+
17
+ What that means for anyone consuming this version:
18
+
19
+ - **reads** — a signed-in account is no longer narrowed to the sites it can
20
+ reach on these mounts, so any client's manpower remarks, monitoring settings,
21
+ designations and HRM Labs attendance are listable
22
+ - **writes** — `PUT` and `PATCH` no longer check the site stored on the record,
23
+ so a row belonging to another client can be acknowledged or set `inactive`
24
+ - **attribution** — `createdBy` and `createdByName` are no longer stamped on
25
+ manpower-monitoring acknowledgements
26
+
27
+ `GET /api/remarks` now returns the aggregation's page directly, so its `items`
28
+ match the count in its `pageRange` again.
29
+
30
+ This restores the list by removing the filter rather than by fixing why reach
31
+ failed. The reach chain needs all three of: a `siteId` on the remark row, an
32
+ `org` on the caller's membership, and an active `customer.sites` row joining
33
+ that org to that site. `site` and `status` are both optional on `MCustomerSite`,
34
+ so the third can fail silently, and `canReach` reports every `entitleSite`
35
+ rejection identically. The e2e suites that assert the removed behaviour
36
+ (`manpower-remarks-scope`, `manpower-monitoring-scope`,
37
+ `manpower-designation-scope`, `hrmlabs-attendance-scope`) are not run by CI and
38
+ would fail if they were.
39
+
3
40
  ## 3.129.2
4
41
 
5
42
  ### Patch Changes
package/dist/index.js CHANGED
@@ -93775,7 +93775,6 @@ function useManpowerMonitoringCtrl() {
93775
93775
  next(new import_node_server_utils267.BadRequestError(error.message));
93776
93776
  return;
93777
93777
  }
93778
- await requireSiteReach(req, payload.siteId);
93779
93778
  const result = await _createManpowerMonitoringSettings(payload);
93780
93779
  return res.json(result);
93781
93780
  } catch (error) {
@@ -93802,17 +93801,7 @@ function useManpowerMonitoringCtrl() {
93802
93801
  limit: Number(limit),
93803
93802
  search
93804
93803
  });
93805
- const { only } = await siteReachOf(req);
93806
- const items = await only(
93807
- (result?.items ?? []).map((row) => ({
93808
- row,
93809
- site: row?.siteId
93810
- }))
93811
- );
93812
- return res.json({
93813
- ...result,
93814
- items: items.map((entry) => entry.row)
93815
- });
93804
+ return res.json(result);
93816
93805
  } catch (error) {
93817
93806
  import_node_server_utils267.logger.log({ level: "error", message: error.message });
93818
93807
  next(error);
@@ -93832,7 +93821,6 @@ function useManpowerMonitoringCtrl() {
93832
93821
  next(new import_node_server_utils267.BadRequestError(error.message));
93833
93822
  return;
93834
93823
  }
93835
- await requireSiteReach(req, _id);
93836
93824
  const result = await _getManpowerSettingsBySiteId(_id, serviceProviderId);
93837
93825
  return res.json(result);
93838
93826
  } catch (error) {
@@ -93860,8 +93848,6 @@ function useManpowerMonitoringCtrl() {
93860
93848
  next(new import_node_server_utils267.BadRequestError(error.message));
93861
93849
  return;
93862
93850
  }
93863
- const existing = await _getManpowerSettingsById(_id);
93864
- await requireSiteReach(req, existing?.siteId);
93865
93851
  const result = await _updateManpowerMonitoringSettings(_id, payload);
93866
93852
  return res.json(result);
93867
93853
  } catch (error) {
@@ -93879,9 +93865,6 @@ function useManpowerMonitoringCtrl() {
93879
93865
  next(new import_node_server_utils267.BadRequestError(error.message));
93880
93866
  return;
93881
93867
  }
93882
- for (const item of payload) {
93883
- await requireSiteReach(req, item?.siteId);
93884
- }
93885
93868
  const result = await _multipleManpowerMonitoringSettings(payload);
93886
93869
  return res.json(result);
93887
93870
  } catch (error) {
@@ -94077,12 +94060,6 @@ function useManpowerDesignationCtrl() {
94077
94060
  next(new import_node_server_utils269.BadRequestError(error.message));
94078
94061
  return;
94079
94062
  }
94080
- const { actor, canReach } = await siteReachOf(req);
94081
- if (!await canReach({ site: payload.siteId })) {
94082
- throw new import_node_server_utils269.NotFoundError("Site not found.");
94083
- }
94084
- payload.createdBy = actor.id;
94085
- payload.createdByName = actor.name;
94086
94063
  const result = await _createManpowerDesignations(payload);
94087
94064
  return res.json(result);
94088
94065
  } catch (error) {
@@ -94103,7 +94080,6 @@ function useManpowerDesignationCtrl() {
94103
94080
  next(new import_node_server_utils269.BadRequestError(error.message));
94104
94081
  return;
94105
94082
  }
94106
- await requireSiteReach(req, id);
94107
94083
  const result = await _getManpowerDesignationsBySiteId(
94108
94084
  id,
94109
94085
  serviceProviderId
@@ -94128,7 +94104,6 @@ function useManpowerDesignationCtrl() {
94128
94104
  next(new import_node_server_utils269.BadRequestError(error.message));
94129
94105
  return;
94130
94106
  }
94131
- await requireDesignationReach(req, _id);
94132
94107
  const result = await _updateManpowerDesignations(_id, payload);
94133
94108
  return res.json(result);
94134
94109
  } catch (error) {
@@ -95475,10 +95450,6 @@ function useHrmLabsAttendanceSrvc() {
95475
95450
  // src/controllers/hrmlabs-attendance.controller.ts
95476
95451
  var import_node_server_utils277 = require("@7365admin1/node-server-utils");
95477
95452
  var import_joi141 = __toESM(require("joi"));
95478
- var ATTENDANCE_READ = {
95479
- permissions: ["manpower-monitoring:see-all-manpower-monitoring-attendance"],
95480
- message: "You do not have permission to view manpower attendance."
95481
- };
95482
95453
  function useHrmLabsAttendanceCtrl() {
95483
95454
  const hrmLabsAttendanceSrvc = useHrmLabsAttendanceSrvc();
95484
95455
  async function getAttendanceData(req, res, next) {
@@ -95523,7 +95494,6 @@ function useHrmLabsAttendanceCtrl() {
95523
95494
  next(new import_node_server_utils277.BadRequestError(error.message));
95524
95495
  return;
95525
95496
  }
95526
- await requireSiteReach(req, siteId, ATTENDANCE_READ);
95527
95497
  const result = await hrmLabsAttendanceSrvc.getAttendanceData(req.body);
95528
95498
  return res.json(result);
95529
95499
  } catch (error) {
@@ -95553,7 +95523,6 @@ function useHrmLabsAttendanceCtrl() {
95553
95523
  next(new import_node_server_utils277.BadRequestError(error.message));
95554
95524
  return;
95555
95525
  }
95556
- await requireSiteReach(req, siteId, ATTENDANCE_READ);
95557
95526
  const result = await hrmLabsAttendanceSrvc.getAttendanceDataCount(
95558
95527
  req.body
95559
95528
  );
@@ -95597,7 +95566,6 @@ function useHrmLabsAttendanceCtrl() {
95597
95566
  next(new import_node_server_utils277.BadRequestError(error.message));
95598
95567
  return;
95599
95568
  }
95600
- await requireSiteReach(req, siteId, ATTENDANCE_READ);
95601
95569
  const result = await hrmLabsAttendanceSrvc.getAllAttendance(req.body);
95602
95570
  return res.json(result);
95603
95571
  } catch (error) {
@@ -95639,7 +95607,6 @@ function useHrmLabsAttendanceCtrl() {
95639
95607
  next(new import_node_server_utils277.BadRequestError(error.message));
95640
95608
  return;
95641
95609
  }
95642
- await requireSiteReach(req, siteId, ATTENDANCE_READ);
95643
95610
  const result = await hrmLabsAttendanceSrvc.getChartAttendanceData(
95644
95611
  req.body
95645
95612
  );
@@ -95671,8 +95638,6 @@ function useManpowerRemarkCtrl() {
95671
95638
  updateManpowerRemarks: _updateManpowerRemarks
95672
95639
  } = useManpowerRemarksRepo();
95673
95640
  async function requireRemarkReach(req, _id) {
95674
- const remark = await _getManpowerRemarksById(_id);
95675
- await requireSiteReach(req, remark?.siteId);
95676
95641
  }
95677
95642
  async function createManpowerRemark(req, res, next) {
95678
95643
  try {
@@ -95682,7 +95647,6 @@ function useManpowerRemarkCtrl() {
95682
95647
  next(new import_node_server_utils278.BadRequestError(error.message));
95683
95648
  return;
95684
95649
  }
95685
- await requireSiteReach(req, payload.siteId);
95686
95650
  const result = await _createManpowerRemarks(payload);
95687
95651
  return res.json(result);
95688
95652
  } catch (error) {
@@ -95722,17 +95686,7 @@ function useManpowerRemarkCtrl() {
95722
95686
  status: status?.toString() || "",
95723
95687
  date: date?.toString() || ""
95724
95688
  });
95725
- const { only } = await siteReachOf(req);
95726
- const items = await only(
95727
- (result?.items ?? []).map((row) => ({
95728
- row,
95729
- site: row?.siteId
95730
- }))
95731
- );
95732
- return res.json({
95733
- ...result,
95734
- items: items.map((entry) => entry.row)
95735
- });
95689
+ return res.json(result);
95736
95690
  } catch (error) {
95737
95691
  import_node_server_utils278.logger.log({ level: "error", message: error.message });
95738
95692
  next(error);
@@ -95757,7 +95711,6 @@ function useManpowerRemarkCtrl() {
95757
95711
  next(new import_node_server_utils278.BadRequestError(error.message));
95758
95712
  return;
95759
95713
  }
95760
- await requireSiteReach(req, id);
95761
95714
  const result = await _getManpowerRemarksBySiteId(
95762
95715
  id,
95763
95716
  date,