zudello-integration-sdk 1.0.19 → 1.0.20
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/package.json
CHANGED
|
@@ -1,63 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
class EmployeeModule {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Constructor.
|
|
6
|
+
* @param {class} parentModule Object of ZudelloV3 class.
|
|
7
|
+
*/
|
|
8
|
+
constructor(parentModule) {
|
|
9
|
+
this.module = parentModule;
|
|
10
|
+
|
|
11
|
+
this.staticFields = {
|
|
12
|
+
model: "Employee",
|
|
13
|
+
module: "RELATIONSHIPS",
|
|
14
|
+
submodule: "EMPLOYEE",
|
|
15
|
+
documentType: "EMPLOYEE",
|
|
16
|
+
enrich: false,
|
|
17
|
+
extractedEvent: false,
|
|
18
|
+
update: true,
|
|
19
|
+
create: true,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async fetch({ uuid, fetchDetails = true, simplified = true }) {
|
|
24
|
+
const validateIsEmpty = this.module.validator.isEmpty({ uuid });
|
|
25
|
+
|
|
26
|
+
if (!validateIsEmpty.valid) {
|
|
27
|
+
return this.module.responseHandler.error(validateIsEmpty.errors);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return await this.module.fetch({
|
|
31
|
+
model: this.staticFields.model,
|
|
32
|
+
uuid,
|
|
33
|
+
fetchDetails,
|
|
34
|
+
simplified,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async updateOrCreate({
|
|
39
|
+
data,
|
|
40
|
+
clearNulls = true,
|
|
41
|
+
simplified = false,
|
|
42
|
+
submit = false,
|
|
43
|
+
updateStatus = false,
|
|
44
|
+
}) {
|
|
45
|
+
const validateIsEmpty = this.module.validator.isEmpty({ data });
|
|
46
|
+
|
|
47
|
+
if (!validateIsEmpty.valid) {
|
|
48
|
+
return this.module.responseHandler.error(validateIsEmpty.errors);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.module.logger.log(`[UPDATE OR CREATE]: ZudelloV3 [model - ${this.staticFields.model}]`);
|
|
52
|
+
this.module.logger.log("[PAGE DATA]:");
|
|
53
|
+
this.module.logger.log(data);
|
|
54
|
+
|
|
55
|
+
data = this.module.mapUpdateOrCreateData({
|
|
56
|
+
data,
|
|
57
|
+
staticFields: this.staticFields,
|
|
58
|
+
submit,
|
|
59
|
+
updateStatus,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
this.module.logger.log("[MAPPED PAGE DATA]:");
|
|
63
|
+
this.module.logger.log(data);
|
|
64
|
+
|
|
65
|
+
return await this.module.updateOrCreate({ data, clearNulls, simplified });
|
|
66
|
+
}
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
module.exports = EmployeeModule
|
|
69
|
+
module.exports = EmployeeModule;
|