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