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
@@ -1,11 +1,24 @@
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import * as mongoose from 'mongoose'
|
||||
|
||||
import { getDays, dateFormatBackend } from '../helpers/date'
|
||||
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { dateFormatBackend, getDays } from '../helpers/date'
|
||||
import { Booker } from './booker'
|
||||
import { BOOKING_STATUS } from './bookingStatus'
|
||||
|
||||
const BookingSchema = new mongoose.Schema(
|
||||
export interface Booking
|
||||
extends mongoose.Document,
|
||||
mongoose.SchemaTimestampsConfig {
|
||||
uuid: string
|
||||
booker: Booker
|
||||
startDate: Date
|
||||
endDate: Date
|
||||
status: string
|
||||
purpose: string
|
||||
org: string
|
||||
destination: string
|
||||
days?: string[]
|
||||
}
|
||||
|
||||
const BookingSchema = new mongoose.Schema<Booking>(
|
||||
{
|
||||
// need a seperate uuid to be able to target a booking anonimously
|
||||
uuid: {
|
||||
@@ -51,7 +64,7 @@ BookingSchema.virtual('days').get(function () {
|
||||
return getDays({ startDate: this.startDate, endDate: this.endDate })
|
||||
})
|
||||
|
||||
BookingSchema.virtual('hash').get(function () {})
|
||||
const Model: mongoose.Model<Booking> =
|
||||
mongoose.models.Booking || mongoose.model('Booking', BookingSchema)
|
||||
|
||||
export default mongoose.models.Booking ||
|
||||
mongoose.model('Booking', BookingSchema)
|
||||
export default Model
|
||||
|
||||
Reference in New Issue
Block a user