This commit is contained in:
yotakii
2026-01-13 16:08:18 +03:00
parent c0ae467033
commit 13a004fa40
5 changed files with 281 additions and 107 deletions

View File

@@ -206,7 +206,7 @@ bookingSchema.virtual('duration').get(function() {
});
// Pre-save middleware to generate booking number and confirmation code
bookingSchema.pre('save', function(next) {
bookingSchema.pre('validate', function(next) {
if (!this.bookingNumber) {
// Generate booking number: OVH + year + random 6 digits
const year = new Date().getFullYear();