Compare commits
No commits in common. "5419b3fbd11db06902480a1dc85d251da42474d1" and "e192c040005b25f01c48e2f74a69a09135adf1db" have entirely different histories.
5419b3fbd1
...
e192c04000
@ -13,6 +13,7 @@ const paymentSchema = new Schema(
|
|||||||
state: {
|
state: {
|
||||||
type: { type: String, required: true, default: 'draft' },
|
type: { type: String, required: true, default: 'draft' },
|
||||||
},
|
},
|
||||||
|
paymentDate: { type: Date, required: false },
|
||||||
postedAt: { type: Date, required: false },
|
postedAt: { type: Date, required: false },
|
||||||
authorisedAt: { type: Date, required: false },
|
authorisedAt: { type: Date, required: false },
|
||||||
declinedAt: { type: Date, required: false },
|
declinedAt: { type: Date, required: false },
|
||||||
|
|||||||
@ -1,41 +0,0 @@
|
|||||||
import mongoose from 'mongoose';
|
|
||||||
import { generateId } from '../../utils.js';
|
|
||||||
const { Schema } = mongoose;
|
|
||||||
|
|
||||||
const userSettingsSchema = new mongoose.Schema({
|
|
||||||
_reference: { type: String, default: () => generateId()() },
|
|
||||||
user: {
|
|
||||||
type: Schema.Types.ObjectId,
|
|
||||||
ref: 'user',
|
|
||||||
required: true,
|
|
||||||
unique: true,
|
|
||||||
},
|
|
||||||
defaults: {
|
|
||||||
viewMode: { type: Schema.Types.Mixed, default: () => ({}) },
|
|
||||||
filterSidebarVisibility: {
|
|
||||||
type: Schema.Types.Mixed,
|
|
||||||
default: () => ({}),
|
|
||||||
},
|
|
||||||
columnVisibility: { type: Schema.Types.Mixed, default: () => ({}) },
|
|
||||||
collapseState: { type: Schema.Types.Mixed, default: () => ({}) },
|
|
||||||
},
|
|
||||||
|
|
||||||
createdAt: {
|
|
||||||
type: Date,
|
|
||||||
required: true,
|
|
||||||
default: Date.now,
|
|
||||||
},
|
|
||||||
updatedAt: {
|
|
||||||
type: Date,
|
|
||||||
required: true,
|
|
||||||
default: Date.now,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
userSettingsSchema.virtual('id').get(function () {
|
|
||||||
return this._id;
|
|
||||||
});
|
|
||||||
|
|
||||||
userSettingsSchema.set('toJSON', { virtuals: true });
|
|
||||||
|
|
||||||
export const userSettingsModel = mongoose.model('userSettings', userSettingsSchema);
|
|
||||||
@ -13,7 +13,7 @@ import {
|
|||||||
getModelStats,
|
getModelStats,
|
||||||
getModelHistory,
|
getModelHistory,
|
||||||
checkStates,
|
checkStates,
|
||||||
searchObjects,
|
searchObjects
|
||||||
} from '../../database/database.js';
|
} from '../../database/database.js';
|
||||||
import { invoiceModel } from '../../database/schemas/finance/invoice.schema.js';
|
import { invoiceModel } from '../../database/schemas/finance/invoice.schema.js';
|
||||||
|
|
||||||
@ -131,6 +131,7 @@ export const editPaymentRouteHandler = async (req, res) => {
|
|||||||
client: req.body.client,
|
client: req.body.client,
|
||||||
invoice: req.body.invoice,
|
invoice: req.body.invoice,
|
||||||
amount: req.body.amount,
|
amount: req.body.amount,
|
||||||
|
paymentDate: req.body.paymentDate,
|
||||||
paymentMethod: req.body.paymentMethod,
|
paymentMethod: req.body.paymentMethod,
|
||||||
notes: req.body.notes,
|
notes: req.body.notes,
|
||||||
};
|
};
|
||||||
@ -205,6 +206,7 @@ export const newPaymentRouteHandler = async (req, res) => {
|
|||||||
client: invoice.client?._id || req.body.client,
|
client: invoice.client?._id || req.body.client,
|
||||||
invoice: req.body.invoice,
|
invoice: req.body.invoice,
|
||||||
amount: req.body.amount || 0,
|
amount: req.body.amount || 0,
|
||||||
|
paymentDate: req.body.paymentDate || new Date(),
|
||||||
paymentMethod: req.body.paymentMethod,
|
paymentMethod: req.body.paymentMethod,
|
||||||
notes: req.body.notes,
|
notes: req.body.notes,
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user