فهرست منبع

Зависимость NOMINATION заменена на FILE_NAME

Ryan Wright 4 ماه پیش
والد
کامیت
a8490b673e
3فایلهای تغییر یافته به همراه6 افزوده شده و 7 حذف شده
  1. 2 2
      package-lock.json
  2. 1 1
      package.json
  3. 3 4
      script.js

+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "jen-work-benefit-letters",
-  "version": "1.0.0",
+  "version": "1.1.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "jen-work-benefit-letters",
-      "version": "1.0.0",
+      "version": "1.1.0",
       "license": "ISC",
       "dependencies": {
         "csv-reader": "^1.0.12",

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jen-work-benefit-letters",
-  "version": "1.0.0",
+  "version": "1.1.0",
   "description": "",
   "main": "index.js",
   "scripts": {

+ 3 - 4
script.js

@@ -39,10 +39,9 @@ const pdfStream = new Transform({
     const buffer = doc.getZip().generate({
       type: "nodebuffer",
     });
-    const fileName = `${row.NOMINATION.replace(
-      "Изобразительное искусство",
-      "ИЗО"
-    ).replace("Декоративно-прикладное искусство", "ДПИ")} ${row.NAME}`;
+    const fileName = row.FILE_NAME;
+    if (!fileName)
+      throw new Error("В таблице обязательно должно быть поле FILE_NAME");
 
     fs.writeFileSync(
       path.resolve(__dirname, "docx", `${fileName}.docx`),