All files / src/endpoints nextMonth.ts

16.66% Statements 1/6
100% Branches 0/0
0% Functions 0/1
16.66% Lines 1/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                2x                    
import { Request, Response } from "express"
import pino from "pino"
 
import { LinkPaypalTransactionsJob } from "../queues/jobs/linkPaypalTransactions"
import { UpdateBillsBudgetLimitJob } from "../queues/jobs/updateBillsBudgetLimit"
import { UpdateLeftoverBudgetLimitJob } from "../queues/jobs/updateLeftoverBudgetLimit"
import { addJobToQueue } from "../queues/utils"
 
const logger = pino()
 
export async function nextMonth(_req: Request, res: Response) {
  logger.info("=================================== Next Month ===================================")
 
  await addJobToQueue(new UpdateLeftoverBudgetLimitJob(), { nextMonth: true }, true)
  await addJobToQueue(new UpdateBillsBudgetLimitJob(), { nextMonth: true }, true)
  await addJobToQueue(new LinkPaypalTransactionsJob(), {})
  res.send("<script>window.close()</script>")
}