@lilaquadrat/studio 12.1.0 → 12.2.0

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.
Files changed (138) hide show
  1. package/lib/models.d.ts +8 -1
  2. package/lib/models.js +8 -1
  3. package/lib/models.js.map +1 -1
  4. package/lib/services.d.ts +8 -1
  5. package/lib/services.js +8 -1
  6. package/lib/services.js.map +1 -1
  7. package/lib/src/Immutable.class.js +10 -4
  8. package/lib/src/Immutable.class.js.map +1 -1
  9. package/lib/src/aggegations/structures.aggregation.d.ts +6 -8
  10. package/lib/src/aggegations/structures.aggregation.js +3 -2
  11. package/lib/src/aggegations/structures.aggregation.js.map +1 -1
  12. package/lib/src/classes/paymentProviders/PaymentProviderFactory.class.d.ts +4 -0
  13. package/lib/src/classes/paymentProviders/PaymentProviderFactory.class.js +8 -0
  14. package/lib/src/classes/paymentProviders/PaymentProviderFactory.class.js.map +1 -0
  15. package/lib/src/classes/paymentProviders/StripePaymentProvider.class.d.ts +9 -0
  16. package/lib/src/classes/paymentProviders/StripePaymentProvider.class.js +49 -0
  17. package/lib/src/classes/paymentProviders/StripePaymentProvider.class.js.map +1 -0
  18. package/lib/src/classes/shiftPlanningModel.class.d.ts +6 -0
  19. package/lib/src/classes/shiftPlanningModel.class.js +26 -0
  20. package/lib/src/classes/shiftPlanningModel.class.js.map +1 -0
  21. package/lib/src/helpers/buildProductName.d.ts +7 -0
  22. package/lib/src/helpers/buildProductName.js +20 -0
  23. package/lib/src/helpers/buildProductName.js.map +1 -0
  24. package/lib/src/helpers/shiftPlanningReports.d.ts +7 -0
  25. package/lib/src/helpers/shiftPlanningReports.js +135 -0
  26. package/lib/src/helpers/shiftPlanningReports.js.map +1 -0
  27. package/lib/src/helpers/shiftPlanningSchemas.d.ts +143 -0
  28. package/lib/src/helpers/shiftPlanningSchemas.js +87 -0
  29. package/lib/src/helpers/shiftPlanningSchemas.js.map +1 -0
  30. package/lib/src/helpers/shiftPlanningTime.d.ts +24 -0
  31. package/lib/src/helpers/shiftPlanningTime.js +191 -0
  32. package/lib/src/helpers/shiftPlanningTime.js.map +1 -0
  33. package/lib/src/helpers/shiftPlanningValidation.d.ts +26 -0
  34. package/lib/src/helpers/shiftPlanningValidation.js +53 -0
  35. package/lib/src/helpers/shiftPlanningValidation.js.map +1 -0
  36. package/lib/src/helpers/structureMatch.d.ts +15 -0
  37. package/lib/src/helpers/structureMatch.js +70 -0
  38. package/lib/src/helpers/structureMatch.js.map +1 -0
  39. package/lib/src/interfaces/PaymentProviderBase.d.ts +14 -0
  40. package/lib/src/interfaces/PaymentProviderBase.js +2 -0
  41. package/lib/src/interfaces/PaymentProviderBase.js.map +1 -0
  42. package/lib/src/models/customers.model.js +10 -0
  43. package/lib/src/models/customers.model.js.map +1 -1
  44. package/lib/src/models/employeeAbsence.model.d.ts +4 -0
  45. package/lib/src/models/employeeAbsence.model.js +11 -0
  46. package/lib/src/models/employeeAbsence.model.js.map +1 -0
  47. package/lib/src/models/historySeen.model.d.ts +4 -0
  48. package/lib/src/models/historySeen.model.js +30 -0
  49. package/lib/src/models/historySeen.model.js.map +1 -0
  50. package/lib/src/models/listsParticipants.model.js +11 -0
  51. package/lib/src/models/listsParticipants.model.js.map +1 -1
  52. package/lib/src/models/permissions.model.js +28 -0
  53. package/lib/src/models/permissions.model.js.map +1 -1
  54. package/lib/src/models/shift.model.d.ts +4 -0
  55. package/lib/src/models/shift.model.js +17 -0
  56. package/lib/src/models/shift.model.js.map +1 -0
  57. package/lib/src/models/shiftPlan.model.d.ts +4 -0
  58. package/lib/src/models/shiftPlan.model.js +14 -0
  59. package/lib/src/models/shiftPlan.model.js.map +1 -0
  60. package/lib/src/models/shiftPlanDays.model.d.ts +4 -0
  61. package/lib/src/models/shiftPlanDays.model.js +15 -0
  62. package/lib/src/models/shiftPlanDays.model.js.map +1 -0
  63. package/lib/src/models/shiftPlanningSettings.model.d.ts +4 -0
  64. package/lib/src/models/shiftPlanningSettings.model.js +10 -0
  65. package/lib/src/models/shiftPlanningSettings.model.js.map +1 -0
  66. package/lib/src/models/workAreas.model.d.ts +4 -0
  67. package/lib/src/models/workAreas.model.js +12 -0
  68. package/lib/src/models/workAreas.model.js.map +1 -0
  69. package/lib/src/services/customers.service.d.ts +11 -0
  70. package/lib/src/services/customers.service.js +27 -0
  71. package/lib/src/services/customers.service.js.map +1 -1
  72. package/lib/src/services/employeeAbsences.service.d.ts +18 -0
  73. package/lib/src/services/employeeAbsences.service.js +57 -0
  74. package/lib/src/services/employeeAbsences.service.js.map +1 -0
  75. package/lib/src/services/history.service.d.ts +15 -0
  76. package/lib/src/services/history.service.js +36 -0
  77. package/lib/src/services/history.service.js.map +1 -1
  78. package/lib/src/services/historySeen.service.d.ts +32 -0
  79. package/lib/src/services/historySeen.service.js +66 -0
  80. package/lib/src/services/historySeen.service.js.map +1 -0
  81. package/lib/src/services/listParticipants.service.d.ts +143 -12
  82. package/lib/src/services/listParticipants.service.js +145 -6
  83. package/lib/src/services/listParticipants.service.js.map +1 -1
  84. package/lib/src/services/lists.service.d.ts +9 -0
  85. package/lib/src/services/lists.service.js +28 -0
  86. package/lib/src/services/lists.service.js.map +1 -1
  87. package/lib/src/services/paymentProviders.service.d.ts +5 -0
  88. package/lib/src/services/paymentProviders.service.js +10 -0
  89. package/lib/src/services/paymentProviders.service.js.map +1 -1
  90. package/lib/src/services/shiftPlanDays.service.d.ts +22 -0
  91. package/lib/src/services/shiftPlanDays.service.js +80 -0
  92. package/lib/src/services/shiftPlanDays.service.js.map +1 -0
  93. package/lib/src/services/shiftPlanningSettings.service.d.ts +11 -0
  94. package/lib/src/services/shiftPlanningSettings.service.js +27 -0
  95. package/lib/src/services/shiftPlanningSettings.service.js.map +1 -0
  96. package/lib/src/services/shiftPlans.service.d.ts +24 -0
  97. package/lib/src/services/shiftPlans.service.js +139 -0
  98. package/lib/src/services/shiftPlans.service.js.map +1 -0
  99. package/lib/src/services/shifts.service.d.ts +29 -0
  100. package/lib/src/services/shifts.service.js +260 -0
  101. package/lib/src/services/shifts.service.js.map +1 -0
  102. package/lib/src/services/structures.service.d.ts +2 -0
  103. package/lib/src/services/structures.service.js +7 -0
  104. package/lib/src/services/structures.service.js.map +1 -1
  105. package/lib/src/services/workAreas.service.d.ts +18 -0
  106. package/lib/src/services/workAreas.service.js +67 -0
  107. package/lib/src/services/workAreas.service.js.map +1 -0
  108. package/lib/tests/buildProductName.spec.d.ts +1 -0
  109. package/lib/tests/buildProductName.spec.js +27 -0
  110. package/lib/tests/buildProductName.spec.js.map +1 -0
  111. package/lib/tests/customersServiceStructures.spec.d.ts +1 -0
  112. package/lib/tests/customersServiceStructures.spec.js +146 -0
  113. package/lib/tests/customersServiceStructures.spec.js.map +1 -0
  114. package/lib/tests/historySeenService.spec.d.ts +1 -0
  115. package/lib/tests/historySeenService.spec.js +159 -0
  116. package/lib/tests/historySeenService.spec.js.map +1 -0
  117. package/lib/tests/listParticipantsPlanning.spec.d.ts +1 -0
  118. package/lib/tests/listParticipantsPlanning.spec.js +83 -0
  119. package/lib/tests/listParticipantsPlanning.spec.js.map +1 -0
  120. package/lib/tests/listParticipantsServiceStructures.spec.d.ts +1 -0
  121. package/lib/tests/listParticipantsServiceStructures.spec.js +176 -0
  122. package/lib/tests/listParticipantsServiceStructures.spec.js.map +1 -0
  123. package/lib/tests/listsServiceCreateExternalProducts.spec.d.ts +1 -0
  124. package/lib/tests/listsServiceCreateExternalProducts.spec.js +73 -0
  125. package/lib/tests/listsServiceCreateExternalProducts.spec.js.map +1 -0
  126. package/lib/tests/paymentProviders.spec.d.ts +1 -0
  127. package/lib/tests/paymentProviders.spec.js +119 -0
  128. package/lib/tests/paymentProviders.spec.js.map +1 -0
  129. package/lib/tests/paymentProvidersServiceGetProduct.spec.d.ts +1 -0
  130. package/lib/tests/paymentProvidersServiceGetProduct.spec.js +33 -0
  131. package/lib/tests/paymentProvidersServiceGetProduct.spec.js.map +1 -0
  132. package/lib/tests/shiftPlanning.spec.d.ts +1 -0
  133. package/lib/tests/shiftPlanning.spec.js +835 -0
  134. package/lib/tests/shiftPlanning.spec.js.map +1 -0
  135. package/lib/tests/structureMatch.spec.d.ts +1 -0
  136. package/lib/tests/structureMatch.spec.js +64 -0
  137. package/lib/tests/structureMatch.spec.js.map +1 -0
  138. package/package.json +2 -2
