Fix MICR font path, date import, PDF button bug; clean up config; add TODO markers
- Hardcode GnuMICR.otf path in pdfService.js; remove MICR_FONT_PATH env var - Fix normalizeDate to handle MM/DD/YY (2-digit year) and return null on no match - Fix generatePdf button DOM bug: update span directly instead of overwriting textContent - Remove .env.example and NTFY_URL from docker-compose (app has no required config) - Remove redundant fonts volume mount from docker-compose (fonts bundled in image) - Mark MVP TODO items complete; add // TODO comments in source for post-MVP features - Update README: correct slot height, remove stale env var docs
This commit is contained in:
@@ -87,6 +87,12 @@ app.post('/api/account/setup', (req, res) => {
|
||||
res.status(201).json({ success: true });
|
||||
});
|
||||
|
||||
// TODO: Add multi-account support -- account switcher, per-account routing/logo/layout, account_id FK on checks and layout_fields
|
||||
|
||||
// TODO: Add basic auth or simple password gate for any network-exposed deployment
|
||||
|
||||
// TODO: Add deposit slip support -- deposits table, PDF generation, ledger, and slide-in entry form
|
||||
|
||||
// Account info endpoint (read-only for Phase 1)
|
||||
app.get('/api/account', (req, res) => {
|
||||
const db = require('./db/database');
|
||||
|
||||
@@ -4,6 +4,8 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const db = require('../db/database');
|
||||
|
||||
// TODO: Add ledger reporting -- date range filter, payee search, total amount display, CSV export
|
||||
|
||||
// GET /api/checks - list all checks, newest first
|
||||
router.get('/', (req, res) => {
|
||||
const { after, printed } = req.query;
|
||||
@@ -36,6 +38,8 @@ router.get('/:id', (req, res) => {
|
||||
res.json(check);
|
||||
});
|
||||
|
||||
// TODO: Add payee address book -- store and recall payee name + address lines, autocomplete on new check form
|
||||
|
||||
// POST /api/checks - create a new check
|
||||
router.post('/', (req, res) => {
|
||||
const { payee, amount, check_date, memo, note1, note2,
|
||||
|
||||
@@ -28,9 +28,7 @@ const MICR_Y_IN = SLOT_HEIGHT_IN - 0.267; // 0.267" from bottom of slot
|
||||
// MICR line format: transit symbol (⑆) and on-us symbol (⑈) in E-13B encoding.
|
||||
// The GnuMICR / micrenc font maps these to specific characters.
|
||||
// Standard MICR layout: [check#] ⑆[routing]⑆ [account#]⑈
|
||||
const MICR_FONT_PATH = process.env.MICR_FONT_PATH
|
||||
? path.resolve(process.env.MICR_FONT_PATH)
|
||||
: path.join(__dirname, '../../fonts/micrenc.ttf');
|
||||
const MICR_FONT_PATH = path.join(__dirname, '../../fonts/GnuMICR.otf');
|
||||
|
||||
// Amount in words conversion
|
||||
function amountToWords(amount) {
|
||||
@@ -121,9 +119,11 @@ function generateCheckPdf(account, checks, fields) {
|
||||
doc.on('end', () => resolve(Buffer.concat(buffers)));
|
||||
doc.on('error', reject);
|
||||
|
||||
// TODO: Add 1-up with stub layout -- render Stub-prefixed fields from layout_fields alongside the check body
|
||||
|
||||
// Separate layout fields into check body vs stub fields
|
||||
const bodyFields = fields.filter(f => !f.field_name.startsWith('Stub'));
|
||||
const stubFields = fields.filter(f => f.field_name.startsWith('Stub'));
|
||||
const stubFields = fields.filter(f => f.field_name.startsWith('Stub')); // eslint-disable-line no-unused-vars
|
||||
|
||||
// We always render 3 slots; empty slots get a blank placeholder
|
||||
for (let slot = 0; slot < 3; slot++) {
|
||||
@@ -261,6 +261,8 @@ function resolveFieldValue(fieldName, check, account) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add visual layout editor -- UI to nudge field X/Y positions and printer offset calibration (offset_left/right/up/down)
|
||||
|
||||
/**
|
||||
* Sets the PDFKit font based on a layout field's font properties.
|
||||
* Falls back to Helvetica if the stored font name is not a built-in.
|
||||
|
||||
Reference in New Issue
Block a user