All files / src/features/transactions labels.ts

100% Statements 15/15
100% Branches 3/3
100% Functions 12/12
100% Lines 15/15

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 25 26 27 28 29          11x 7x 2x 131x 89x 88x 124x 88x       11x 104x 133x 109x 129x         30x 30x    
// Names for entry categories in the user's language.
import { m } from '#/paraglide/messages.js'
import type { TransactionCategory } from '#/server/db/schema'
import type { SummaryRow } from './categories'
 
export const categoryLabel: Record<TransactionCategory, () => string> = {
  tenant_water_charge: () => m.transactions_category_tenant_water_charge(),
  other_income: () => m.transactions_category_other_income(),
  annual_repair: () => m.transactions_category_annual_repair(),
  improvement: () => m.transactions_category_improvement(),
  water_charge: () => m.transactions_category_water_charge(),
  insurance: () => m.transactions_category_insurance(),
  other_expense: () => m.transactions_category_other_expense(),
}
 
/** Form 7H rows, as the form names them. */
export const summaryRowLabel: Record<SummaryRow, () => string> = {
  gross_rent: () => m.transactions_row_gross_rent(),
  maintenance_and_water: () => m.transactions_row_maintenance_and_water(),
  annual_repairs: () => m.transactions_row_annual_repairs(),
  other_costs: () => m.transactions_row_other_costs(),
}
 
/** The receipt's address; `download` sends it as an attachment. */
export function receiptUrl(receiptId: string, download = false) {
  const path = `/api/receipts/${encodeURIComponent(receiptId)}`
  return download ? `${path}?download=1` : path
}