Docs: backfill JSDoc, utility docs, and CLAUDE.md API/schema sections
- Add JSDoc to paychecks.js helpers: buildVirtualPaychecks, generatePaychecks, fetchPaychecksForMonth - Add JSDoc to financing.js helpers: remainingPeriods, calcPaymentAmount, enrichPlan - Add JSDoc to validateBillFields (bills.js) and getAllConfig (config.js) - Add JSDoc to ThemeProvider and useTheme in ThemeContext.jsx - Add Database Schema reference table to CLAUDE.md - Add complete API Endpoints reference section to CLAUDE.md covering all routes Nightshift-Task: docs-backfill Nightshift-Ref: https://github.com/marcus/nightshift
This commit is contained in:
@@ -2,6 +2,20 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const { pool } = require('../db');
|
||||
|
||||
/**
|
||||
* Validate the request body for bill create/update operations.
|
||||
*
|
||||
* Checks that all required fields are present and within acceptable ranges.
|
||||
* Amount is optional when `variable_amount` is true (defaults to 0 on save).
|
||||
*
|
||||
* @param {object} body - Request body.
|
||||
* @param {string} body.name - Bill name (non-empty).
|
||||
* @param {number|string} [body.amount] - Bill amount; required when variable_amount is falsy.
|
||||
* @param {number|string} body.due_day - Day of month (1–31).
|
||||
* @param {number|string} body.assigned_paycheck - Which paycheck: 1 or 2.
|
||||
* @param {boolean} [body.variable_amount] - Whether the bill amount varies each month.
|
||||
* @returns {string|null} Validation error message, or null when valid.
|
||||
*/
|
||||
function validateBillFields(body) {
|
||||
const { name, amount, due_day, assigned_paycheck, variable_amount } = body;
|
||||
if (!name || name.toString().trim() === '') {
|
||||
|
||||
Reference in New Issue
Block a user