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 20 21 22 23 24 | 2x | import { Request, Response } from "express"
import pino from "pino"
import DynamicConfig, { AConfig } from "../modules/config/dynamic"
const logger = pino()
export async function hideBudget(req: Request<{ budgetName: string }>, res: Response) {
const { budgetName } = req.params
logger.info("=================================== Hiding toggle budget ===================================")
const hiddenBudgets = await DynamicConfig.lrange(AConfig.HiddenBudgets, 0, -1)
const isBudgetHidden = hiddenBudgets.includes(budgetName)
if (isBudgetHidden) {
logger.info("Budget with name %s is already hidden, removing from hidden budgets", budgetName)
await DynamicConfig.lrem(AConfig.HiddenBudgets, 0, budgetName)
return res.status(202).send({})
} else {
logger.info("Budget with name %s is not hidden, adding to hidden budgets", budgetName)
await DynamicConfig.rpush(AConfig.HiddenBudgets, budgetName)
return res.status(201).send({})
}
}
|