add separate booking state

This commit is contained in:
Thomas Ruoff
2020-08-25 23:54:31 +02:00
parent 1bf7c7b801
commit 1dcfef205c
2 changed files with 9 additions and 1 deletions

View File

@@ -3,6 +3,8 @@ import * as mongoose from 'mongoose'
import { getDays, dateFormatBackend } from '../helpers/date'
import { BOOKING_STATUS } from './bookingStatus'
const BookingSchema = new mongoose.Schema(
{
// need a seperate uuid to be able to target a booking anonimously
@@ -30,7 +32,7 @@ const BookingSchema = new mongoose.Schema(
},
status: {
type: String,
enum: ['requested', 'confirmed', 'rejected'],
enum: Object.values(BOOKING_STATUS),
required: true,
default: 'requested',
},

6
db/bookingStatus.js Normal file
View File

@@ -0,0 +1,6 @@
export const BOOKING_STATUS = {
REQUESTED: 'requested',
CONFIRMED: 'confirmed',
REJECTED: 'rejected',
CANCELED: 'canceled',
}