feat: 2025-11-21 improvements #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "2025-11-21-improvements"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
backend/internal/server/invoices.go— rows.Scan uses concrete types (string,float64) which will panic or error if DB returns NULLs or different types. Please usesql.NullString/sql.NullFloat64(or validate/COALESCE in SQL) and map them to the response struct, e.g. handle NULLSales ReporTran Subtotalvalues. Also confirm the actual DB column types for"Sales Rep"and"Tran Subtotal"and adjust scanning types accordingly.backend/internal/database/database.go— The connection strings now includeencrypt=%s. For SQL Server older versions, allowed values aredisable,true,false. EnsureDB_ENCRYPTenv var is validated/limited to these values. Suggest adding validation inconfig.Load()to return an error if an invalid value is supplied (to avoid runtime connection errors).Changes Requested
DB_ENCRYPTinconfig.Load()to ensure it is one of"disable","true", or"false"(fail fast with a clear error).backend/internal/server/invoices.goandbackend/internal/server/employees.go(usesql.NullString,sql.NullFloat64or COALESCE in SQL).Employeesfilter change fromDateReleased IS NULLtoinactive = 0is intentional and consistent with Aptora schema.Summary of Changes
DB_ENCRYPTenvironment variable to/.env.exampleand integrated it into the configuration and DB connection string..gitignoreto ignore.env.*files but keep.env.exampletracked.DBEncryptsetting fromconfigthroughmaininto thedatabasemanager and includedencrypt=%sin SQL Server connection strings.handleEmployeesandhandleInvoicesout ofserver.gointo separate handler files and refactored invoice handling to use theaptCDV_VW_APT_InvSalCredEstListview with new column names and pagination/limit checks.InvoicesPage.tsxto usenumber/subtotal/employeequery parameter names matching backend changes.Overall Feedback
Negative: There are a few risky assumptions that may cause runtime errors or incorrect data: unvalidated
DB_ENCRYPTvalues, and direct scanning into concrete Go types from DB columns that may be NULL or have different types. TheEmployeesSQL filter was changed in a way that could alter results if theinactivecolumn doesn't exist or behaves differently.Positive: The refactor cleanly extracts handlers into separate files, adds safeguards (invoice count limit), and wires TLS/ENCRYPT handling through configuration consistently. Frontend updates align with backend field name changes. Nice work simplifying and organizing handlers! 🎉
If you want, I can provide patch suggestions for the
sql.Null*scan changes andDB_ENCRYPTvalidation.