Add series management and ticketing features: Introduce series event functionality in event creation, enhance event display with series information, and implement ticketing options for public events. Update layouts and improve form handling for better user experience.
This commit is contained in:
parent
c3a29fa47c
commit
a88aa62198
24 changed files with 2897 additions and 44 deletions
35
server/models/series.js
Normal file
35
server/models/series.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import mongoose from 'mongoose'
|
||||
|
||||
const seriesSchema = new mongoose.Schema({
|
||||
id: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
validate: {
|
||||
validator: function(v) {
|
||||
return /^[a-z0-9-]+$/.test(v);
|
||||
},
|
||||
message: 'Series ID must contain only lowercase letters, numbers, and dashes'
|
||||
}
|
||||
},
|
||||
title: { type: String, required: true },
|
||||
description: { type: String, required: true },
|
||||
type: {
|
||||
type: String,
|
||||
enum: ['workshop_series', 'recurring_meetup', 'multi_day', 'course', 'tournament'],
|
||||
default: 'workshop_series'
|
||||
},
|
||||
totalEvents: Number,
|
||||
isActive: { type: Boolean, default: true },
|
||||
createdBy: { type: String, required: true },
|
||||
createdAt: { type: Date, default: Date.now },
|
||||
updatedAt: { type: Date, default: Date.now }
|
||||
})
|
||||
|
||||
// Update the updatedAt field on save
|
||||
seriesSchema.pre('save', function(next) {
|
||||
this.updatedAt = new Date()
|
||||
next()
|
||||
})
|
||||
|
||||
export default mongoose.models.Series || mongoose.model('Series', seriesSchema)
|
||||
Loading…
Add table
Add a link
Reference in a new issue