mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 15:07:13 +01:00
further typing improvements
This commit is contained in:
committed by
Thomas Ruoff
parent
90ac05a907
commit
52a68e9989
16
db/booker.ts
16
db/booker.ts
@@ -1,6 +1,16 @@
|
||||
import * as mongoose from 'mongoose'
|
||||
|
||||
const BookerSchema = new mongoose.Schema(
|
||||
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 },
|
||||
@@ -11,4 +21,6 @@ const BookerSchema = new mongoose.Schema(
|
||||
{ timestamps: true, collation: { locale: 'de', strength: 1 } }
|
||||
)
|
||||
|
||||
export default mongoose.models.Booker || mongoose.model('Booker', BookerSchema)
|
||||
const Model: mongoose.Model<Booker> =
|
||||
mongoose.models.Booker || mongoose.model('Booker', BookerSchema)
|
||||
export default Model
|
||||
|
||||
Reference in New Issue
Block a user