Compare commits
2 Commits
e192c04000
...
5419b3fbd1
| Author | SHA1 | Date | |
|---|---|---|---|
| 5419b3fbd1 | |||
| 9bba139998 |
@ -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 },
|
||||
|
||||
41
src/database/schemas/misc/usersettings.schema.js
Normal file
41
src/database/schemas/misc/usersettings.schema.js
Normal file
@ -0,0 +1,41 @@
|
||||
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,
|
||||
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,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user