-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_cron.js
More file actions
46 lines (38 loc) · 1.16 KB
/
Copy pathpatch_cron.js
File metadata and controls
46 lines (38 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const fs = require('fs');
let file = fs.readFileSync('backend/payoutReminder.js', 'utf8');
// Update table name
file = file.replace(
/supabase\.from\('payout_schedule'\)\.select/,
"supabase.from('payout_schedules').select"
);
// Update status check
file = file.replace(
/\.in\('status', \['Scheduled', 'Early Payment Requested'\]\)/,
".in('status', ['Scheduled', 'Pending Finance', 'Renegotiated'])"
);
// Update early payment property
file = file.replace(
/payout\.early_payment_accepted_at/,
"payout.status === 'Renegotiated'"
);
// Update payout_amount -> base_amount
file = file.replace(
/payout\.payout_amount/g,
"(payout.final_amount || payout.base_amount)"
);
// Update invoice_number -> id or title
file = file.replace(
/payout\.invoice_number/g,
"(payout.title || payout.id)"
);
// Update due_date -> start_date
file = file.replace(
/payout\.due_date/g,
"payout.start_date"
);
// Update early_payment_amount || payout.payout_amount
file = file.replace(
/payout\.early_payment_amount \|\| payout\.payout_amount/g,
"(payout.final_amount || payout.base_amount)"
);
fs.writeFileSync('backend/payoutReminder.js', file);