edit getList w/out setupID

This commit is contained in:
AlfandiMario
2024-11-12 14:44:41 +07:00
parent 0b04f76f9e
commit aa91585650
6 changed files with 14 additions and 71 deletions

View File

@@ -8,12 +8,17 @@ sample config file
], ],
"delay": 5, "delay": 5,
"row_per_batch": 50, "row_per_batch": 50,
"startDate": "2023-08-01", //yyyy-mm-dd "startDate": "2023-08-01", //yyyy-mm-dd tanggal data dicari dimulai
"endDate": "2024-12-30", //yyyy-mm-dd "endDate": "2024-12-30", //yyyy-mm-dd tanggal data dicari berakhir
"mcuID": "56" // number "mcuID": "56"
} }
``` ```
Install Dependencies
```bash
npm install
```
Build the source Build the source
```bash ```bash
npm run build npm run build

View File

@@ -1,11 +1,10 @@
{ {
"base_url": "https://devcpone.aplikasi.web.id/one-api/", "base_url": "https://cpone.aplikasi.web.id/one-api/",
"schedule": [ "schedule": [
"0 */2 6-20 * *" "0 */2 6-20 * *"
], ],
"delay": 5, "delay": 5,
"row_per_batch": 50, "row_per_batch": 50,
"startDate": "2023-08-01", "startDate": "2022-08-01",
"endDate": "2024-12-30", "endDate": "2024-12-30"
"mcuID": "56"
} }

View File

@@ -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

View File

@@ -6,15 +6,13 @@ import { NAME_SPACE } from "./server";
export const getListOutbox = async ( export const getListOutbox = async (
statusOutbox: string, statusOutbox: string,
startDate: string, startDate: string,
endDate: string, endDate: string
setupID: string
) => { ) => {
const url = config.base_url + "mockup/sendwa/sendwa/listoutbox"; const url = config.base_url + "mockup/sendwa/sendwa/listoutbox";
logging.info(NAME_SPACE, "\t INFO : " + url); logging.info(NAME_SPACE, "\t INFO : " + url);
logging.info(NAME_SPACE, "\t INFO Status Outbox: " + statusOutbox); logging.info(NAME_SPACE, "\t INFO Status Outbox: " + statusOutbox);
logging.info(NAME_SPACE, "\t INFO Start Date: " + startDate); logging.info(NAME_SPACE, "\t INFO Start Date: " + startDate);
logging.info(NAME_SPACE, "\t INFO End Date: " + endDate); logging.info(NAME_SPACE, "\t INFO End Date: " + endDate);
logging.info(NAME_SPACE, "\t INFO Setup id: " + setupID);
try { try {
const resp = await axios.post( const resp = await axios.post(
@@ -23,7 +21,6 @@ export const getListOutbox = async (
statusOutbox: statusOutbox, statusOutbox: statusOutbox,
startDate: startDate, startDate: startDate,
endDate: endDate, endDate: endDate,
setupID: setupID,
}, },
{ {
headers: { "Content-Type": "application/json; charset=UTF-8" }, headers: { "Content-Type": "application/json; charset=UTF-8" },

View File

@@ -185,9 +185,8 @@ async function getLists(status: string) {
// const statusOutbox = config.statusOutbox; // const statusOutbox = config.statusOutbox;
const startDate = config.startDate; const startDate = config.startDate;
const endDate = config.endDate; 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") { if (resp["status"] != "OK") {
logging.error(NAME_SPACE, "\t Error get outbox data", resp); logging.error(NAME_SPACE, "\t Error get outbox data", resp);
logging.error(NAME_SPACE, "\t Error: ", resp); logging.error(NAME_SPACE, "\t Error: ", resp);