@ironcode/vas-lib 1.0.2 → 1.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.
- package/cjs/lib/entity/vas-base.model.d.ts +8 -0
- package/cjs/lib/entity/vas-base.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-base.model.js +9 -0
- package/cjs/lib/entity/vas-base.model.js.map +1 -1
- package/cjs/lib/entity/vas-branch.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-branch.model.js.map +1 -1
- package/cjs/lib/entity/vas-contact.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-contact.model.js.map +1 -1
- package/cjs/lib/entity/vas-control-type.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-control-type.model.js +1 -2
- package/cjs/lib/entity/vas-control-type.model.js.map +1 -1
- package/cjs/lib/entity/vas-control.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-control.model.js +1 -1
- package/cjs/lib/entity/vas-control.model.js.map +1 -1
- package/cjs/lib/entity/vas-field.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-field.model.js +1 -2
- package/cjs/lib/entity/vas-field.model.js.map +1 -1
- package/cjs/lib/entity/vas-file.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-file.model.js +1 -2
- package/cjs/lib/entity/vas-file.model.js.map +1 -1
- package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form.model.js.map +1 -1
- package/cjs/lib/entity/vas-group.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-group.model.js +1 -2
- package/cjs/lib/entity/vas-group.model.js.map +1 -1
- package/cjs/lib/entity/vas-instruction-job-field.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-instruction-job-field.model.js.map +1 -1
- package/cjs/lib/entity/vas-instruction-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-instruction-job.model.js.map +1 -1
- package/cjs/lib/entity/vas-instruction-provider.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-instruction-provider.model.js.map +1 -1
- package/cjs/lib/entity/vas-instruction.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-instruction.model.js.map +1 -1
- package/cjs/lib/entity/vas-invitation.d.ts.map +1 -1
- package/cjs/lib/entity/vas-invitation.js.map +1 -1
- package/cjs/lib/entity/vas-job.model.d.ts +55 -66
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.js +91 -68
- package/cjs/lib/entity/vas-job.model.js.map +1 -1
- package/cjs/lib/entity/vas-membership.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-membership.model.js +1 -1
- package/cjs/lib/entity/vas-membership.model.js.map +1 -1
- package/cjs/lib/entity/vas-note.model.d.ts +1 -0
- package/cjs/lib/entity/vas-note.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-note.model.js +3 -0
- package/cjs/lib/entity/vas-note.model.js.map +1 -1
- package/cjs/lib/entity/vas-report-request.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-report-request.model.js +1 -4
- package/cjs/lib/entity/vas-report-request.model.js.map +1 -1
- package/cjs/lib/entity/vas-report.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-report.model.js.map +1 -1
- package/cjs/lib/entity/vas-user.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-user.model.js.map +1 -1
- package/esm2020/lib/entity/vas-base.model.mjs +18 -1
- package/esm2020/lib/entity/vas-branch.model.mjs +1 -1
- package/esm2020/lib/entity/vas-contact.model.mjs +1 -1
- package/esm2020/lib/entity/vas-control-type.model.mjs +2 -3
- package/esm2020/lib/entity/vas-control.model.mjs +2 -2
- package/esm2020/lib/entity/vas-field.model.mjs +2 -3
- package/esm2020/lib/entity/vas-file.model.mjs +2 -3
- package/esm2020/lib/entity/vas-form.model.mjs +1 -1
- package/esm2020/lib/entity/vas-group.model.mjs +2 -3
- package/esm2020/lib/entity/vas-instruction-job-field.model.mjs +1 -1
- package/esm2020/lib/entity/vas-instruction-job.model.mjs +1 -1
- package/esm2020/lib/entity/vas-instruction-provider.model.mjs +1 -1
- package/esm2020/lib/entity/vas-instruction.model.mjs +1 -1
- package/esm2020/lib/entity/vas-invitation.mjs +1 -1
- package/esm2020/lib/entity/vas-job.model.mjs +91 -69
- package/esm2020/lib/entity/vas-membership.model.mjs +2 -2
- package/esm2020/lib/entity/vas-note.model.mjs +10 -1
- package/esm2020/lib/entity/vas-report-request.model.mjs +2 -4
- package/esm2020/lib/entity/vas-report.model.mjs +1 -1
- package/esm2020/lib/entity/vas-user.model.mjs +1 -1
- package/fesm2015/ironcode-vas-lib.mjs +107 -75
- package/fesm2015/ironcode-vas-lib.mjs.map +1 -1
- package/fesm2020/ironcode-vas-lib.mjs +121 -75
- package/fesm2020/ironcode-vas-lib.mjs.map +1 -1
- package/lib/entity/vas-base.model.d.ts +8 -0
- package/lib/entity/vas-job.model.d.ts +55 -66
- package/lib/entity/vas-note.model.d.ts +1 -0
- package/package.json +1 -1
|
@@ -33,6 +33,21 @@ class VasBaseModel {
|
|
|
33
33
|
this.createdByName = createdByName;
|
|
34
34
|
this.modifiedByName = modifiedByName;
|
|
35
35
|
}
|
|
36
|
+
static fromDto(dto) {
|
|
37
|
+
return new VasBaseModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '');
|
|
38
|
+
}
|
|
39
|
+
static create(user, values = {}) {
|
|
40
|
+
return this.fromDto({
|
|
41
|
+
...values,
|
|
42
|
+
id: UUID.UUID(),
|
|
43
|
+
created: moment().toISOString(),
|
|
44
|
+
modified: moment().toISOString(),
|
|
45
|
+
createdBy: user.id,
|
|
46
|
+
createdByName: user.name,
|
|
47
|
+
modifiedBy: user.id,
|
|
48
|
+
modifiedByName: user.name
|
|
49
|
+
});
|
|
50
|
+
}
|
|
36
51
|
}
|
|
37
52
|
|
|
38
53
|
class VasUserModel extends VasBaseModel {
|
|
@@ -403,7 +418,7 @@ class VasControlTypeModel extends VasBaseModel {
|
|
|
403
418
|
static fromDto(dto) {
|
|
404
419
|
return new VasControlTypeModel(
|
|
405
420
|
// eslint-disable-next-line new-cap
|
|
406
|
-
dto.id ||
|
|
421
|
+
dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.name || '');
|
|
407
422
|
}
|
|
408
423
|
/**
|
|
409
424
|
* @return {VasControlTypeDto}
|
|
@@ -527,7 +542,7 @@ class VasControlModel extends VasAccountObjectModel {
|
|
|
527
542
|
};
|
|
528
543
|
return new VasControlModel(
|
|
529
544
|
// eslint-disable-next-line new-cap
|
|
530
|
-
dto.id ||
|
|
545
|
+
dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', handleControlType(dto.controlType), dto.group || '', dto.validators || [], dto.name || '', dto.title || '', dto.linkable || false, dto.sequence || 0, dto.description || '', dto.defaultValue || '', JSON.parse(dto.config || '{}'), dto.descriptionImage || '', dto.portalEnabled || false);
|
|
531
546
|
}
|
|
532
547
|
/**
|
|
533
548
|
* @param {string} value
|
|
@@ -631,7 +646,7 @@ class VasFieldModel extends VasJobDataModel {
|
|
|
631
646
|
* @return {VasFieldModel}
|
|
632
647
|
*/
|
|
633
648
|
static fromDto(fieldDto) {
|
|
634
|
-
return new VasFieldModel(fieldDto.id ||
|
|
649
|
+
return new VasFieldModel(fieldDto.id || '', fieldDto.created || '', fieldDto.serverCreated || '', fieldDto.createdBy || '', fieldDto.modified || '', fieldDto.serverModified || '', fieldDto.modifiedBy || '', fieldDto.createdByName || '', fieldDto.modifiedByName || '', fieldDto.account || '', fieldDto.job || '', fieldDto.control || '', fieldDto.fieldJobPointers || [], fieldDto.value || '', fieldDto.version || 0);
|
|
635
650
|
}
|
|
636
651
|
/**
|
|
637
652
|
* @return {VasFieldDto}
|
|
@@ -742,7 +757,7 @@ class VasFileModel extends VasJobDataModel {
|
|
|
742
757
|
}, '', '', '', '', '');
|
|
743
758
|
}
|
|
744
759
|
static fromDto(dto) {
|
|
745
|
-
return new VasFileModel(dto.id ||
|
|
760
|
+
return new VasFileModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job || '', dto.name || '', dto.fileSize || 0, dto.mimeType || '', dto.sequence || 0, VasFileModel.parseConfig(dto.config), dto.url || '', dto.controlPath || '', dto.message || '', dto.status || '', dto.uri || '');
|
|
746
761
|
}
|
|
747
762
|
static parseConfig(config = '') {
|
|
748
763
|
try {
|
|
@@ -862,7 +877,7 @@ class VasGroupModel extends VasBaseModel {
|
|
|
862
877
|
static fromDto(dto) {
|
|
863
878
|
return new VasGroupModel(
|
|
864
879
|
// eslint-disable-next-line new-cap
|
|
865
|
-
dto.id ||
|
|
880
|
+
dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.name || '', dto.title || '', dto.description || '', dto.sequence || 0, dto.includeInSummary || false, dto.forms || [], dto.visibilityControl || '', dto.visibleIfEquals || '', (dto.controls || [])
|
|
866
881
|
.filter(control => control.name.startsWith('fields.'))
|
|
867
882
|
.sort((a, b) => a.sequence - b.sequence)
|
|
868
883
|
.map(c => VasControlModel.fromDto(c)), dto.scoreWeight || 1);
|
|
@@ -1229,6 +1244,15 @@ class VasNoteModel extends VasJobDataModel {
|
|
|
1229
1244
|
sensitive: this.sensitive,
|
|
1230
1245
|
};
|
|
1231
1246
|
}
|
|
1247
|
+
toApiDto(options) {
|
|
1248
|
+
return {
|
|
1249
|
+
...super.toApiDto(options),
|
|
1250
|
+
content: this.content,
|
|
1251
|
+
sensitive: this.sensitive,
|
|
1252
|
+
created: this.created,
|
|
1253
|
+
modified: this.modified
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1232
1256
|
}
|
|
1233
1257
|
|
|
1234
1258
|
/**
|
|
@@ -1651,8 +1675,7 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1651
1675
|
.filter(prop => !nativeProps.includes(prop));
|
|
1652
1676
|
}
|
|
1653
1677
|
/**
|
|
1654
|
-
* Returns
|
|
1655
|
-
* the type
|
|
1678
|
+
* Returns the list of properties of the Job type
|
|
1656
1679
|
*/
|
|
1657
1680
|
get staticProperties() {
|
|
1658
1681
|
return Object.getOwnPropertyNames(VasJobModel.empty());
|
|
@@ -1672,6 +1695,27 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1672
1695
|
.forEach((key) => model.$this[key] = dto[key]);
|
|
1673
1696
|
return model;
|
|
1674
1697
|
}
|
|
1698
|
+
/**
|
|
1699
|
+
* This method will instantiate a new JobModel. The difference with this
|
|
1700
|
+
* method of instantiation is that we are coming from a relation frame i.e.
|
|
1701
|
+
* the job has a list of {@link VasFieldDto} instead of a Job document.
|
|
1702
|
+
*
|
|
1703
|
+
*/
|
|
1704
|
+
static fromRelational(dto, form) {
|
|
1705
|
+
const model = new VasJobModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.reference || '', dto.jobDate || '', dto.jobStatus || '', dto.jobType || '', dto.assigneeId || '', dto.formId || '', dto.timeZoneOffset || moment$1().utcOffset(), dto.pendingFields || 0, dto.childModified || '', dto.version || 0, dto.fields || [], dto.files || [], dto.createdByDisplayName || '', dto.modifiedByDisplayName || '', dto.geoLocation || getEmptyGeoLocation());
|
|
1706
|
+
form.groups
|
|
1707
|
+
.forEach(group => {
|
|
1708
|
+
group.controls
|
|
1709
|
+
.forEach(control => {
|
|
1710
|
+
const field = dto.fields?.find(f => f.control === control.id);
|
|
1711
|
+
if (!field) {
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
model.getGroup(group.name)[control.name] = field.value;
|
|
1715
|
+
});
|
|
1716
|
+
});
|
|
1717
|
+
return model;
|
|
1718
|
+
}
|
|
1675
1719
|
/**
|
|
1676
1720
|
* @param {VasFormModel} formModel
|
|
1677
1721
|
* @return {Record<string, VasFieldDtoValue>}
|
|
@@ -1752,18 +1796,63 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1752
1796
|
};
|
|
1753
1797
|
}
|
|
1754
1798
|
/**
|
|
1755
|
-
* This method will
|
|
1756
|
-
*
|
|
1757
|
-
*
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1799
|
+
* This method will return the dynamic property from the JobModel that
|
|
1800
|
+
* represent a group (from a form).
|
|
1801
|
+
*
|
|
1802
|
+
* @param name the name of the group
|
|
1803
|
+
* @param init if true (default) and group is not found, initialise an empty
|
|
1804
|
+
* group, otherwise throw an error
|
|
1805
|
+
*/
|
|
1806
|
+
getGroup(name, init = true) {
|
|
1807
|
+
let prop;
|
|
1808
|
+
if (this.staticProperties.includes(name)) {
|
|
1809
|
+
throw Error(`invalid group name ${name}, not a dynamic property`);
|
|
1810
|
+
}
|
|
1811
|
+
else if (this.$this[name] === undefined) {
|
|
1812
|
+
if (init) {
|
|
1813
|
+
prop = this.$this[name] = {};
|
|
1814
|
+
}
|
|
1815
|
+
else {
|
|
1816
|
+
throw Error(`invalid group name ${name}, not found`);
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
else {
|
|
1820
|
+
prop = this.$this[name];
|
|
1821
|
+
if (typeof prop !== 'object') {
|
|
1822
|
+
throw Error(`invalid group name ${name}, not an object`);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
return prop;
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* @param path path segments
|
|
1829
|
+
*/
|
|
1830
|
+
getValueByPath(path = []) {
|
|
1831
|
+
return getValueByPath(path, this.$this);
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* In order to understand why we need this method it is important to
|
|
1835
|
+
* understand that within the system, Jobs can be represented in one of two
|
|
1836
|
+
* ways, document and relational.
|
|
1837
|
+
*
|
|
1838
|
+
* The important distinction is how values submitted by a form are stored.
|
|
1839
|
+
*
|
|
1840
|
+
* Jobs stored as documents (JSON objects) will store user values, as dynamic
|
|
1841
|
+
* properties of the document.
|
|
1842
|
+
*
|
|
1843
|
+
* Whereas, Jobs stored as relational, will store user values in an array of
|
|
1844
|
+
* {@link VasFieldDto} objects.
|
|
1845
|
+
*
|
|
1846
|
+
* Depending on where we are in the system, either one of these approaches can
|
|
1847
|
+
* be more useful than the other.
|
|
1848
|
+
*
|
|
1849
|
+
* This method, assumes that the JobModel has been instantiated from a
|
|
1850
|
+
* document representation, and serves to hydrate the fields array. In order
|
|
1851
|
+
* to achieve this, knowledge of the {@link VasFormDto} that created the job
|
|
1852
|
+
* is required.
|
|
1853
|
+
*
|
|
1854
|
+
*
|
|
1855
|
+
* Job in document representation
|
|
1767
1856
|
* {
|
|
1768
1857
|
* id: <guid>,
|
|
1769
1858
|
* reference: "something"
|
|
@@ -1773,7 +1862,7 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1773
1862
|
* }
|
|
1774
1863
|
* }
|
|
1775
1864
|
*
|
|
1776
|
-
*
|
|
1865
|
+
* Job in relational representation
|
|
1777
1866
|
* {
|
|
1778
1867
|
* id: <guid>,
|
|
1779
1868
|
* reference: "something"
|
|
@@ -1788,46 +1877,11 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1788
1877
|
* ]
|
|
1789
1878
|
* }
|
|
1790
1879
|
*
|
|
1791
|
-
* So, what this method does is given a JobModel in the form of A, read all
|
|
1792
|
-
* of those dynamic properties and set them into `fields`. Doing this requires
|
|
1793
|
-
* knowledge of the Form that was used to create the job. Moreover, since the
|
|
1794
|
-
* dynamic properties do not contain the ids of the fields, we also allow to
|
|
1795
|
-
* pass in a `controlFieldIdMap`. This map stores the mapping between Control
|
|
1796
|
-
* and the Field that was created in the Job to store the value for that
|
|
1797
|
-
* Control. This is useful, if for example you want to compare a Job in form A
|
|
1798
|
-
* with a Job in form B, for example if you want to update the Job on the API
|
|
1799
|
-
* with a Job that was saved by a client in form A.
|
|
1800
1880
|
*
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
1804
|
-
*
|
|
1805
|
-
* Firestore -> Function: A function is triggered to sync the job to the API
|
|
1806
|
-
* Function -> API: Function checks if job already exists, it receives 404
|
|
1807
|
-
* Function -> Function: The function calls `hydrateFields(...)`
|
|
1808
|
-
* Function -> API: The function POST the Job to /jobs
|
|
1809
|
-
* Function -> API: The function POST each field to /fields
|
|
1810
|
-
*
|
|
1811
|
-
* Similarly, if the user updates the job
|
|
1812
|
-
* Client -> API: client requests form
|
|
1813
|
-
* User -> Client: user fills in the form and submits an update
|
|
1814
|
-
* Client -> Firestore: client saves the Job in form A i.e. dynamic props
|
|
1815
|
-
* Firestore -> Function: A function is triggered to sync the job to the API
|
|
1816
|
-
* Function -> API: Function checks if job already exists, it receives 200
|
|
1817
|
-
* Function -> Function: The function calls `hydrateFields(...)` passing in
|
|
1818
|
-
* the map is made by iterating over the fields it
|
|
1819
|
-
* received from the API and storing the mappings
|
|
1820
|
-
* between controlId and fieldId for each field
|
|
1821
|
-
* Function -> API: The function PATCH the Job to /jobs
|
|
1822
|
-
* Function -> API: The function POST/PATCH each field to /fields
|
|
1823
|
-
* treated as new
|
|
1824
|
-
*
|
|
1825
|
-
* @param {VasFormModel} formModel the VasFormModel that was used to create
|
|
1826
|
-
* the job
|
|
1827
|
-
* @param {Map<string, string>} controlFieldIdMap a mapping of control to
|
|
1828
|
-
* field ids. This is used to determine whether a new id for the field should
|
|
1829
|
-
* be generated, or to reuse an existing one from the map.
|
|
1830
|
-
* @param {Array<string>} controlNames if a value is provided, it will be used
|
|
1881
|
+
* @param formModel the VasFormModel that was used to create the job
|
|
1882
|
+
* @param controlFieldIdMap This is used to determine the id each field.
|
|
1883
|
+
* Either one will be found in the map, or a new one is generated.
|
|
1884
|
+
* @param controlNames if a value is provided, it will be used
|
|
1831
1885
|
* to filter the fields that are returned.
|
|
1832
1886
|
* @return {Array<VasFieldDto>}
|
|
1833
1887
|
*/
|
|
@@ -1859,13 +1913,6 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1859
1913
|
});
|
|
1860
1914
|
this.fields = fields;
|
|
1861
1915
|
}
|
|
1862
|
-
/**
|
|
1863
|
-
* @param {string[]} path path segments
|
|
1864
|
-
* @return {void}
|
|
1865
|
-
*/
|
|
1866
|
-
getValueByPath(path = []) {
|
|
1867
|
-
return getValueByPath(path, this.$this);
|
|
1868
|
-
}
|
|
1869
1916
|
/**
|
|
1870
1917
|
* A very non sophisticated way to set values in the job via paths
|
|
1871
1918
|
*
|
|
@@ -1880,8 +1927,8 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1880
1927
|
* }
|
|
1881
1928
|
* }
|
|
1882
1929
|
*
|
|
1883
|
-
* @param
|
|
1884
|
-
* @param
|
|
1930
|
+
* @param value the value to set
|
|
1931
|
+
* @param path path segments
|
|
1885
1932
|
*/
|
|
1886
1933
|
setValueByPath(value, path = []) {
|
|
1887
1934
|
switch (path.length) {
|
|
@@ -1908,9 +1955,8 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1908
1955
|
}
|
|
1909
1956
|
}
|
|
1910
1957
|
/**
|
|
1911
|
-
* @param
|
|
1958
|
+
* @param staticOnly if true, will only output values for the static
|
|
1912
1959
|
* properties in the dto
|
|
1913
|
-
* @return {VasJobDto}
|
|
1914
1960
|
*/
|
|
1915
1961
|
toDto(staticOnly = false) {
|
|
1916
1962
|
if (staticOnly) {
|
|
@@ -1945,7 +1991,7 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1945
1991
|
}
|
|
1946
1992
|
const dto = {};
|
|
1947
1993
|
[...this.staticProperties, ...this.dynamicProperties]
|
|
1948
|
-
.forEach(prop =>
|
|
1994
|
+
.forEach(prop => dto[prop] = this.$this[prop]);
|
|
1949
1995
|
return dto;
|
|
1950
1996
|
}
|
|
1951
1997
|
/**
|
|
@@ -1972,7 +2018,7 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1972
2018
|
*
|
|
1973
2019
|
* @param {string} value a string with the syntax
|
|
1974
2020
|
* @param {ParseSyntaxOptions} options
|
|
1975
|
-
* @return
|
|
2021
|
+
* @return the results of parsing the syntax on this job
|
|
1976
2022
|
*/
|
|
1977
2023
|
parseSyntax(value, options = {
|
|
1978
2024
|
timeZoneOffset: 0
|
|
@@ -2006,7 +2052,7 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
2006
2052
|
result = (this.getValueByPath(path) || '').toString();
|
|
2007
2053
|
}
|
|
2008
2054
|
else if (objectKey === 'fields') {
|
|
2009
|
-
result = (getValueByPath(path, this.getFields2()) || '').toString();
|
|
2055
|
+
result = (getValueByPath(['fields.' + path.shift(), ...path], this.getFields2()) || '').toString();
|
|
2010
2056
|
}
|
|
2011
2057
|
else if (objectKey.length) {
|
|
2012
2058
|
if (options.objects) {
|
|
@@ -2096,7 +2142,7 @@ class VasMembershipModel extends VasAccountObjectModel {
|
|
|
2096
2142
|
static fromDto(dto) {
|
|
2097
2143
|
return new VasMembershipModel(
|
|
2098
2144
|
// eslint-disable-next-line new-cap
|
|
2099
|
-
dto.id ||
|
|
2145
|
+
dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.user || '', dto.admin || false, dto.lookupTypes || [], dto.contactTypes || [], dto.accessGroups || [], dto.jobStatuses || [], dto.jobTypes || [], dto.taskTypes || []);
|
|
2100
2146
|
}
|
|
2101
2147
|
toDto() {
|
|
2102
2148
|
return {
|
|
@@ -2163,7 +2209,7 @@ class VasReportRequestModel extends VasAccountObjectModel {
|
|
|
2163
2209
|
this.reportId = reportId;
|
|
2164
2210
|
}
|
|
2165
2211
|
static fromDto(dto) {
|
|
2166
|
-
return new VasReportRequestModel(dto.id ||
|
|
2212
|
+
return new VasReportRequestModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.error || '', dto.jobId || '', dto.title || '', dto.url || '', dto.reportId || '');
|
|
2167
2213
|
}
|
|
2168
2214
|
toDto() {
|
|
2169
2215
|
return {
|