cityssm/faster-web-helper

View on GitHub
modules/purchaseOrderApprovals/initializePurchaseOrderApprovalsModule.ts

Summary

Maintainability
A
0 mins
Test Coverage
import camelCase from 'camelcase'
import Debug from 'debug'

import { getConfigProperty } from '../../helpers/functions.config.js'
import type { ModuleInitializerOptions } from '../types.js'

import { initializePurchaseOrderApprovalsDatabase } from './database/databaseHelpers.js'
import router from './handlers/router.js'
import { moduleName } from './helpers/moduleHelpers.js'

const debug = Debug(`faster-web-helper:${camelCase(moduleName)}`)

const urlPrefix = getConfigProperty('webServer.urlPrefix')

export default function initializePurchaseOrderApprovalsModule(
  options: ModuleInitializerOptions
): void {
  debug(`Initializing "${moduleName}"...`)

  initializePurchaseOrderApprovalsDatabase()

  options.app.use(`${urlPrefix}/purchaseOrderApprovals`, router)

  debug(`"${moduleName}" initialized.`)
}