Removed paymentDate field from payment schema and updated related route handlers to reflect this change, streamlining payment data management.

This commit is contained in:
Tom Butcher 2026-07-18 14:00:44 +01:00
parent e192c04000
commit 9bba139998
2 changed files with 1 additions and 4 deletions

View File

@ -13,7 +13,6 @@ const paymentSchema = new Schema(
state: {
type: { type: String, required: true, default: 'draft' },
},
paymentDate: { type: Date, required: false },
postedAt: { type: Date, required: false },
authorisedAt: { type: Date, required: false },
declinedAt: { type: Date, required: false },

View File

@ -13,7 +13,7 @@ import {
getModelStats,
getModelHistory,
checkStates,
searchObjects
searchObjects,
} from '../../database/database.js';
import { invoiceModel } from '../../database/schemas/finance/invoice.schema.js';
@ -131,7 +131,6 @@ export const editPaymentRouteHandler = async (req, res) => {
client: req.body.client,
invoice: req.body.invoice,
amount: req.body.amount,
paymentDate: req.body.paymentDate,
paymentMethod: req.body.paymentMethod,
notes: req.body.notes,
};
@ -206,7 +205,6 @@ export const newPaymentRouteHandler = async (req, res) => {
client: invoice.client?._id || req.body.client,
invoice: req.body.invoice,
amount: req.body.amount || 0,
paymentDate: req.body.paymentDate || new Date(),
paymentMethod: req.body.paymentMethod,
notes: req.body.notes,
};