@lilaquadrat/studio 3.3.1 → 3.5.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/interfaces.d.ts +3 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/src/classes/errors/Agreements.error.d.ts +6 -0
- package/lib/src/classes/errors/Agreements.error.js +12 -0
- package/lib/src/classes/errors/Agreements.error.js.map +1 -0
- package/lib/src/interfaces/Agreement.interface.d.ts +5 -0
- package/lib/src/interfaces/Agreement.interface.js +3 -0
- package/lib/src/interfaces/Agreement.interface.js.map +1 -0
- package/lib/src/interfaces/AgreementResponse.interface.d.ts +4 -0
- package/lib/src/interfaces/AgreementResponse.interface.js +3 -0
- package/lib/src/interfaces/AgreementResponse.interface.js.map +1 -0
- package/lib/src/models/lists.model.d.ts +4 -1
- package/lib/src/models/lists.model.js +40 -8
- package/lib/src/models/lists.model.js.map +1 -1
- package/lib/src/models/listsParticipants.model.d.ts +3 -1
- package/lib/src/models/listsParticipants.model.js +20 -2
- package/lib/src/models/listsParticipants.model.js.map +1 -1
- package/lib/src/services/customers.service.js +6 -1
- package/lib/src/services/customers.service.js.map +1 -1
- package/lib/src/services/listParticipants.service.d.ts +13 -8
- package/lib/src/services/listParticipants.service.js +96 -35
- package/lib/src/services/listParticipants.service.js.map +1 -1
- package/lib/src/services/lists.service.js +8 -6
- package/lib/src/services/lists.service.js.map +1 -1
- package/package.json +1 -1
package/lib/interfaces.d.ts
CHANGED
|
@@ -64,5 +64,7 @@ import { CustomerCompany, CustomerPerson, Customers } from './src/models/custome
|
|
|
64
64
|
import { List, ListCategory } from './src/models/lists.model';
|
|
65
65
|
import SkipLimitSort from './src/interfaces/SkipLimitSort.interface';
|
|
66
66
|
import ListCustomQueries from './src/interfaces/ListCustomQueries.interface';
|
|
67
|
+
import Agreement from './src/interfaces/Agreement.interface';
|
|
67
68
|
import { ListParticipants } from './src/models/listsParticipants.model';
|
|
68
|
-
|
|
69
|
+
import AgreementResponse from './src/interfaces/AgreementResponse.interface';
|
|
70
|
+
export { BasicDataInterface, Scope, SingleScope, ScopeObjectWithAdmin, ScopeObject, HttpStatusCode, AppPermissions, DatabaseQuery, DatabaseQueryOptions, DatabaseQuerySites, HistoryReason, ListOfModels, ShareClientInterface, ShareClientOptions, Settings, Project, Me, History, HistoryWithType, Editor, EditorBase, Media, MediaInfo, MediaViewInfo, MediaStats, MediaContentFiles, VersionInfo, ProjectScope, CompanyScope, UniversalScope, Permissions, ModuleGeneric, Modelv2 as IModelv2, Company, CompanyAttribute, Partner, Contract, Action, Publish, PublishContentGroup, PublishMethod, PublishMethodFtp, PublishMethodWebhook, PublishMethodInternal, PublishMethodPdf, UniversalInterface, EditorLegacy, PublishResult, DataObject, CallResponse, Secret, Content, ContentWithPositions, StudioIframeMessage, EditorActiveModule, ChildData, Wildcardcertificates, HostingPorts, DesignModule, ModuleIndexOptions, AdditionalContentInformation, HostingCommand, Hosting, HostingWithSettings, Domain, DomainConf, Command, Options, CompanyProject, ApiResponses, UserApp, UserAppOptionsRequired, AppFilter, App, BaseFilterOptions, HostingSettings, AvailableStorageTypes, Tracker, TrackerInput, TrackerStatistics, TrackerStatisticsDay, TrackerData, TrackerCategories, MulterFile, RenderContext, Customers, CustomerCompany, CustomerPerson, List, ListCategory, SkipLimitSort, ListCustomQueries, ListParticipants, Agreement, AgreementResponse };
|
package/lib/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../interfaces.ts"],"names":[],"mappings":";;;;;;AASA,+FAAkE;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../interfaces.ts"],"names":[],"mappings":";;;;;;AASA,+FAAkE;AAqEhE,yBArEK,6BAAc,CAqEL;AA3DhB,sEAAyG;AAkFvG,6FAlFO,gCAAY,OAkFP;AADZ,6FAjFqB,gCAAY,OAiFrB;AAEZ,+FAnFgD,kCAAc,OAmFhD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ErrorObject } from 'ajv/dist/types';
|
|
2
|
+
export default class AgreementsError extends Error {
|
|
3
|
+
errors?: ErrorObject<string, Record<string, any>, unknown>[] | null;
|
|
4
|
+
params?: Record<string, unknown>;
|
|
5
|
+
constructor(message: string, errors?: ErrorObject<string, Record<string, any>, unknown>[] | null, params?: Record<string, unknown>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class AgreementsError extends Error {
|
|
4
|
+
constructor(message, errors, params) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = 'AgreementsError';
|
|
7
|
+
this.errors = errors;
|
|
8
|
+
this.params = params;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.default = AgreementsError;
|
|
12
|
+
//# sourceMappingURL=Agreements.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Agreements.error.js","sourceRoot":"","sources":["../../../../src/classes/errors/Agreements.error.ts"],"names":[],"mappings":";;AAEA,MAAqB,eAAgB,SAAQ,KAAK;IAMhD,YAAY,OAAe,EAAE,MAAmE,EAAE,MAAgC;QAEhI,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAEvB,CAAC;CAEF;AAfD,kCAeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Agreement.interface.js","sourceRoot":"","sources":["../../../src/interfaces/Agreement.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgreementResponse.interface.js","sourceRoot":"","sources":["../../../src/interfaces/AgreementResponse.interface.ts"],"names":[],"mappings":""}
|
|
@@ -2,9 +2,11 @@ import { ObjectId } from 'mongodb';
|
|
|
2
2
|
import BasicDataInterface from '../interfaces/BasicData.interface';
|
|
3
3
|
import Modelv2 from '../classes/modelv2.class';
|
|
4
4
|
import Price from '../interfaces/Price.interface';
|
|
5
|
+
import Agreement from '../interfaces/Agreement.interface';
|
|
5
6
|
export interface ListCategory {
|
|
6
7
|
name: string;
|
|
7
|
-
|
|
8
|
+
amount?: number;
|
|
9
|
+
available?: boolean;
|
|
8
10
|
price?: Price;
|
|
9
11
|
}
|
|
10
12
|
export interface List extends BasicDataInterface {
|
|
@@ -25,6 +27,7 @@ export interface List extends BasicDataInterface {
|
|
|
25
27
|
unique?: boolean;
|
|
26
28
|
};
|
|
27
29
|
state: 'open' | 'closed' | 'waiting';
|
|
30
|
+
agreements: Agreement[];
|
|
28
31
|
categories: ListCategory[];
|
|
29
32
|
}
|
|
30
33
|
declare const model: Modelv2<List>;
|
|
@@ -19,8 +19,8 @@ model.setSchema({
|
|
|
19
19
|
properties: {
|
|
20
20
|
company: { type: 'string' },
|
|
21
21
|
project: { type: 'string' },
|
|
22
|
-
name: { type: 'string' },
|
|
23
|
-
description: { type: 'string' },
|
|
22
|
+
name: { type: 'string', maxLength: 50 },
|
|
23
|
+
description: { type: 'string', maxLength: 500 },
|
|
24
24
|
mode: { enum: ['contact', 'content', 'reservation'] },
|
|
25
25
|
state: { enum: ['open', 'closed', 'waiting'] },
|
|
26
26
|
payment: { enum: ['optional', 'required', 'free'] },
|
|
@@ -41,7 +41,8 @@ model.setSchema({
|
|
|
41
41
|
type: 'object',
|
|
42
42
|
properties: {
|
|
43
43
|
name: { type: 'string' },
|
|
44
|
-
|
|
44
|
+
amount: { type: 'number' },
|
|
45
|
+
available: { type: 'boolean' },
|
|
45
46
|
price: {
|
|
46
47
|
type: 'object',
|
|
47
48
|
properties: {
|
|
@@ -49,7 +50,7 @@ model.setSchema({
|
|
|
49
50
|
currency: { type: 'string' },
|
|
50
51
|
tax: { type: 'number' },
|
|
51
52
|
},
|
|
52
|
-
required: [
|
|
53
|
+
required: [],
|
|
53
54
|
additionalProperties: false,
|
|
54
55
|
},
|
|
55
56
|
},
|
|
@@ -57,8 +58,23 @@ model.setSchema({
|
|
|
57
58
|
additionalProperties: false,
|
|
58
59
|
},
|
|
59
60
|
},
|
|
61
|
+
agreements: {
|
|
62
|
+
type: 'array',
|
|
63
|
+
minItems: 1,
|
|
64
|
+
maxItems: 10,
|
|
65
|
+
items: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
contentId: { type: 'string' },
|
|
69
|
+
text: { type: 'string', maxLength: 500 },
|
|
70
|
+
required: { type: 'boolean' },
|
|
71
|
+
},
|
|
72
|
+
required: ['contentId', 'text'],
|
|
73
|
+
additionalProperties: false,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
60
76
|
},
|
|
61
|
-
required: ['company', 'project', 'name', 'payment', 'mode', 'categories', 'state'],
|
|
77
|
+
required: ['company', 'project', 'name', 'payment', 'mode', 'categories', 'agreements', 'state'],
|
|
62
78
|
additionalProperties: false,
|
|
63
79
|
}, 'create');
|
|
64
80
|
model.setSchema({
|
|
@@ -89,7 +105,8 @@ model.setSchema({
|
|
|
89
105
|
type: 'object',
|
|
90
106
|
properties: {
|
|
91
107
|
name: { type: 'string' },
|
|
92
|
-
|
|
108
|
+
amount: { type: 'number' },
|
|
109
|
+
available: { type: 'boolean' },
|
|
93
110
|
price: {
|
|
94
111
|
type: 'object',
|
|
95
112
|
properties: {
|
|
@@ -97,7 +114,7 @@ model.setSchema({
|
|
|
97
114
|
currency: { type: 'string' },
|
|
98
115
|
tax: { type: 'number' },
|
|
99
116
|
},
|
|
100
|
-
required: [
|
|
117
|
+
required: [],
|
|
101
118
|
additionalProperties: false,
|
|
102
119
|
},
|
|
103
120
|
},
|
|
@@ -105,8 +122,23 @@ model.setSchema({
|
|
|
105
122
|
additionalProperties: false,
|
|
106
123
|
},
|
|
107
124
|
},
|
|
125
|
+
agreements: {
|
|
126
|
+
type: 'array',
|
|
127
|
+
minItems: 1,
|
|
128
|
+
maxItems: 10,
|
|
129
|
+
items: {
|
|
130
|
+
type: 'object',
|
|
131
|
+
properties: {
|
|
132
|
+
contentId: { type: 'string' },
|
|
133
|
+
text: { type: 'string', maxLength: 500 },
|
|
134
|
+
required: { type: 'boolean' },
|
|
135
|
+
},
|
|
136
|
+
required: ['contentId', 'text'],
|
|
137
|
+
additionalProperties: false,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
108
140
|
},
|
|
109
|
-
required: ['name', 'payment', 'mode', 'categories'],
|
|
141
|
+
required: ['name', 'payment', 'mode', 'categories', 'agreements'],
|
|
110
142
|
additionalProperties: false,
|
|
111
143
|
}, 'change');
|
|
112
144
|
exports.default = model;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lists.model.js","sourceRoot":"","sources":["../../../src/models/lists.model.ts"],"names":[],"mappings":";;;;;AAEA,6EAA+C;
|
|
1
|
+
{"version":3,"file":"lists.model.js","sourceRoot":"","sources":["../../../src/models/lists.model.ts"],"names":[],"mappings":";;;;;AAEA,6EAA+C;AA2C/C,MAAM,KAAK,GAAG,IAAI,uBAAO,CAAO,OAAO,EAAE,OAAO,CAAC,CAAC;AAElD,KAAK,CAAC,eAAe,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAEjE,KAAK,CAAC,QAAQ,CACZ;IACE,GAAG,EAAE;QACH,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,CAAC;KACR;IACD,IAAI,EAAE,sBAAsB;CAC7B,EACD,CAAC,CACF,CAAC;AAEF,KAAK,CAAC,SAAS,CACb;IACE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,IAAI,EAAE,E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,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE;oBACxC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;iBAC9B;gBACD,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;gBAC/B,oBAAoB,EAAE,KAAK;aAC5B;SACF;KACF;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC;IACjE,oBAAoB,EAAE,KAAK;CAC5B,EACD,QAAQ,CACT,CAAC;AAEF,kBAAe,KAAK,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ObjectId } from 'mongodb';
|
|
2
2
|
import BasicDataInterface from '../interfaces/BasicData.interface';
|
|
3
3
|
import Modelv2 from '../classes/modelv2.class';
|
|
4
|
+
import { AgreementResponse } from 'interfaces';
|
|
4
5
|
export interface ListParticipants extends BasicDataInterface {
|
|
5
6
|
_id?: ObjectId;
|
|
6
7
|
list: ObjectId;
|
|
7
8
|
company: string;
|
|
8
9
|
project: string;
|
|
9
10
|
user: ObjectId;
|
|
10
|
-
state: 'confirmed' | 'reserved' | 'waiting';
|
|
11
|
+
state: 'confirmed' | 'enlisted' | 'reserved' | 'waiting' | 'blocked' | 'finalized';
|
|
12
|
+
agreements: AgreementResponse[];
|
|
11
13
|
}
|
|
12
14
|
declare const model: Modelv2<ListParticipants>;
|
|
13
15
|
export default model;
|
|
@@ -21,10 +21,28 @@ model.setSchema({
|
|
|
21
21
|
user: { type: 'object' },
|
|
22
22
|
company: { type: 'string' },
|
|
23
23
|
project: { type: 'string' },
|
|
24
|
-
|
|
24
|
+
agreements: {
|
|
25
|
+
type: 'array',
|
|
26
|
+
items: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
id: { type: 'string' },
|
|
30
|
+
version: { type: 'number' }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
state: { enum: ['enlisted', 'confirmed', 'reserved', 'waiting', 'blocked', 'finalized'] },
|
|
25
35
|
},
|
|
26
|
-
required: ['list', 'user'],
|
|
36
|
+
required: ['list', 'user', 'agreements'],
|
|
27
37
|
additionalProperties: false,
|
|
28
38
|
}, 'create');
|
|
39
|
+
model.setSchema({
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
state: { enum: ['enlisted', 'confirmed', 'reserved', 'waiting', 'blocked', 'completed'] },
|
|
43
|
+
},
|
|
44
|
+
required: ['state'],
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
}, 'updateState');
|
|
29
47
|
exports.default = model;
|
|
30
48
|
//# sourceMappingURL=listsParticipants.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listsParticipants.model.js","sourceRoot":"","sources":["../../../src/models/listsParticipants.model.ts"],"names":[],"mappings":";;;;;AAEA,6EAA+C;
|
|
1
|
+
{"version":3,"file":"listsParticipants.model.js","sourceRoot":"","sources":["../../../src/models/listsParticipants.model.ts"],"names":[],"mappings":";;;;;AAEA,6EAA+C;AA0B/C,MAAM,KAAK,GAAG,IAAI,uBAAO,CAAmB,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AAEpF,KAAK,CAAC,eAAe,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAEjE,KAAK,CAAC,QAAQ,CACZ;IACE,GAAG,EAAE;QACH,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;KACX;IACD,IAAI,EAAE,sBAAsB;CAC7B,EACD,CAAC,CACF,CAAC;AAEF,KAAK,CAAC,SAAS,CACb;IACE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAC;oBACrB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAC;iBAC3B;aACF;SACF;QACD,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE;KAC1F;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC;IACxC,oBAAoB,EAAE,KAAK;CAC5B,EACD,QAAQ,CACT,CAAC;AAEF,KAAK,CAAC,SAAS,CACb;IACE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE;KAC1F;IACD,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,oBAAoB,EAAE,KAAK;CAC5B,EACD,aAAa,CACd,CAAC;AAEF,kBAAe,KAAK,CAAC"}
|
|
@@ -30,6 +30,11 @@ class CustomersService extends Immutable_class_1.default {
|
|
|
30
30
|
return this.immutable({ _id: internalId }, data, options.user, 'change', options.app, undefined, undefined, action);
|
|
31
31
|
}
|
|
32
32
|
async getOrCreateByEmail(email, data, options) {
|
|
33
|
+
var _a;
|
|
34
|
+
if (!(email === null || email === void 0 ? void 0 : email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)))
|
|
35
|
+
throw new Error('EMAIL_MISSING');
|
|
36
|
+
if (!((_a = data.name) === null || _a === void 0 ? void 0 : _a.length))
|
|
37
|
+
throw new Error('NAME_MISSING');
|
|
33
38
|
const customer = await this.getByEmail(email, options);
|
|
34
39
|
if (customer)
|
|
35
40
|
return customer;
|
|
@@ -39,7 +44,7 @@ class CustomersService extends Immutable_class_1.default {
|
|
|
39
44
|
return this.model.db.findOne({ _id: internalId, company: options.company, project: options.project });
|
|
40
45
|
}
|
|
41
46
|
getByEmail(email, options) {
|
|
42
|
-
return this.model.db.findOne({ email: email.trim().toLowerCase(), company: options.company, project: options.project }, { projection: { id: 1 } });
|
|
47
|
+
return this.model.db.findOne({ email: email === null || email === void 0 ? void 0 : email.trim().toLowerCase(), company: options.company, project: options.project }, { projection: { id: 1 } });
|
|
43
48
|
}
|
|
44
49
|
getTags(company, project, search) {
|
|
45
50
|
let cleanSearch = search.toLowerCase().trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.service.js","sourceRoot":"","sources":["../../../src/services/customers.service.ts"],"names":[],"mappings":";;;;;;AAGA,yEAA2C;AAC3C,gFAA8I;AAE9I,MAAa,gBAAiB,SAAQ,yBAA2C;IAAjF;;QAEE,UAAK,GAAG,yBAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"customers.service.js","sourceRoot":"","sources":["../../../src/services/customers.service.ts"],"names":[],"mappings":";;;;;;AAGA,yEAA2C;AAC3C,gFAA8I;AAE9I,MAAa,gBAAiB,SAAQ,yBAA2C;IAAjF;;QAEE,UAAK,GAAG,yBAAc,CAAC;IAsHzB,CAAC;IAlHC,cAAc,CAAC,IAAsC,EAAE,OAAqC;QAG1F,IAAI,MAAM,GAAqC,cAAc,CAAC;QAC9D,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE;YAE3B,MAAM,GAAG,eAAe,CAAC;SAE1B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAE/B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,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,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ import UserAppWithOptions from '../interfaces/UserAppWithOptions.interface';
|
|
|
3
3
|
import Immutable from '../Immutable.class';
|
|
4
4
|
import { ListParticipants } from '../models/listsParticipants.model';
|
|
5
5
|
import { HistoryReason } from '../interfaces/HistoryReason.interface';
|
|
6
|
-
import { CustomerPerson, HistoryWithType, SkipLimitSort } from '../../interfaces';
|
|
6
|
+
import { Agreement, AgreementResponse, CustomerPerson, HistoryWithType, SkipLimitSort } from '../../interfaces';
|
|
7
7
|
export declare class ListParticipantsService extends Immutable<ListParticipants> {
|
|
8
8
|
model: import("../classes/modelv2.class").default<ListParticipants>;
|
|
9
9
|
customerLookup: ({
|
|
@@ -42,6 +42,7 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
|
|
|
42
42
|
};
|
|
43
43
|
email: string;
|
|
44
44
|
id: string;
|
|
45
|
+
_id: string;
|
|
45
46
|
};
|
|
46
47
|
};
|
|
47
48
|
$lookup?: undefined;
|
|
@@ -55,23 +56,27 @@ export declare class ListParticipantsService extends Immutable<ListParticipants>
|
|
|
55
56
|
$unwind?: undefined;
|
|
56
57
|
$addFields?: undefined;
|
|
57
58
|
})[];
|
|
58
|
-
|
|
59
|
+
getCustomerLookup(search?: string): any;
|
|
60
|
+
single(list: ObjectId, internalId: ObjectId, options: Required<UserAppWithOptions>): Promise<ListParticipants>;
|
|
59
61
|
join(listInternalId: ObjectId, person: CustomerPerson & {
|
|
60
62
|
email: string;
|
|
61
|
-
}, options: Required<UserAppWithOptions>): Promise<import("../interfaces/CreateResult.interface").default<ListParticipants>>;
|
|
62
|
-
|
|
63
|
+
}, agreements: AgreementResponse[], options: Required<UserAppWithOptions>): Promise<import("../interfaces/CreateResult.interface").default<ListParticipants>>;
|
|
64
|
+
remove(list: ObjectId, participationId: ObjectId, options: Required<UserAppWithOptions>): Promise<import("mongodb").DeleteResult>;
|
|
65
|
+
state(list: ObjectId, participationId: ObjectId, state: ListParticipants['state'], options: Required<UserAppWithOptions>): Promise<import("mongodb").UpdateResult<ListParticipants>>;
|
|
63
66
|
participantInList(list: ObjectId, user: ObjectId, options: Required<UserAppWithOptions>): Promise<boolean>;
|
|
64
|
-
|
|
67
|
+
singleWithoutLookup(list: ObjectId, user: ObjectId, options: Required<UserAppWithOptions>): Promise<import("mongodb").WithId<ListParticipants> | null>;
|
|
68
|
+
addParticipant(list: ObjectId, user: ObjectId, agreements: AgreementResponse[], options: Required<UserAppWithOptions>): Promise<import("../interfaces/CreateResult.interface").default<ListParticipants>>;
|
|
65
69
|
removeParticipant(list: ObjectId, user: string, options: Required<UserAppWithOptions>): void;
|
|
66
70
|
listHistory(list: ObjectId, reason: HistoryReason | undefined, options: Required<UserAppWithOptions>): Promise<{
|
|
67
71
|
all: number;
|
|
68
72
|
data: HistoryWithType<ListParticipants>[];
|
|
69
73
|
count: number;
|
|
70
74
|
}>;
|
|
71
|
-
|
|
75
|
+
agreementsMissing(listAgreements: Agreement[], providedAgreements: AgreementResponse[]): string[];
|
|
76
|
+
listParticipants(list: ObjectId, state: ListParticipants['state'][] | undefined, lastname: string | undefined, options: UserAppWithOptions & SkipLimitSort): Promise<{
|
|
72
77
|
all: number;
|
|
73
|
-
data: ListParticipants[];
|
|
74
|
-
count: number;
|
|
78
|
+
data: ListParticipants[] | undefined;
|
|
79
|
+
count: number | undefined;
|
|
75
80
|
}>;
|
|
76
81
|
}
|
|
77
82
|
declare const _default: ListParticipantsService;
|
|
@@ -8,6 +8,8 @@ const Immutable_class_1 = __importDefault(require("../Immutable.class"));
|
|
|
8
8
|
const listsParticipants_model_1 = __importDefault(require("../models/listsParticipants.model"));
|
|
9
9
|
const services_1 = require("../../services");
|
|
10
10
|
const customers_service_1 = __importDefault(require("./customers.service"));
|
|
11
|
+
const hardCopy_1 = __importDefault(require("../helpers/hardCopy"));
|
|
12
|
+
const Agreements_error_1 = __importDefault(require("../classes/errors/Agreements.error"));
|
|
11
13
|
class ListParticipantsService extends Immutable_class_1.default {
|
|
12
14
|
constructor() {
|
|
13
15
|
super(...arguments);
|
|
@@ -40,7 +42,8 @@ class ListParticipantsService extends Immutable_class_1.default {
|
|
|
40
42
|
'user': {
|
|
41
43
|
name: { $concat: ['$userData.name', ', ', '$userData.prename'] },
|
|
42
44
|
email: "$userData.email",
|
|
43
|
-
id: "$userData.id"
|
|
45
|
+
id: "$userData.id",
|
|
46
|
+
_id: "$userData._id"
|
|
44
47
|
},
|
|
45
48
|
},
|
|
46
49
|
},
|
|
@@ -51,32 +54,77 @@ class ListParticipantsService extends Immutable_class_1.default {
|
|
|
51
54
|
}
|
|
52
55
|
];
|
|
53
56
|
}
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
getCustomerLookup(search) {
|
|
58
|
+
const lookup = (0, hardCopy_1.default)(this.customerLookup);
|
|
59
|
+
if (search) {
|
|
60
|
+
lookup[0].$lookup.pipeline[0].$match.$and.push({
|
|
61
|
+
$expr: {
|
|
62
|
+
$regexMatch: {
|
|
63
|
+
input: "$name",
|
|
64
|
+
regex: search,
|
|
65
|
+
options: "i"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
lookup[1].$unwind.preserveNullAndEmptyArrays = false;
|
|
70
|
+
}
|
|
71
|
+
return lookup;
|
|
56
72
|
}
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
single(list, internalId, options) {
|
|
74
|
+
let aggregation = [
|
|
75
|
+
{
|
|
76
|
+
$match: {
|
|
77
|
+
$and: [
|
|
78
|
+
{ $expr: { $eq: ['$company', options.company] } },
|
|
79
|
+
{ $expr: { $eq: ['$project', options.project] } },
|
|
80
|
+
{ $expr: { $eq: ['$list', list] } },
|
|
81
|
+
{ $expr: { $eq: ['$_id', internalId] } },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
...this.customerLookup
|
|
86
|
+
];
|
|
87
|
+
return this.model.db.aggregate(aggregation).toArray()
|
|
88
|
+
.then((data) => data[0] || undefined);
|
|
89
|
+
}
|
|
90
|
+
async join(listInternalId, person, agreements, options) {
|
|
91
|
+
var _a, _b;
|
|
59
92
|
const list = await services_1.ListsService.single(listInternalId, undefined, options);
|
|
60
93
|
if (!list)
|
|
61
94
|
throw new Error('LIST_NOT_FOUND');
|
|
95
|
+
if (!((_a = list.participants) === null || _a === void 0 ? void 0 : _a.available))
|
|
96
|
+
throw new Error('LIST_NO_SPOT_AVAILABLE');
|
|
97
|
+
const agreementsMissing = this.agreementsMissing(list.agreements, agreements);
|
|
98
|
+
if (agreementsMissing.length)
|
|
99
|
+
throw new Agreements_error_1.default('AGREEMENTS_MISSING', undefined, { required: agreementsMissing });
|
|
100
|
+
//TODO remove agreements form person data
|
|
62
101
|
const customerId = await customers_service_1.default.getOrCreateByEmail(person.email, person, options);
|
|
63
102
|
if (!customerId)
|
|
64
103
|
throw new Error('CUSTOMER_NOT_FOUND');
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
104
|
+
const participantInList = await this.singleWithoutLookup(listInternalId, customerId._id, options);
|
|
105
|
+
if (((_b = list.participants) === null || _b === void 0 ? void 0 : _b.unique) && participantInList) {
|
|
106
|
+
throw new Error('LIST_UNIQUE_CUSTOMER_CONFIRMED');
|
|
107
|
+
}
|
|
108
|
+
if ((participantInList === null || participantInList === void 0 ? void 0 : participantInList.state) === 'blocked') {
|
|
109
|
+
throw new Error('LIST_CANNOT_JOIN');
|
|
69
110
|
}
|
|
70
|
-
return this.addParticipant(listInternalId, customerId._id, options);
|
|
111
|
+
return this.addParticipant(listInternalId, customerId._id, agreements, options);
|
|
71
112
|
}
|
|
72
|
-
async
|
|
113
|
+
async remove(list, participationId, options) {
|
|
73
114
|
return this.delete(participationId, options.user, options.app);
|
|
74
115
|
}
|
|
116
|
+
async state(list, participationId, state, options) {
|
|
117
|
+
return this.immutable({ _id: participationId, list, company: options.company, project: options.project }, { state }, options.user, 'change', options.app, undefined, undefined, 'updateState');
|
|
118
|
+
}
|
|
75
119
|
async participantInList(list, user, options) {
|
|
76
120
|
return await this.model.db.countDocuments({ list, user, company: options.company, project: options.project }) > 0;
|
|
77
121
|
}
|
|
78
|
-
|
|
79
|
-
return this.
|
|
122
|
+
singleWithoutLookup(list, user, options) {
|
|
123
|
+
return this.model.db.findOne({ list, user, company: options.company, project: options.project });
|
|
124
|
+
}
|
|
125
|
+
addParticipant(list, user, agreements, options) {
|
|
126
|
+
console.log({ list: list, user, agreements, state: 'confirmed', company: options.company, project: options.project });
|
|
127
|
+
return this.create({ list: list, user, agreements, state: 'confirmed', company: options.company, project: options.project }, options.user, options.app);
|
|
80
128
|
}
|
|
81
129
|
removeParticipant(list, user, options) {
|
|
82
130
|
}
|
|
@@ -91,7 +139,19 @@ class ListParticipantsService extends Immutable_class_1.default {
|
|
|
91
139
|
];
|
|
92
140
|
return services_1.HistoryService.listCustomQuery(query);
|
|
93
141
|
}
|
|
94
|
-
|
|
142
|
+
agreementsMissing(listAgreements, providedAgreements) {
|
|
143
|
+
let missing = [];
|
|
144
|
+
const required = listAgreements.filter((single) => single.required);
|
|
145
|
+
required.push({ required: true, contentId: 'data-protection', text: '' });
|
|
146
|
+
required.forEach((single) => {
|
|
147
|
+
if (!(providedAgreements === null || providedAgreements === void 0 ? void 0 : providedAgreements.find((singleResponse) => singleResponse.id === single.contentId))) {
|
|
148
|
+
missing.push(single.contentId);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
return missing;
|
|
152
|
+
}
|
|
153
|
+
async listParticipants(list, state, lastname, options) {
|
|
154
|
+
var _a;
|
|
95
155
|
let aggregation = [
|
|
96
156
|
{
|
|
97
157
|
$match: {
|
|
@@ -105,37 +165,38 @@ class ListParticipantsService extends Immutable_class_1.default {
|
|
|
105
165
|
aggregation.push({
|
|
106
166
|
$sort: options.sort || { _id: -1 },
|
|
107
167
|
});
|
|
108
|
-
const countQuery = {
|
|
109
|
-
company: options.company,
|
|
110
|
-
};
|
|
111
168
|
if (options.project) {
|
|
112
|
-
countQuery.project = options.project;
|
|
113
169
|
aggregation[0].$match.$and.push({ $expr: { $eq: ['$project', options.project] } });
|
|
114
170
|
}
|
|
115
171
|
if (state) {
|
|
116
|
-
|
|
117
|
-
aggregation[0].$match.$and.push({ $expr: { $eq: ['$state', state] } });
|
|
172
|
+
aggregation[0].$match.$and.push({ $expr: { $in: ['$state', state] } });
|
|
118
173
|
}
|
|
174
|
+
else {
|
|
175
|
+
aggregation[0].$match.$and.push({ $expr: { $not: { $in: ['$state', ['blocked']] } } });
|
|
176
|
+
}
|
|
177
|
+
aggregation = [...aggregation, ...this.getCustomerLookup(lastname)];
|
|
119
178
|
aggregation.push({
|
|
120
|
-
$
|
|
179
|
+
$facet: {
|
|
180
|
+
all: [
|
|
181
|
+
{
|
|
182
|
+
$count: "all"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
data: [
|
|
186
|
+
{
|
|
187
|
+
$skip: options.skip // Your skip value here
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
$limit: options.limit // Your limit value here
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
121
194
|
}, {
|
|
122
|
-
$
|
|
195
|
+
$unwind: '$all'
|
|
123
196
|
});
|
|
124
|
-
// if (projection) {
|
|
125
|
-
// lookup.push({
|
|
126
|
-
// $project: {
|
|
127
|
-
// project: 1,
|
|
128
|
-
// id: 1,
|
|
129
|
-
// company: 1,
|
|
130
|
-
// history: 1,
|
|
131
|
-
// },
|
|
132
|
-
// });
|
|
133
|
-
// }
|
|
134
|
-
aggregation = [...aggregation, ...this.customerLookup];
|
|
135
|
-
const all = await this.model.db.countDocuments(countQuery);
|
|
136
197
|
const data = await this.model.db.aggregate(aggregation)
|
|
137
198
|
.toArray();
|
|
138
|
-
return { all, data, count: data.length };
|
|
199
|
+
return data[0] ? { all: data[0].all.all, data: data[0].data, count: (_a = data[0].data) === null || _a === void 0 ? void 0 : _a.length } : { all: 0, data: [], count: 0 };
|
|
139
200
|
}
|
|
140
201
|
}
|
|
141
202
|
exports.ListParticipantsService = ListParticipantsService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listParticipants.service.js","sourceRoot":"","sources":["../../../src/services/listParticipants.service.ts"],"names":[],"mappings":";;;;;;AAEA,yEAA2C;AAC3C,gGAA4F;AAC5F,6CAA8D;AAG9D,4EAAmD;
|
|
1
|
+
{"version":3,"file":"listParticipants.service.js","sourceRoot":"","sources":["../../../src/services/listParticipants.service.ts"],"names":[],"mappings":";;;;;;AAEA,yEAA2C;AAC3C,gGAA4F;AAC5F,6CAA8D;AAG9D,4EAAmD;AACnD,mEAA2C;AAC3C,0FAAiE;AAEjE,MAAa,uBAAwB,SAAQ,yBAA2B;IAAxE;;QAEE,UAAK,GAAG,iCAAqB,CAAC;QAE9B,mBAAc,GAAG;YACf;gBACE,OAAO,EAAE;oBACP,IAAI,EAAE,WAAW;oBACjB,EAAE,EAAE,UAAU;oBACd,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;oBACxB,QAAQ,EAAE;wBACR;4BACE,MAAM,EAAE;gCACN,IAAI,EAAE;oCACJ,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE;iCACzC;6BACF;yBACF;qBACF;iBACF;aACF;YACD;gBACE,OAAO,EAAE;oBACP,IAAI,EAAE,WAAW;oBACjB,0BAA0B,EAAE,IAAI;iBACjC;aACF;YACD;gBACE,UAAU,EAAE;oBACV,MAAM,EAAE;wBACN,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,gBAAgB,EAAE,IAAI,EAAE,mBAAmB,CAAC,EAAE;wBAChE,KAAK,EAAE,iBAAiB;wBACxB,EAAE,EAAE,cAAc;wBAClB,GAAG,EAAE,eAAe;qBACrB;iBACF;aACF;YACD;gBACE,QAAQ,EAAE;oBACR,UAAU,EAAE,CAAC;iBACd;aACF;SACF,CAAC;IAuNJ,CAAC;IArNC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MAAM,EAAE,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAC,CAAE;IAE7H,CAAC;CAEF;AAjQD,0DAiQC;AAED,kBAAe,IAAI,uBAAuB,EAAE,CAAC"}
|
|
@@ -36,6 +36,7 @@ class ListsService extends Immutable_class_1.default {
|
|
|
36
36
|
$eq: ["$list", "$$listId"],
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
|
+
{ $expr: { $not: { $in: ['$state', ['blocked']] } } }
|
|
39
40
|
],
|
|
40
41
|
},
|
|
41
42
|
},
|
|
@@ -62,10 +63,10 @@ class ListsService extends Immutable_class_1.default {
|
|
|
62
63
|
$addFields: {
|
|
63
64
|
"participants.available": {
|
|
64
65
|
$cond: {
|
|
65
|
-
if: "$participants.
|
|
66
|
+
if: "$participants.max",
|
|
66
67
|
then: {
|
|
67
68
|
$cond: {
|
|
68
|
-
if: { $subtract: ['$participants.
|
|
69
|
+
if: { $gt: [{ $subtract: ['$participants.max', '$participants.confirmed'] }, 0] },
|
|
69
70
|
then: true,
|
|
70
71
|
else: false
|
|
71
72
|
}
|
|
@@ -114,6 +115,7 @@ class ListsService extends Immutable_class_1.default {
|
|
|
114
115
|
$eq: ["$list", "$$listId"],
|
|
115
116
|
},
|
|
116
117
|
},
|
|
118
|
+
{ $expr: { $not: { $in: ['$state', ['blocked']] } } },
|
|
117
119
|
],
|
|
118
120
|
},
|
|
119
121
|
},
|
|
@@ -140,10 +142,10 @@ class ListsService extends Immutable_class_1.default {
|
|
|
140
142
|
$addFields: {
|
|
141
143
|
"participants.available": {
|
|
142
144
|
$cond: {
|
|
143
|
-
if: "$participants.
|
|
145
|
+
if: "$participants.max",
|
|
144
146
|
then: {
|
|
145
147
|
$cond: {
|
|
146
|
-
if: { $subtract: ['$participants.
|
|
148
|
+
if: { $subtract: ['$participants.max', '$participants.confirmed'] },
|
|
147
149
|
then: true,
|
|
148
150
|
else: false
|
|
149
151
|
}
|
|
@@ -224,10 +226,10 @@ class ListsService extends Immutable_class_1.default {
|
|
|
224
226
|
$addFields: {
|
|
225
227
|
"participants.available": {
|
|
226
228
|
$cond: {
|
|
227
|
-
if: "$participants.
|
|
229
|
+
if: "$participants.max",
|
|
228
230
|
then: {
|
|
229
231
|
$cond: {
|
|
230
|
-
if: { $subtract: ['$participants.
|
|
232
|
+
if: { $subtract: ['$participants.max', '$participants.confirmed'] },
|
|
231
233
|
then: true,
|
|
232
234
|
else: false
|
|
233
235
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lists.service.js","sourceRoot":"","sources":["../../../src/services/lists.service.ts"],"names":[],"mappings":";;;;;;AAEA,yEAA2C;AAC3C,wEAAyD;AAIzD,MAAa,YAAa,SAAQ,yBAAe;IAAjD;;QAEE,UAAK,GAAG,qBAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"lists.service.js","sourceRoot":"","sources":["../../../src/services/lists.service.ts"],"names":[],"mappings":";;;;;;AAEA,yEAA2C;AAC3C,wEAAyD;AAIzD,MAAa,YAAa,SAAQ,yBAAe;IAAjD;;QAEE,UAAK,GAAG,qBAAU,CAAC;IAmRrB,CAAC;IAjRC,MAAM,CAAC,UAAoB,EAAE,KAAgC,EAAE,OAAqC;QAElG,IAAI,KAAK,GAAiB,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAElG,IAAG,KAAK,EAAE;YACR,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;SACrB;QAED,MAAM,WAAW,GAAG;YAClB;gBACE,MAAM,EAAE,KAAK;aACd;YACD;gBACE,OAAO,EAAE;oBACP,IAAI,EAAE,kBAAkB;oBACxB,EAAE,EAAE,mBAAmB;oBACvB,GAAG,EAAE;wBACH,MAAM,EAAE,MAAM;qBACf;oBACD,QAAQ,EAAE;wBACR;4BACE,MAAM,EA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