From aa91585650160b8f0e9a68307f91a0d4f611861f Mon Sep 17 00:00:00 2001 From: AlfandiMario Date: Tue, 12 Nov 2024 14:44:41 +0700 Subject: [PATCH] edit getList w/out setupID --- README.md | 11 +++++--- config-point-member.json | 7 +++-- logic.txt | 57 ---------------------------------------- source/interfaces.ts | 2 +- source/lib-inject.ts | 5 +--- source/server.ts | 3 +-- 6 files changed, 14 insertions(+), 71 deletions(-) delete mode 100644 logic.txt diff --git a/README.md b/README.md index 3eda0c0..92befbb 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,17 @@ sample config file ], "delay": 5, "row_per_batch": 50, - "startDate": "2023-08-01", //yyyy-mm-dd - "endDate": "2024-12-30", //yyyy-mm-dd - "mcuID": "56" // number + "startDate": "2023-08-01", //yyyy-mm-dd tanggal data dicari dimulai + "endDate": "2024-12-30", //yyyy-mm-dd tanggal data dicari berakhir + "mcuID": "56" } ``` +Install Dependencies +```bash +npm install +``` + Build the source ```bash npm run build diff --git a/config-point-member.json b/config-point-member.json index 35714ef..52c1f71 100644 --- a/config-point-member.json +++ b/config-point-member.json @@ -1,11 +1,10 @@ { - "base_url": "https://devcpone.aplikasi.web.id/one-api/", + "base_url": "https://cpone.aplikasi.web.id/one-api/", "schedule": [ "0 */2 6-20 * *" ], "delay": 5, "row_per_batch": 50, - "startDate": "2023-08-01", - "endDate": "2024-12-30", - "mcuID": "56" + "startDate": "2022-08-01", + "endDate": "2024-12-30" } \ No newline at end of file diff --git a/logic.txt b/logic.txt deleted file mode 100644 index debdfd1..0000000 --- a/logic.txt +++ /dev/null @@ -1,57 +0,0 @@ -main (status) - try{ - query getListOutboxs (status) - - if status == N - foreach outboxs as outbox - if outbox.fileUrl == null - resUp = uploadFile() - if resUp == OK - sentMsg() - else resUp eror - changeStatus dari N ke E - continue - else - sentMsg() - - else if status == E - foreach outboxs as outbox - if outbox.retry >= 5 - continue - else - retry++ - if outbox.fileUrl == null - resUp = uploadFile() - if resUp == OK - sentMsg() - else resUp eror - retry++ - changeStatus dari E ke R dan retry++ - else - sentMsg() - - else if status == R - foreach outboxs as outbox - if outbox.retry >= 5 - continue - else - retry++ - if outbox.fileUrl == null - resUp = uploadFile() - if resUp == OK - sentMsg() - else resUp eror - retry++ - changeStatus dari E ke R dan retry++ - else - sentMsg() - - } - - catch { - - } - - - - *sentMsg tidak usah diberi eror handling, info aja karena responnya tidak berpengaruh ke fungsi lain \ No newline at end of file diff --git a/source/interfaces.ts b/source/interfaces.ts index 2729915..6fd1a94 100644 --- a/source/interfaces.ts +++ b/source/interfaces.ts @@ -1 +1 @@ -/* Tidak terpakai */ \ No newline at end of file +/* Tidak terpakai */ diff --git a/source/lib-inject.ts b/source/lib-inject.ts index 778ed38..6344649 100644 --- a/source/lib-inject.ts +++ b/source/lib-inject.ts @@ -6,15 +6,13 @@ import { NAME_SPACE } from "./server"; export const getListOutbox = async ( statusOutbox: string, startDate: string, - endDate: string, - setupID: string + endDate: string ) => { const url = config.base_url + "mockup/sendwa/sendwa/listoutbox"; logging.info(NAME_SPACE, "\t INFO : " + url); logging.info(NAME_SPACE, "\t INFO Status Outbox: " + statusOutbox); logging.info(NAME_SPACE, "\t INFO Start Date: " + startDate); logging.info(NAME_SPACE, "\t INFO End Date: " + endDate); - logging.info(NAME_SPACE, "\t INFO Setup id: " + setupID); try { const resp = await axios.post( @@ -23,7 +21,6 @@ export const getListOutbox = async ( statusOutbox: statusOutbox, startDate: startDate, endDate: endDate, - setupID: setupID, }, { headers: { "Content-Type": "application/json; charset=UTF-8" }, diff --git a/source/server.ts b/source/server.ts index ac4783e..fa7810b 100644 --- a/source/server.ts +++ b/source/server.ts @@ -185,9 +185,8 @@ async function getLists(status: string) { // const statusOutbox = config.statusOutbox; const startDate = config.startDate; const endDate = config.endDate; - const setupID = config.mcuID; - var resp = await getListOutbox(statusOutbox, startDate, endDate, setupID); + var resp = await getListOutbox(statusOutbox, startDate, endDate); if (resp["status"] != "OK") { logging.error(NAME_SPACE, "\t Error get outbox data", resp); logging.error(NAME_SPACE, "\t Error: ", resp);