@@ -0,0 +1,57 @@
1
+ import Immutable from '../Immutable.class.js';
2
+ import ImmutableError from '../classes/errors/Immutable.error.js';
3
+ import AbsenceModel from '../models/employeeAbsence.model.js';
4
+ import CustomersService from './customers.service.js';
5
+ import { interval, planningValidation } from '../helpers/shiftPlanningTime.js';
6
+ import { planningIntervalFilter, planningPage, planningPagination } from '../helpers/shiftPlanningValidation.js';
7
+ /** Absences follow the person across employee lists and departments; a project-local absence would miss conflicts. */
8
+ export class EmployeeAbsencesService extends Immutable {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.model = AbsenceModel;
12
+ }
13
+ async normalizedInput(input, options) {
14
+ if (!(await CustomersService.peopleForPlanning([input.customer], options.company)).length) {
15
+ planningValidation('/customer', 'must identify a person in this company');
16
+ }
17
+ return { ...input, ...interval(input.start, input.end) };
18
+ }
19
+ /** Recording sickness must succeed even if existing shifts need planner attention afterward. */
20
+ async createAbsence(input, options) {
21
+ const normalized = await this.normalizedInput(input, options);
22
+ const created = await this.create({ ...normalized, company: options.company, project: options.project }, options.user, options.app);
23
+ return (await this.singleAbsence(created._id, options));
24
+ }
25
+ async singleAbsence(absence, options) {
26
+ return this.model.db.findOne({ _id: absence, company: options.company, project: options.project });
27
+ }
28
+ async changeAbsence(absence, input, options) {
29
+ if (!await this.singleAbsence(absence, options))
30
+ throw new ImmutableError('EMPLOYEE_ABSENCE_NOT_FOUND');
31
+ const normalized = await this.normalizedInput(input, options);
32
+ await this.immutable({ _id: absence, company: options.company, project: options.project }, normalized, options.user, 'change', options.app);
33
+ return (await this.singleAbsence(absence, options));
34
+ }
35
+ async removeAbsence(absence, options) {
36
+ if (!await this.singleAbsence(absence, options))
37
+ throw new ImmutableError('EMPLOYEE_ABSENCE_NOT_FOUND');
38
+ await this.delete(absence, options.user, options.app);
39
+ }
40
+ async listAbsences(filters, options) {
41
+ const query = { company: options.company, project: options.project, ...planningIntervalFilter(filters) };
42
+ if (filters.customer)
43
+ query.customer = filters.customer;
44
+ const { site, limit, skip } = planningPagination(filters);
45
+ const all = await this.model.db.countDocuments(query);
46
+ const documents = await this.model.db.find(query).sort({ start: 1, _id: 1 }).skip(skip).limit(limit).toArray();
47
+ return planningPage(documents, all, site, limit);
48
+ }
49
+ /** Scheduling checks need company-wide periods; response projections never reveal their private absence type. */
50
+ async absencesForPlanning(customers, from, to, options) {
51
+ return this.model.db.find({ company: options.company, project: options.project, customer: { $in: customers },
52
+ ...planningIntervalFilter({ from, to }),
53
+ }).toArray();
54
+ }
55
+ }
56
+ export default new EmployeeAbsencesService();
57
+ //# sourceMappingURL=employeeAbsences.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"employeeAbsences.service.js","sourceRoot":"","sources":["../../../src/services/employeeAbsences.service.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,cAAc,MAAM,sCAAsC,CAAC;AAClE,OAAO,YAAY,MAAM,oCAAoC,CAAC;AAC9D,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAEjH,sHAAsH;AACtH,MAAM,OAAO,uBAAwB,SAAQ,SAA0B;IAAvE;;QACE,UAAK,GAAG,YAAY,CAAC;IA+CvB,CAAC;IA7CS,KAAK,CAAC,eAAe,CAAC,KAA2B,EAAE,OAAoC;QAC7F,IAAI,CAAC,CAAC,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,C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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QAC/G,OAAO,YAAY,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,iHAAiH;IACjH,KAAK,CAAC,mBAAmB,CAAC,SAAqB,EAAE,IAAY,EAAE,EAAU,EAAE,OAAoC;QAC7G,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE;YAC1G,GAAG,sBAAsB,CAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;SACzD,CAAC,CAAC,OAAO,EAAE,CAAC;IACf,CAAC;CACF;AAED,eAAe,IAAI,uBAAuB,EAAE,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { Filter, ObjectId, OrderedBulkOperation, UnorderedBulkOperation, Document } from 'mongodb';
2
2
  import { HistoryReason, History, BasicData, Options } from '@lilaquadrat/interfaces';
