@lilaquadrat/studio 12.1.0 → 12.3.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.
- package/lib/models.d.ts +8 -1
- package/lib/models.js +8 -1
- package/lib/models.js.map +1 -1
- package/lib/services.d.ts +8 -1
- package/lib/services.js +8 -1
- package/lib/services.js.map +1 -1
- package/lib/src/Immutable.class.js +10 -4
- package/lib/src/Immutable.class.js.map +1 -1
- package/lib/src/aggegations/structures.aggregation.d.ts +6 -8
- package/lib/src/aggegations/structures.aggregation.js +3 -2
- package/lib/src/aggegations/structures.aggregation.js.map +1 -1
- package/lib/src/classes/paymentProviders/PaymentProviderFactory.class.d.ts +4 -0
- package/lib/src/classes/paymentProviders/PaymentProviderFactory.class.js +8 -0
- package/lib/src/classes/paymentProviders/PaymentProviderFactory.class.js.map +1 -0
- package/lib/src/classes/paymentProviders/StripePaymentProvider.class.d.ts +9 -0
- package/lib/src/classes/paymentProviders/StripePaymentProvider.class.js +49 -0
- package/lib/src/classes/paymentProviders/StripePaymentProvider.class.js.map +1 -0
- package/lib/src/classes/shiftPlanningModel.class.d.ts +6 -0
- package/lib/src/classes/shiftPlanningModel.class.js +26 -0
- package/lib/src/classes/shiftPlanningModel.class.js.map +1 -0
- package/lib/src/helpers/buildProductName.d.ts +7 -0
- package/lib/src/helpers/buildProductName.js +20 -0
- package/lib/src/helpers/buildProductName.js.map +1 -0
- package/lib/src/helpers/shiftPlanAllocation.d.ts +53 -0
- package/lib/src/helpers/shiftPlanAllocation.js +110 -0
- package/lib/src/helpers/shiftPlanAllocation.js.map +1 -0
- package/lib/src/helpers/shiftPlanCoverage.d.ts +2 -0
- package/lib/src/helpers/shiftPlanCoverage.js +4 -0
- package/lib/src/helpers/shiftPlanCoverage.js.map +1 -0
- package/lib/src/helpers/shiftPlanningReports.d.ts +7 -0
- package/lib/src/helpers/shiftPlanningReports.js +135 -0
- package/lib/src/helpers/shiftPlanningReports.js.map +1 -0
- package/lib/src/helpers/shiftPlanningSchemas.d.ts +143 -0
- package/lib/src/helpers/shiftPlanningSchemas.js +87 -0
- package/lib/src/helpers/shiftPlanningSchemas.js.map +1 -0
- package/lib/src/helpers/shiftPlanningTime.d.ts +24 -0
- package/lib/src/helpers/shiftPlanningTime.js +215 -0
- package/lib/src/helpers/shiftPlanningTime.js.map +1 -0
- package/lib/src/helpers/shiftPlanningValidation.d.ts +32 -0
- package/lib/src/helpers/shiftPlanningValidation.js +69 -0
- package/lib/src/helpers/shiftPlanningValidation.js.map +1 -0
- package/lib/src/helpers/structureMatch.d.ts +15 -0
- package/lib/src/helpers/structureMatch.js +72 -0
- package/lib/src/helpers/structureMatch.js.map +1 -0
- package/lib/src/interfaces/ListPlanningParticipant.d.ts +17 -0
- package/lib/src/interfaces/ListPlanningParticipant.js +2 -0
- package/lib/src/interfaces/ListPlanningParticipant.js.map +1 -0
- package/lib/src/interfaces/PaymentProviderBase.d.ts +14 -0
- package/lib/src/interfaces/PaymentProviderBase.js +2 -0
- package/lib/src/interfaces/PaymentProviderBase.js.map +1 -0
- package/lib/src/interfaces/PlanCoveragePreparation.d.ts +17 -0
- package/lib/src/interfaces/PlanCoveragePreparation.js +2 -0
- package/lib/src/interfaces/PlanCoveragePreparation.js.map +1 -0
- package/lib/src/interfaces/PlanningParticipantsResult.d.ts +12 -0
- package/lib/src/interfaces/PlanningParticipantsResult.js +2 -0
- package/lib/src/interfaces/PlanningParticipantsResult.js.map +1 -0
- package/lib/src/interfaces/ShiftAutofillResult.d.ts +6 -0
- package/lib/src/interfaces/ShiftAutofillResult.js +2 -0
- package/lib/src/interfaces/ShiftAutofillResult.js.map +1 -0
- package/lib/src/interfaces/ShiftReportContextOptions.d.ts +9 -0
- package/lib/src/interfaces/ShiftReportContextOptions.js +2 -0
- package/lib/src/interfaces/ShiftReportContextOptions.js.map +1 -0
- package/lib/src/models/customers.model.js +10 -0
- package/lib/src/models/customers.model.js.map +1 -1
- package/lib/src/models/employeeAbsence.model.d.ts +4 -0
- package/lib/src/models/employeeAbsence.model.js +11 -0
- package/lib/src/models/employeeAbsence.model.js.map +1 -0
- package/lib/src/models/historySeen.model.d.ts +4 -0
- package/lib/src/models/historySeen.model.js +30 -0
- package/lib/src/models/historySeen.model.js.map +1 -0
- package/lib/src/models/lists.model.js +2 -1
- package/lib/src/models/lists.model.js.map +1 -1
- package/lib/src/models/listsParticipants.model.js +11 -0
- package/lib/src/models/listsParticipants.model.js.map +1 -1
- package/lib/src/models/permissions.model.js +28 -0
- package/lib/src/models/permissions.model.js.map +1 -1
- package/lib/src/models/shift.model.d.ts +4 -0
- package/lib/src/models/shift.model.js +17 -0
- package/lib/src/models/shift.model.js.map +1 -0
- package/lib/src/models/shiftPlan.model.d.ts +4 -0
- package/lib/src/models/shiftPlan.model.js +14 -0
- package/lib/src/models/shiftPlan.model.js.map +1 -0
- package/lib/src/models/shiftPlanDays.model.d.ts +4 -0
- package/lib/src/models/shiftPlanDays.model.js +15 -0
- package/lib/src/models/shiftPlanDays.model.js.map +1 -0
- package/lib/src/models/shiftPlanningSettings.model.d.ts +4 -0
- package/lib/src/models/shiftPlanningSettings.model.js +10 -0
- package/lib/src/models/shiftPlanningSettings.model.js.map +1 -0
- package/lib/src/models/workAreas.model.d.ts +4 -0
- package/lib/src/models/workAreas.model.js +12 -0
- package/lib/src/models/workAreas.model.js.map +1 -0
- package/lib/src/services/customers.service.d.ts +12 -1
- package/lib/src/services/customers.service.js +27 -0
- package/lib/src/services/customers.service.js.map +1 -1
- package/lib/src/services/employeeAbsences.service.d.ts +18 -0
- package/lib/src/services/employeeAbsences.service.js +57 -0
- package/lib/src/services/employeeAbsences.service.js.map +1 -0
- package/lib/src/services/history.service.d.ts +15 -0
- package/lib/src/services/history.service.js +36 -0
- package/lib/src/services/history.service.js.map +1 -1
- package/lib/src/services/historySeen.service.d.ts +32 -0
- package/lib/src/services/historySeen.service.js +66 -0
- package/lib/src/services/historySeen.service.js.map +1 -0
- package/lib/src/services/listParticipants.service.d.ts +180 -12
- package/lib/src/services/listParticipants.service.js +426 -6
- package/lib/src/services/listParticipants.service.js.map +1 -1
- package/lib/src/services/lists.service.d.ts +9 -0
- package/lib/src/services/lists.service.js +51 -0
- package/lib/src/services/lists.service.js.map +1 -1
- package/lib/src/services/paymentProviders.service.d.ts +5 -0
- package/lib/src/services/paymentProviders.service.js +10 -0
- package/lib/src/services/paymentProviders.service.js.map +1 -1
- package/lib/src/services/shiftPlanDays.service.d.ts +22 -0
- package/lib/src/services/shiftPlanDays.service.js +80 -0
- package/lib/src/services/shiftPlanDays.service.js.map +1 -0
- package/lib/src/services/shiftPlanningSettings.service.d.ts +11 -0
- package/lib/src/services/shiftPlanningSettings.service.js +27 -0
- package/lib/src/services/shiftPlanningSettings.service.js.map +1 -0
- package/lib/src/services/shiftPlans.service.d.ts +24 -0
- package/lib/src/services/shiftPlans.service.js +139 -0
- package/lib/src/services/shiftPlans.service.js.map +1 -0
- package/lib/src/services/shifts.service.d.ts +46 -0
- package/lib/src/services/shifts.service.js +405 -0
- package/lib/src/services/shifts.service.js.map +1 -0
- package/lib/src/services/structures.service.d.ts +2 -0
- package/lib/src/services/structures.service.js +7 -0
- package/lib/src/services/structures.service.js.map +1 -1
- package/lib/src/services/workAreas.service.d.ts +18 -0
- package/lib/src/services/workAreas.service.js +67 -0
- package/lib/src/services/workAreas.service.js.map +1 -0
- package/lib/tests/buildProductName.spec.d.ts +1 -0
- package/lib/tests/buildProductName.spec.js +27 -0
- package/lib/tests/buildProductName.spec.js.map +1 -0
- package/lib/tests/customersServiceStructures.spec.d.ts +1 -0
- package/lib/tests/customersServiceStructures.spec.js +146 -0
- package/lib/tests/customersServiceStructures.spec.js.map +1 -0
- package/lib/tests/historySeenService.spec.d.ts +1 -0
- package/lib/tests/historySeenService.spec.js +159 -0
- package/lib/tests/historySeenService.spec.js.map +1 -0
- package/lib/tests/listParticipantsPlanning.spec.d.ts +1 -0
- package/lib/tests/listParticipantsPlanning.spec.js +479 -0
- package/lib/tests/listParticipantsPlanning.spec.js.map +1 -0
- package/lib/tests/listParticipantsServiceStructures.spec.d.ts +1 -0
- package/lib/tests/listParticipantsServiceStructures.spec.js +176 -0
- package/lib/tests/listParticipantsServiceStructures.spec.js.map +1 -0
- package/lib/tests/listsServiceCreateExternalProducts.spec.d.ts +1 -0
- package/lib/tests/listsServiceCreateExternalProducts.spec.js +91 -0
- package/lib/tests/listsServiceCreateExternalProducts.spec.js.map +1 -0
- package/lib/tests/paymentProviders.spec.d.ts +1 -0
- package/lib/tests/paymentProviders.spec.js +119 -0
- package/lib/tests/paymentProviders.spec.js.map +1 -0
- package/lib/tests/paymentProvidersServiceGetProduct.spec.d.ts +1 -0
- package/lib/tests/paymentProvidersServiceGetProduct.spec.js +33 -0
- package/lib/tests/paymentProvidersServiceGetProduct.spec.js.map +1 -0
- package/lib/tests/shiftPlanCoverage.spec.d.ts +1 -0
- package/lib/tests/shiftPlanCoverage.spec.js +189 -0
- package/lib/tests/shiftPlanCoverage.spec.js.map +1 -0
- package/lib/tests/shiftPlanning.spec.d.ts +1 -0
- package/lib/tests/shiftPlanning.spec.js +1162 -0
- package/lib/tests/shiftPlanning.spec.js.map +1 -0
- package/lib/tests/shiftPlanningTime.spec.d.ts +1 -0
- package/lib/tests/shiftPlanningTime.spec.js +90 -0
- package/lib/tests/shiftPlanningTime.spec.js.map +1 -0
- package/lib/tests/structureMatch.spec.d.ts +1 -0
- package/lib/tests/structureMatch.spec.js +106 -0
- package/lib/tests/structureMatch.spec.js.map +1 -0
- package/package.json +2 -2
|
@@ -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;YAAE,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAE9C,OAAO,MAAM,CAAC;IAEhB,CAAC;IAEO,SAAS,CAAC,GAAmB;QAEnC,MAAM,SAAS,GAAwB;YACrC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,KAAK,EAAE,GAAG,CAAC,KAAK;SACjB,CAAC;QAEF,IAAI,GAAG,CAAC,OAAO;YAAE,SAAS,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAEjD,OAAO,SAAS,CAAC;IAEnB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CAAC,GAAmB,EAAE,WAA4B;QAEjE,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACzG,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAEpD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QAE3C,IAAI,MAAM,EAAE,UAAU;YAAE,MAAM,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;QAEhE,OAAO,YAAY,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAE5E,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,GAAmB,EAAE,WAA4B;QAE9D,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,YAAY,CAAC,EAAE;aACnC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,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,62 @@
|
|
|
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, PlanningScope, PlanningShiftMembership, ShiftPlanCoverageSummary, ShiftPlanningProjectOptions, ShiftReportContext, SkipLimitSort, Structure, UserAppWithOptions } from '@lilaquadrat/interfaces';
|
|
4
4
|
import { ValidateFunction } from 'ajv';
|
|
5
|
+
import type { PlanningParticipantsResult } from '../interfaces/PlanningParticipantsResult.js';
|
|
6
|
+
import type { PlanCoveragePreparation } from '../interfaces/PlanCoveragePreparation.js';
|
|
5
7
|
export declare class ListParticipantsService extends Immutable<ListParticipants> {
|
|
6
8
|
model: import("../classes/modelv2.class.js").default<ListParticipants, string>;
|
|
9
|
+
singleForPlanning(list: ObjectId, participant: ObjectId, options: Required<UserAppWithOptions>): Promise<WithId<ListParticipants> | null>;
|
|
10
|
+
/** Reports retain unavailable entries; the scheduling layer applies eligibility only to new assignments. */
|
|
11
|
+
participantsForPlanning(participants: ObjectId[], company: string): Promise<WithId<ListParticipants>[]>;
|
|
12
|
+
/** Attaches each participant's answers, their list definitions and the customer's to the entry. */
|
|
13
|
+
private resolveParticipantDetails;
|
|
14
|
+
/** Same entries as participantsForPlanning, resolved with their structure answers and definitions for reporting. */
|
|
15
|
+
participantsForPlanningWithDetails(participants: ObjectId[], company: string): Promise<ListParticipantWithCustomerAndPayment[]>;
|
|
16
|
+
/** Raw availability and resolved answers share the same reads within one scheduling request. */
|
|
17
|
+
planningParticipantContext(participantIds: ObjectId[], customerIds: ObjectId[], company: string, preparation?: PlanCoveragePreparation): Promise<Pick<ShiftReportContext, 'participants' | 'participantDetails' | 'customers'>>;
|
|
18
|
+
/**
|
|
19
|
+
* Candidates for a list scored against a planning scope, ordered best-first so pagination ranks
|
|
20
|
+
* the whole candidate set. `shift` and `workArea` resolve one condition set and return the pool;
|
|
21
|
+
* `day` and `plan` cover every shift in that scope and return its coverage, unless a membership
|
|
22
|
+
* mode is given, in which case they return the membership-filtered pool.
|
|
23
|
+
*/
|
|
24
|
+
planningParticipants(list: ObjectId, scope: PlanningScope, state: ListParticipants['state'][] | undefined, categories: ObjectId[] | undefined, search: string | undefined, options: Required<UserAppWithOptions> & SkipLimitSort,
|
|
25
|
+
/** Optional membership mode; absent makes a day/plan scope return coverage instead of the pool. */
|
|
26
|
+
membership?: PlanningShiftMembership, coverageMode?: 'staffing' | 'matching'): Promise<PlanningParticipantsResult>;
|
|
27
|
+
/** Conditions a scope is scored against; the work area's are used when a shift has none of its own. */
|
|
28
|
+
private scopeConditions;
|
|
29
|
+
/** Participants holding at least one assignment anywhere in the scope's plan; empty when no plan exists. */
|
|
30
|
+
private planMembership;
|
|
31
|
+
private scoringCandidates;
|
|
32
|
+
/** Definitions that matter to one condition set, split by the model they belong to. */
|
|
33
|
+
private scoringStructures;
|
|
34
|
+
/**
|
|
35
|
+
* Scores resolved entries against one condition set and orders the feasible ones first. Unfit
|
|
36
|
+
* candidates fail a required/forbidden constraint, so they rank after every feasible one.
|
|
37
|
+
*/
|
|
38
|
+
private scoreEntries;
|
|
39
|
+
/** Resolves the list's entries against one condition set and orders them best-first. */
|
|
40
|
+
private scoredEntries;
|
|
41
|
+
/**
|
|
42
|
+
* Shared reads and ranked candidate pools for a planning scope. The list, its structures, the
|
|
43
|
+
* customer structures and every used work area are read once, and all condition answers and
|
|
44
|
+
* categories are fetched in a single entries query; ranking then happens in memory per shift.
|
|
45
|
+
* Coverage and autofill both build on this, so a scope resolves to the same targets either way.
|
|
46
|
+
*/
|
|
47
|
+
prepareShiftPlanning(list: ObjectId, scope: PlanningScope, options: ShiftPlanningProjectOptions): Promise<PlanCoveragePreparation | undefined>;
|
|
48
|
+
/** Diagnostic data shared by a coverage run; the schedule is supplied per allocation step. */
|
|
49
|
+
private coverageReportContext;
|
|
50
|
+
/**
|
|
51
|
+
* Coverage of every shift in the linked (or given) plan or day. Only the plan's own shifts are
|
|
52
|
+
* compared, so collisions with other plans are out of scope.
|
|
53
|
+
*/
|
|
54
|
+
private planCoverage;
|
|
55
|
+
/**
|
|
56
|
+
* Cheap answer for the same coverage: whether every shift in the plan can be staffed. Allocation
|
|
57
|
+
* stops at the first shift that cannot be filled, so no per-shift detail is produced.
|
|
58
|
+
*/
|
|
59
|
+
planCoverageSummary(list: ObjectId, scope: PlanningScope, options: ShiftPlanningProjectOptions, coverageMode?: 'staffing' | 'matching'): Promise<ShiftPlanCoverageSummary>;
|
|
7
60
|
customerLookup: ({
|
|
8
61
|
$lookup: {
|
|
9
62
|
from: string;
|
|
@@ -11,7 +64,78 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
|
|
|
11
64
|
let: {
|
|
12
65
|
userid: string;
|
|
13
66
|
};
|
|
14
|
-
pipeline: {
|
|
67
|
+
pipeline: ({
|
|
68
|
+
$addFields: {
|
|
69
|
+
structureIds: {
|
|
70
|
+
$reduce: {
|
|
71
|
+
input: {
|
|
72
|
+
$objectToArray: string;
|
|
73
|
+
};
|
|
74
|
+
initialValue: never[];
|
|
75
|
+
in: {
|
|
76
|
+
$cond: {
|
|
77
|
+
if: {
|
|
78
|
+
$eq: (string | {
|
|
79
|
+
$substrCP: (string | number)[];
|
|
80
|
+
})[];
|
|
81
|
+
};
|
|
82
|
+
then: {
|
|
83
|
+
$concatArrays: (string | string[])[];
|
|
84
|
+
};
|
|
85
|
+
else: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
$lookup?: undefined;
|
|
92
|
+
$project?: undefined;
|
|
93
|
+
} | {
|
|
94
|
+
$lookup: {
|
|
95
|
+
from: string;
|
|
96
|
+
let: {
|
|
97
|
+
structureIds: string;
|
|
98
|
+
company: string;
|
|
99
|
+
project: string;
|
|
100
|
+
};
|
|
101
|
+
pipeline: ({
|
|
102
|
+
$match: {
|
|
103
|
+
$expr: {
|
|
104
|
+
$and: ({
|
|
105
|
+
$eq: (string | {
|
|
106
|
+
$type: string;
|
|
107
|
+
})[];
|
|
108
|
+
$in?: undefined;
|
|
109
|
+
} | {
|
|
110
|
+
$in: string[];
|
|
111
|
+
$eq?: undefined;
|
|
112
|
+
})[];
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
$project?: undefined;
|
|
116
|
+
} | {
|
|
117
|
+
$project: {
|
|
118
|
+
_id: number;
|
|
119
|
+
id: number;
|
|
120
|
+
type: number;
|
|
121
|
+
question: number;
|
|
122
|
+
description: number;
|
|
123
|
+
options: number;
|
|
124
|
+
multiple: number;
|
|
125
|
+
};
|
|
126
|
+
$match?: undefined;
|
|
127
|
+
})[];
|
|
128
|
+
as: string;
|
|
129
|
+
};
|
|
130
|
+
$addFields?: undefined;
|
|
131
|
+
$project?: undefined;
|
|
132
|
+
} | {
|
|
133
|
+
$project: {
|
|
134
|
+
structureIds: number;
|
|
135
|
+
};
|
|
136
|
+
$addFields?: undefined;
|
|
137
|
+
$lookup?: undefined;
|
|
138
|
+
} | {
|
|
15
139
|
$match: {
|
|
16
140
|
$and: {
|
|
17
141
|
$expr: {
|
|
@@ -19,7 +143,7 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
|
|
|
19
143
|
};
|
|
20
144
|
}[];
|
|
21
145
|
};
|
|
22
|
-
}[];
|
|
146
|
+
})[];
|
|
23
147
|
};
|
|
24
148
|
$unwind?: undefined;
|
|
25
149
|
$addFields?: undefined;
|
|
@@ -35,12 +159,46 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
|
|
|
35
159
|
} | {
|
|
36
160
|
$addFields: {
|
|
37
161
|
user: {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
162
|
+
$mergeObjects: ({
|
|
163
|
+
name: {
|
|
164
|
+
$concat: string[];
|
|
165
|
+
};
|
|
166
|
+
email: string;
|
|
167
|
+
id: string;
|
|
168
|
+
_id: string;
|
|
169
|
+
$arrayToObject?: undefined;
|
|
170
|
+
structures?: undefined;
|
|
171
|
+
} | {
|
|
172
|
+
$arrayToObject: {
|
|
173
|
+
$filter: {
|
|
174
|
+
input: {
|
|
175
|
+
$objectToArray: {
|
|
176
|
+
$ifNull: {}[];
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
as: string;
|
|
180
|
+
cond: {
|
|
181
|
+
$eq: (string | {
|
|
182
|
+
$substrCP: (string | number)[];
|
|
183
|
+
})[];
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
name?: undefined;
|
|
188
|
+
email?: undefined;
|
|
189
|
+
id?: undefined;
|
|
190
|
+
_id?: undefined;
|
|
191
|
+
structures?: undefined;
|
|
192
|
+
} | {
|
|
193
|
+
structures: {
|
|
194
|
+
$ifNull: (string | never[])[];
|
|
195
|
+
};
|
|
196
|
+
name?: undefined;
|
|
197
|
+
email?: undefined;
|
|
198
|
+
id?: undefined;
|
|
199
|
+
_id?: undefined;
|
|
200
|
+
$arrayToObject?: undefined;
|
|
201
|
+
})[];
|
|
44
202
|
};
|
|
45
203
|
};
|
|
46
204
|
$lookup?: undefined;
|
|
@@ -157,7 +315,7 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
|
|
|
157
315
|
* get state of the provided account for this list
|
|
158
316
|
*/
|
|
159
317
|
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<
|
|
318
|
+
updateAfterCheck(useful: boolean, explanation: string | undefined, partiticpantInternalId: ObjectId, listInternalId: ObjectId, options: Required<UserAppWithOptions>): Promise<UpdateResult<import("bson").Document>>;
|
|
161
319
|
private getValidatorForStructures;
|
|
162
320
|
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
321
|
/**
|
|
@@ -210,7 +368,8 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
|
|
|
210
368
|
* values are validated against the project's listsParticipants structures, no email is sent.
|
|
211
369
|
*/
|
|
212
370
|
membersStructures(list: ObjectId, account: string, structureInput: Record<string, string | boolean | number | string[]>, options: Required<UserAppWithOptions>): Promise<WithId<ListParticipants> | null>;
|
|
213
|
-
|
|
371
|
+
updateStructures(list: ObjectId, participationId: ObjectId, structures: Record<string, string | boolean | number | string[]>, options: Required<UserAppWithOptions>): Promise<UpdateResult>;
|
|
372
|
+
note(list: ObjectId, participationId: ObjectId, note: ListParticipants['note'] | undefined, options: Required<UserAppWithOptions>): Promise<UpdateResult<import("bson").Document>>;
|
|
214
373
|
participantInList(list: ObjectId, user: ObjectId, options: Required<UserAppWithOptions>): Promise<boolean>;
|
|
215
374
|
singleWithoutLookup(list: ObjectId, user: ObjectId, options: Required<UserAppWithOptions>): Promise<WithId<ListParticipants> | null>;
|
|
216
375
|
viaPayment(listId: ObjectId, paymentId: ObjectId, options: Required<UserAppWithOptions>): Promise<ListParticipantWithCustomerAndPayment>;
|
|
@@ -230,6 +389,15 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
|
|
|
230
389
|
data: HistoryWithType<ListParticipants>[];
|
|
231
390
|
count: number;
|
|
232
391
|
}>;
|
|
392
|
+
/** a history entry of this list and the version before it, with the structures that name the custom fields */
|
|
393
|
+
historyEntry(list: ObjectId, historyId: ObjectId, options: Required<UserAppWithOptions>): Promise<{
|
|
394
|
+
structures: WithId<Structure>[];
|
|
395
|
+
current: WithId<History>;
|
|
396
|
+
previous: WithId<History> | null;
|
|
397
|
+
} | null>;
|
|
398
|
+
private historySeenKey;
|
|
399
|
+
historyUnreadCount(list: ObjectId, options: Required<UserAppWithOptions>): Promise<number>;
|
|
400
|
+
markHistorySeen(list: ObjectId, options: Required<UserAppWithOptions>): Promise<ObjectId | null>;
|
|
233
401
|
agreementsMissing(listAgreements: Agreement[], providedAgreements: AgreementResponse[]): string[];
|
|
234
402
|
listParticipants(list: ObjectId, state: ListParticipants['state'][] | undefined, category: string[] | undefined, lastname: string | undefined, options: UserAppWithOptions & SkipLimitSort): Promise<{
|
|
235
403
|
all: number;
|