edit getList w/out setupID
This commit is contained in:
11
README.md
11
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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
57
logic.txt
57
logic.txt
@@ -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
|
||||
@@ -1 +1 @@
|
||||
/* Tidak terpakai */
|
||||
/* Tidak terpakai */
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user