mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
27 lines
712 B
TypeScript
27 lines
712 B
TypeScript
import * as mongoose from 'mongoose'
|
|
|
|
export interface Booker
|
|
extends mongoose.SchemaTimestampsConfig,
|
|
mongoose.Document {
|
|
name: string
|
|
email: string
|
|
street: string
|
|
zip: string
|
|
city: string
|
|
}
|
|
|
|
const BookerSchema = new mongoose.Schema<Booker>(
|
|
{
|
|
name: { type: String, required: true },
|
|
email: { type: String, required: true, unique: true, minlength: 5 },
|
|
street: { type: String, required: true },
|
|
zip: { type: String, required: true },
|
|
city: { type: String, required: true },
|
|
},
|
|
{ timestamps: true, collation: { locale: 'de', strength: 1 } }
|
|
)
|
|
|
|
const Model: mongoose.Model<Booker> =
|
|
mongoose.models.Booker || mongoose.model('Booker', BookerSchema)
|
|
export default Model
|