3
+ import { HistorySeenKey } from './historySeen.service.js';
4
+ type HistoryTenantUser = Pick<HistorySeenKey, 'user' | 'company' | 'project'>;
3
5
  declare class HistoryService {
4
6
  model: import("../classes/modelv2.class.js").default<History, string>;
5
7
  /**
@@ -36,6 +38,19 @@ declare class HistoryService {
36
38
  countQuery: Filter<History>;
37
39
  aggregation: any[];
38
40
  };
41
+ /**
42
+ * the snapshot of one history entry together with the snapshot of the version before it, so the
43
+ * changes can be shown. the first version (0, the creation) has no previous one.
44
+ * the extra filter keeps callers with a narrower permission inside their scope, e.g. a single list.
45
+ */
46
+ entryWithPrevious(company: string, project: string | undefined, historyId: ObjectId, scopeFilter?: Filter<History>): Promise<{
47
+ current: import("mongodb").WithId<History>;
48
+ previous: import("mongodb").WithId<History> | null;
49
+ } | null>;
50
+ /** the whole model of a tenant is the watched scope, entities with a parent use their own scope instead */
51
+ private modelSeenKey;
52
+ unreadCount(options: HistoryTenantUser, model: string): Promise<number>;
53
+ markSeen(options: HistoryTenantUser, model: string): Promise<ObjectId | null>;
39
54
  export(options: Options & {
40
55
  model?: string;
41
56
  }): Promise<import("mongodb").WithId<History>[]>;
@@ -4,6 +4,7 @@ import partialAggregation from '../aggegations/partial.aggregation.js';
4
4
  import { HistoryModel } from '../../models.js';
5
5
  import HistoryError from '../classes/errors/History.error.js';
6
6
  import genericDataAggregation from '../aggegations/genericData.aggregation.js';
7
+ import HistorySeenService from './historySeen.service.js';
7
8
  class HistoryService {
8
9
  constructor() {
9
10
  this.model = HistoryModel;
@@ -245,6 +246,41 @@ class HistoryService {
245
246
  aggregation,
246
247
  };
247
248
  }
249
+ /**
250
+ * the snapshot of one history entry together with the snapshot of the version before it, so the
251
+ * changes can be shown. the first version (0, the creation) has no previous one.
252
+ * the extra filter keeps callers with a narrower permission inside their scope, e.g. a single list.
253
+ */
254
+ async entryWithPrevious(company, project, historyId, scopeFilter = {}) {
255
+ const tenant = { company, project: project ?? null };
256
+ const current = await this.model.db.findOne({ ...scopeFilter, ...tenant, _id: historyId });
257
+ if (!current)
258
+ return null;
259
+ const previous = current.history.version > 0
260
+ ? await this.model.db.findOne({
261
+ ...tenant,
262
+ 'history.parent': current.history.parent,
263
+ 'history.version': current.history.version - 1,
264
+ })
265
+ : null;
266
+ return { current, previous };
267
+ }
268
+ /** the whole model of a tenant is the watched scope, entities with a parent use their own scope instead */
269
+ modelSeenKey(options, model) {
270
+ return {
271
+ user: options.user,
272
+ company: options.company,
273
+ project: options.project,
274
+ model,
275
+ scope: model,
276
+ };
277
+ }
278
+ unreadCount(options, model) {
279
+ return HistorySeenService.unreadCount(this.modelSeenKey(options, model), {});
280
+ }
281
+ markSeen(options, model) {
282
+ return HistorySeenService.markSeen(this.modelSeenKey(options, model), {});
283
+ }
248
284
  export(options) {
249
285
  return this.model.db.find({ company: options.company, project: options.project, 'history.model': options.model }).toArray();
250
286
  }
@@ -1 +1 @@
1
- {"version":3,"file":"history.service.js","sourceRoot":"","sources":["../../../src/services/history.service.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,oBAAoB,MAAM,yCAAyC,CAAC;AAC3E,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,YAAY,MAAM,oCAAoC,CAAC;AAE9D,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAE/E,MAAM,cAAc;IAApB;QAEE,UAAK,GAAG,YAAY,CAAC;IAiYvB,CAAC;IA/XC;;;;;OAKG;IACK,UAAU;QAEhB,OAAO;YACL;gBACE,OAAO,EAAE;oBACP,IAAI,EAAE,IAAI;oBACV,EAAE,EAAE,UAAU;oBACd,GAAG,EAAE;wBACH,MAAM,EAAE,eAAe;wBACvB,GAAG,EAAE,cAAc;wBACnB,OAAO,EAAE,UAAU;wBACnB,MAAM,EAAE,iBAAiB;qBAC1B;oBACD,QAAQ,EAAE;wBACR;4BACE,MAAM,EAAE;gCACN,KAAK,EAAE;oCACL,IAAI,EAAE;wCACJ,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE;wCAC5B,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE;qCAChC;iCACF;6BACF;yBACF;wBACD;4BACE,QAAQ,EAAE;gCACR,OAAO,EAAE,CAAC;gCACV,QAAQ,EAAE,CAAC;6BACZ;yBACF;wBACD;4BACE,UAAU,EAAE;gCACV,IAAI,EAAE,WAAW;gCACjB,QAAQ,EAAE;oCACR;wCACE,MAAM,EAAE;4CACN,KAAK,EAAE;gDACL,IAAI,EAAE;oDACJ,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE;oDAC/B,EAAE,GA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;gBACV,QAAQ,EAAE;oBACR,OAAO,EAAE,CAAC;oBACV,EAAE,EAAE,CAAC;oBACL,OAAO,EAAE,CAAC;oBACV,OAAO,EAAE,CAAC;iBACX;aACF,CAAC,CAAC;QAEL,CAAC;QAED,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;QAE5B,OAAO;YACL,UAAU;YACV,WAAW;SACZ,CAAC;IAEJ,CAAC;IAED,MAAM,CAAC,OAAqC;QAE1C,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAE9H,CAAC;CAEF;AACD,eAAe,IAAI,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"history.service.js","sourceRoot":"","sources":["../../../src/services/history.service.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,oBAAoB,MAAM,yCAAyC,CAAC;AAC3E,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,YAAY,MAAM,oCAAoC,CAAC;AAE9D,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAC/E,OAAO,kBAAsC,MAAM,0BAA0B,CAAC;AAI9E,MAAM,cAAc;IAApB;QAEE,UAAK,GAAG,YAAY,CAAC;IAubvB,CAAC;IArbC;;;;;OAKG;IACK,UAAU;QAEhB,OAAO;YACL;gBACE,OAAO,EAAE;oBACP,IAAI,EAAE,IAAI;oBACV,EAAE,EAAE,UAAU;oBACd,GAAG,EAAE;wBACH,MAAM,EAAE,eAAe;wBACvB,GAAG,EAAE,cAAc;wBACnB,OAAO,EAAE,UAAU;wBACnB,MAAM,EAAE,iBAAiB;qBAC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from '@lilaquadrat/interfaces';
3
+ export interface HistorySeenKey {
4
+ user: string;
5
+ company: string;
6
+ project?: string;
7
+ model: string;
8
+ scope: string;
9
+ }
10
+ declare class HistorySeenService {
11
+ /** bounds the cost of counting a long unseen history, callers display anything at the limit as "limit+" */
12
+ readonly countLimit = 100;
13
+ /**
14
+ * restricts the history to the watched scope. tenant and model keys are applied last
15
+ * so a caller supplied filter can never widen the query beyond the key.
16
+ */
17
+ private historyFilter;
18
+ private markerKey;
19
+ /**
20
+ * number of history entries newer than the marker of the user, up to countLimit.
21
+ * entries written by the user themselves are not news to them. without a marker everything is unread.
22
+ */
23
+ unreadCount(key: HistorySeenKey, scopeFilter: Filter<History>): Promise<number>;
24
+ /**
25
+ * moves the marker to the newest history entry that exists right now. resolved on the server so
26
+ * entries written between loading the screen and calling this are not marked as seen by accident.
27
+ * the marker only ever moves forward.
28
+ */
29
+ markSeen(key: HistorySeenKey, scopeFilter: Filter<History>): Promise<ObjectId | null>;
30
+ }
31
+ declare const _default: HistorySeenService;
32
+ export default _default;
@@ -0,0 +1,66 @@
1
+ import HistoryModel from '../models/history.model.js';
2
+ import HistorySeenModel from '../models/historySeen.model.js';
3
+ class HistorySeenService {
4
+ constructor() {
5
+ /** bounds the cost of counting a long unseen history, callers display anything at the limit as "limit+" */
6
+ this.countLimit = 100;
7
+ }
8
+ /**
9
+ * restricts the history to the watched scope. tenant and model keys are applied last
10
+ * so a caller supplied filter can never widen the query beyond the key.
11
+ */
12
+ historyFilter(key, scopeFilter) {
13
+ const filter = {
14
+ ...scopeFilter,
15
+ company: key.company,
16
+ 'history.model': key.model,
17
+ };
18
+ if (key.project)
19
+ filter.project = key.project;
20
+ return filter;
21
+ }
22
+ markerKey(key) {
23
+ const markerKey = {
24
+ user: key.user,
25
+ company: key.company,
26
+ model: key.model,
27
+ scope: key.scope,
28
+ };
29
+ if (key.project)
30
+ markerKey.project = key.project;
31
+ return markerKey;
32
+ }
33
+ /**
34
+ * number of history entries newer than the marker of the user, up to countLimit.
35
+ * entries written by the user themselves are not news to them. without a marker everything is unread.
36
+ */
37
+ async unreadCount(key, scopeFilter) {
38
+ const marker = await HistorySeenModel.db.findOne(this.markerKey(key), { projection: { lastSeenId: 1 } });
39
+ const filter = this.historyFilter(key, scopeFilter);
40
+ filter['history.user'] = { $ne: key.user };
41
+ if (marker?.lastSeenId)
42
+ filter._id = { $gt: marker.lastSeenId };
43
+ return HistoryModel.db.countDocuments(filter, { limit: this.countLimit });
44
+ }
45
+ /**
46
+ * moves the marker to the newest history entry that exists right now. resolved on the server so
47
+ * entries written between loading the screen and calling this are not marked as seen by accident.
48
+ * the marker only ever moves forward.
49
+ */
50
+ async markSeen(key, scopeFilter) {
51
+ const [newest] = await HistoryModel.db
52
+ .find(this.historyFilter(key, scopeFilter), { projection: { _id: 1 } })
53
+ .sort({ _id: -1 })
54
+ .limit(1)
55
+ .toArray();
56
+ if (!newest)
57
+ return null;
58
+ await HistorySeenModel.db.updateOne(this.markerKey(key), {
59
+ $max: { lastSeenId: newest._id },
60
+ $set: { seenAt: new Date() },
61
+ }, { upsert: true });
62
+ return newest._id;
63
+ }
64
+ }
65
+ export default new HistorySeenService();
66
+ //# sourceMappingURL=historySeen.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historySeen.service.js","sourceRoot":"","sources":["../../../src/services/historySeen.service.ts"],"names":[],"mappings":"AAEA,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAU9D,MAAM,kBAAkB;IAAxB;QAEE,2GAA2G;QAClG,eAAU,GAAG,GAAG,CAAC;IAgF5B,CAAC;IA9EC;;;OAGG;IACK,aAAa,CAAC,GAAmB,EAAE,WAA4B;QAErE,MAAM,MAAM,GAAoB;YAC9B,GAAG,WAAW;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,eAAe,EAAE,GAAG,CAAC,KAAK;SAC3B,CAAC;QAEF,IAAI,GAAG,CAAC,OAAO;Y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GAAG,EAAE,WAAW,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;aACtE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;aACjB,KAAK,CAAC,CAAC,CAAC;aACR,OAAO,EAAE,CAAC;QAEb,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAEzB,MAAM,gBAAgB,CAAC,EAAE,CAAC,SAAS,CACjC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EACnB;YACE,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,EAAE;YAChC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,IAAI,EAAE,EAAE;SAC7B,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAC;QAEF,OAAO,MAAM,CAAC,GAAG,CAAC;IAEpB,CAAC;CAEF;AAED,eAAe,IAAI,kBAAkB,EAAE,CAAC"}
@@ -1,9 +1,25 @@
1
- import { ObjectId, UnorderedBulkOperation, WithId } from 'mongodb';
1
+ import { ObjectId, UnorderedBulkOperation, UpdateResult, WithId } from 'mongodb';
2
2
  import Immutable from '../Immutable.class.js';
3
- import { Agreement, AgreementResponse, BasicData, CustomerPersonWithEmail, EmailsContent, History, HistoryReason, HistoryWithType, List, ListParticipants, ListParticipantWithCustomerAndPayment, ObjectIdString, Options, SkipLimitSort, UserAppWithOptions } from '@lilaquadrat/interfaces';
3
+ import { Agreement, AgreementResponse, BasicData, CustomerPersonWithEmail, EmailsContent, History, HistoryReason, HistoryWithType, List, ListParticipants, ListParticipantWithCustomerAndPayment, ObjectIdString, Options, SkipLimitSort, Structure, StructureCondition, UserAppWithOptions } from '@lilaquadrat/interfaces';
4
4
  import { ValidateFunction } from 'ajv';
5
5
  export declare class ListParticipantsService extends Immutable<ListParticipants> {
6
6
  model: import("../classes/modelv2.class.js").default<ListParticipants, string>;
7
+ singleForPlanning(list: ObjectId, participant: ObjectId, options: Required<UserAppWithOptions>): Promise<WithId<ListParticipants> | null>;
8
+ /** Reports retain unavailable entries; the scheduling layer applies eligibility only to new assignments. */
9
+ participantsForPlanning(participants: ObjectId[], company: string): Promise<WithId<ListParticipants>[]>;
10
+ /** Attaches each participant's answers, their list definitions and the customer's to the entry. */
11
+ private resolveParticipantDetails;
12
+ /** Same entries as participantsForPlanning, resolved with their structure answers and definitions for reporting. */
13
+ participantsForPlanningWithDetails(participants: ObjectId[], company: string): Promise<ListParticipantWithCustomerAndPayment[]>;
14
+ /**
15
+ * Candidates for a list, resolved and scored against a shift's conditions, ordered best-first.
16
+ * The ordering happens here so pagination ranks the whole candidate set instead of a single page.
17
+ */
18
+ planningParticipants(list: ObjectId, conditions: StructureCondition[] | undefined, categories: ObjectId[] | undefined, state: ListParticipants['state'][] | undefined, search: string | undefined, options: Required<UserAppWithOptions> & SkipLimitSort): Promise<{
19
+ all: number;
20
+ data: ListParticipantWithCustomerAndPayment[];
21
+ count: number;
22
+ }>;
7
23
  customerLookup: ({
8
24
  $lookup: {
9
25
  from: string;
@@ -11,7 +27,78 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
11
27
  let: {
12
28
  userid: string;
13
29
  };
14
- pipeline: {
30
+ pipeline: ({
31
+ $addFields: {
32
+ structureIds: {
33
+ $reduce: {
34
+ input: {
35
+ $objectToArray: string;
36
+ };
37
+ initialValue: never[];
38
+ in: {
39
+ $cond: {
40
+ if: {
41
+ $eq: (string | {
42
+ $substrCP: (string | number)[];
43
+ })[];
44
+ };
45
+ then: {
46
+ $concatArrays: (string | string[])[];
47
+ };
48
+ else: string;
49
+ };
50
+ };
51
+ };
52
+ };
53
+ };
54
+ $lookup?: undefined;
55
+ $project?: undefined;
56
+ } | {
57
+ $lookup: {
58
+ from: string;
59
+ let: {
60
+ structureIds: string;
61
+ company: string;
62
+ project: string;
63
+ };
64
+ pipeline: ({
65
+ $match: {
66
+ $expr: {
67
+ $and: ({
68
+ $eq: (string | {
69
+ $type: string;
70
+ })[];
71
+ $in?: undefined;
72
+ } | {
73
+ $in: string[];
74
+ $eq?: undefined;
75
+ })[];
76
+ };
77
+ };
78
+ $project?: undefined;
79
+ } | {
80
+ $project: {
81
+ _id: number;
82
+ id: number;
83
+ type: number;
84
+ question: number;
85
+ description: number;
86
+ options: number;
87
+ multiple: number;
88
+ };
89
+ $match?: undefined;
90
+ })[];
91
+ as: string;
92
+ };
93
+ $addFields?: undefined;
94
+ $project?: undefined;
95
+ } | {
96
+ $project: {
97
+ structureIds: number;
98
+ };
99
+ $addFields?: undefined;
100
+ $lookup?: undefined;
101
+ } | {
15
102
  $match: {
16
103
  $and: {
17
104
  $expr: {
@@ -19,7 +106,7 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
19
106
  };
20
107
  }[];
21
108
  };
22
- }[];
109
+ })[];
23
110
  };
24
111
  $unwind?: undefined;
25
112
  $addFields?: undefined;
@@ -35,12 +122,46 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
35
122
  } | {
36
123
  $addFields: {
37
124
  user: {
38
- name: {
39
- $concat: string[];
40
- };
41
- email: string;
42
- id: string;
43
- _id: string;
125
+ $mergeObjects: ({
126
+ name: {
127
+ $concat: string[];
128
+ };
129
+ email: string;
130
+ id: string;
131
+ _id: string;
132
+ $arrayToObject?: undefined;
133
+ structures?: undefined;
134
+ } | {
135
+ $arrayToObject: {
136
+ $filter: {
137
+ input: {
138
+ $objectToArray: {
139
+ $ifNull: {}[];
140
+ };
141
+ };
142
+ as: string;
143
+ cond: {
144
+ $eq: (string | {
145
+ $substrCP: (string | number)[];
146
+ })[];
147
+ };
148
+ };
149
+ };
150
+ name?: undefined;
151
+ email?: undefined;
152
+ id?: undefined;
153
+ _id?: undefined;
154
+ structures?: undefined;
155
+ } | {
156
+ structures: {
157
+ $ifNull: (string | never[])[];
158
+ };
159
+ name?: undefined;
160
+ email?: undefined;
161
+ id?: undefined;
162
+ _id?: undefined;
163
+ $arrayToObject?: undefined;
164
+ })[];
44
165
  };
45
166
  };
46
167
  $lookup?: undefined;
@@ -157,7 +278,7 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
157
278
  * get state of the provided account for this list
158
279
  */
159
280
  stateForAccount(list: ObjectId, account: string, options: Required<UserAppWithOptions>): Promise<ListParticipants>;
160
- updateAfterCheck(useful: boolean, explanation: string | undefined, partiticpantInternalId: ObjectId, listInternalId: ObjectId, options: Required<UserAppWithOptions>): Promise<import("mongodb").UpdateResult<import("bson").Document>>;
281
+ updateAfterCheck(useful: boolean, explanation: string | undefined, partiticpantInternalId: ObjectId, listInternalId: ObjectId, options: Required<UserAppWithOptions>): Promise<UpdateResult<import("bson").Document>>;
161
282
  private getValidatorForStructures;
162
283
  createParticipantsObject(list: ObjectId, mode: List['mode'], user: ObjectId, state: ListParticipants['state'], message: string | undefined, category: string | undefined, payment: ObjectId | undefined, structureInput: Record<string, string | boolean | number> | undefined, agreements: AgreementResponse[], options: Required<UserAppWithOptions>): ListParticipants;
163
284
  /**
@@ -210,7 +331,8 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
210
331
  * values are validated against the project's listsParticipants structures, no email is sent.
211
332
  */
212
333
  membersStructures(list: ObjectId, account: string, structureInput: Record<string, string | boolean | number | string[]>, options: Required<UserAppWithOptions>): Promise<WithId<ListParticipants> | null>;
213
- note(list: ObjectId, participationId: ObjectId, note: ListParticipants['note'] | undefined, options: Required<UserAppWithOptions>): Promise<import("mongodb").UpdateResult<import("bson").Document>>;
334
+ updateStructures(list: ObjectId, participationId: ObjectId, structures: Record<string, string | boolean | number | string[]>, options: Required<UserAppWithOptions>): Promise<UpdateResult>;
335
+ note(list: ObjectId, participationId: ObjectId, note: ListParticipants['note'] | undefined, options: Required<UserAppWithOptions>): Promise<UpdateResult<import("bson").Document>>;
214
336
  participantInList(list: ObjectId, user: ObjectId, options: Required<UserAppWithOptions>): Promise<boolean>;
215
337
  singleWithoutLookup(list: ObjectId, user: ObjectId, options: Required<UserAppWithOptions>): Promise<WithId<ListParticipants> | null>;
216
338
  viaPayment(listId: ObjectId, paymentId: ObjectId, options: Required<UserAppWithOptions>): Promise<ListParticipantWithCustomerAndPayment>;
@@ -230,6 +352,15 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
230
352
  data: HistoryWithType<ListParticipants>[];
231
353
  count: number;
232
354
  }>;
355
+ /** a history entry of this list and the version before it, with the structures that name the custom fields */
356
+ historyEntry(list: ObjectId, historyId: ObjectId, options: Required<UserAppWithOptions>): Promise<{
357
+ structures: WithId<Structure>[];
358
+ current: WithId<History>;
359
+ previous: WithId<History> | null;
360
+ } | null>;
361
+ private historySeenKey;
362
+ historyUnreadCount(list: ObjectId, options: Required<UserAppWithOptions>): Promise<number>;
363
+ markHistorySeen(list: ObjectId, options: Required<UserAppWithOptions>): Promise<ObjectId | null>;
233
364
  agreementsMissing(listAgreements: Agreement[], providedAgreements: AgreementResponse[]): string[];
234
365
  listParticipants(list: ObjectId, state: ListParticipants['state'][] | undefined, category: string[] | undefined, lastname: string | undefined, options: UserAppWithOptions & SkipLimitSort): Promise<{
235
366
  all: number;