merchi_sdk_js 0.5.3 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_js",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "src/merchi.js",
6
6
  "module": "src/merchi.js",
package/src/job.js CHANGED
@@ -29,6 +29,7 @@ import { Variation } from './variation.js';
29
29
  import { VariationsGroup } from './variations_group.js';
30
30
  import { Item } from './item.js';
31
31
  import { JobComment } from './job_comment.js';
32
+ import { JobNote } from './job_note.js';
32
33
  import { Reminder } from './reminder.js';
33
34
  import { InternalTag } from './internal_tag.js';
34
35
 
@@ -41,7 +42,7 @@ export function Job() {
41
42
  addPropertyTo(this, 'id');
42
43
  addPropertyTo(this, 'currency');
43
44
  addPropertyTo(this, 'quantity');
44
- addPropertyTo(this, 'notes');
45
+ addPropertyTo(this, 'jobNotes', JobNote);
45
46
  addPropertyTo(this, 'jobType');
46
47
  addPropertyTo(this, 'product', Product);
47
48
  addPropertyTo(this, 'supplyChainRequestProduct', Product);
@@ -106,7 +107,6 @@ export function Job() {
106
107
  addPropertyTo(this, 'limitedStock');
107
108
  addPropertyTo(this, 'canDeduct');
108
109
 
109
- addPropertyTo(this, 'productionNotes');
110
110
  addPropertyTo(this, "needsDrafting");
111
111
  addPropertyTo(this, "needsGroupBuy");
112
112
  addPropertyTo(this, "needsProduction");
@@ -0,0 +1,36 @@
1
+ import { generateUUID } from './uuid.js';
2
+ import { addPropertyTo, enumerateFiles, fromJson, create, serialise } from './model.js';
3
+ import { Job } from './job.js';
4
+ import { User } from './user.js';
5
+ import { MerchiFile } from './merchi_file.js';
6
+
7
+ export function JobNote() {
8
+ this.resource = '/job_notes';
9
+ this.json = 'jobNote';
10
+ this.temporaryId = generateUUID();
11
+
12
+ addPropertyTo(this, 'id');
13
+ addPropertyTo(this, 'job', Job);
14
+ addPropertyTo(this, 'createdBy', User);
15
+ addPropertyTo(this, 'lastEditedBy', User);
16
+ addPropertyTo(this, 'files', MerchiFile);
17
+ addPropertyTo(this, 'noteType');
18
+ addPropertyTo(this, 'richText');
19
+ addPropertyTo(this, 'creationDate');
20
+ addPropertyTo(this, 'lastEditedTime');
21
+
22
+ this.create = function (options) {
23
+ var data = serialise(this),
24
+ self = this;
25
+ function handleResponse(result) {
26
+ options.success(fromJson(self, result[self.json]));
27
+ }
28
+ create({resource: this.resource,
29
+ parameters: data[0],
30
+ files: enumerateFiles(data[1]),
31
+ success: handleResponse,
32
+ as_domain: options.as_domain,
33
+ error: options.error,
34
+ embed: options.embed});
35
+ };
36
+ }
package/src/merchi.js CHANGED
@@ -53,6 +53,7 @@ import { Notification, Notifications } from './notification.js';
53
53
  import { Invoice, Invoices } from './invoice.js';
54
54
  import { Job, Jobs } from './job.js';
55
55
  import { JobComment } from './job_comment.js';
56
+ import { JobNote } from './job_note.js';
56
57
  import { MerchiFile, MerchiFiles } from './merchi_file.js';
57
58
  import { Menu } from './menu.js';
58
59
  import { MenuItem } from './menu_item.js';
@@ -1065,6 +1066,7 @@ export function merchi(backendUri, websocketUri) {
1065
1066
  'Job': Job,
1066
1067
  'jobs': new Jobs(),
1067
1068
  'JobComment': JobComment,
1069
+ 'JobNote': JobNote,
1068
1070
  'Cart': Cart,
1069
1071
  'CartItem': CartItem,
1070
1072
  'Bank': Bank,