@digione/node-custom-api 0.1.9-beta6 → 0.1.9-beta7

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": "@digione/node-custom-api",
3
- "version": "0.1.9-beta6",
3
+ "version": "0.1.9-beta7",
4
4
  "description": "Typescript node digione-api",
5
5
  "author": "Monchai Jirayupong <monchai.j@seven.co.th>",
6
6
  "license": "MIT",
package/utils/file.d.ts CHANGED
@@ -147,7 +147,7 @@ export declare class FileUtil {
147
147
  hidden?: number;
148
148
  input?: {};
149
149
  }): Promise<any>;
150
- createFileByPath(files: Array<string>, slug: string, user_id: any, { parent_slug, type, name, root, upload, tags, group }?: {
150
+ createFileByPath(files: Array<any>, slug: string, user_id: any, { parent_slug, type, name, root, upload, tags, group }?: {
151
151
  parent_slug?: string;
152
152
  type?: string;
153
153
  name?: any;
@@ -181,7 +181,8 @@ export declare class FileUtil {
181
181
  extension: string;
182
182
  type: any;
183
183
  is_hidden: any;
184
- tags: TagFile;
184
+ tags: any;
185
+ custom: any;
185
186
  group: any;
186
187
  }[]>;
187
188
  insertFileUnique(results: Array<any>, { format, thumb, width, height }?: {
package/utils/file.js CHANGED
@@ -470,8 +470,13 @@ class FileUtil {
470
470
  let folder = yield this.createFolder(slug, { parent_id, root, name });
471
471
  let results = [], reqs = [];
472
472
  files.forEach((item) => {
473
- results.push({ Location: item, Key: item });
474
- reqs.push({ originalname: (0, helper_1.getSlug)(32), mimetype: null, size: 0, type });
473
+ let addition = {}, path = item;
474
+ if (typeof item == "object") {
475
+ addition = item;
476
+ path = item['path'];
477
+ }
478
+ results.push({ Location: path, Key: path });
479
+ reqs.push(Object.assign({ originalname: (0, helper_1.getSlug)(32), mimetype: null, size: 0, type }, addition));
475
480
  });
476
481
  results = yield this.formatFile(folder['id'], user_id, reqs, results, { input, tags, group });
477
482
  return yield this.insertFileUnique(results);
@@ -579,9 +584,7 @@ class FileUtil {
579
584
  organ_id,
580
585
  organ_by,
581
586
  sort,
582
- date_added, name: reqs[key].originalname || (0, helper_1.getSlug)(32), filename: reqs[key].Key || file.Key || input['filename'], path, mimetype: reqs[key].mimetype, filesize: reqs[key].size, extension: (extension ? "." + extension : ''), type: reqs[key].type || file.type || input['type'], is_hidden,
583
- tags,
584
- group });
587
+ date_added, name: reqs[key].originalname || (0, helper_1.getSlug)(32), filename: reqs[key].Key || file.Key || input['filename'], path, mimetype: reqs[key].mimetype, filesize: reqs[key].size, extension: (extension ? "." + extension : ''), type: reqs[key].type || file.type || input['type'], is_hidden, tags: reqs[key].tags || tags, custom: reqs[key].custom || input['custom'], group });
585
588
  if (format) {
586
589
  item = yield this.afterQueryFile(item);
587
590
  }