mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 15:07:13 +01:00
use uuid only additionally for booking
This commit is contained in:
@@ -157,7 +157,7 @@ export default function AppStore({ children }) {
|
|||||||
const bookingData = await createBooking(state.formData)
|
const bookingData = await createBooking(state.formData)
|
||||||
dispatch({ type: ACTIONS.POST_DATA_SUCCESS, payload: bookingData })
|
dispatch({ type: ACTIONS.POST_DATA_SUCCESS, payload: bookingData })
|
||||||
|
|
||||||
router.push('/booking/[id]', `/booking/${bookingData._id}`)
|
router.push('/booking/[id]', `/booking/${bookingData.uuid}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
dispatch({ type: ACTIONS.POST_DATA_ERROR, payload: error.message })
|
dispatch({ type: ACTIONS.POST_DATA_ERROR, payload: error.message })
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import { v4 as uuidv4 } from 'uuid'
|
|
||||||
import * as mongoose from 'mongoose'
|
import * as mongoose from 'mongoose'
|
||||||
|
|
||||||
const BookerSchema = new mongoose.Schema(
|
const BookerSchema = new mongoose.Schema(
|
||||||
{
|
{
|
||||||
_id: {
|
|
||||||
type: String,
|
|
||||||
default: uuidv4,
|
|
||||||
},
|
|
||||||
name: { type: String, required: true },
|
name: { type: String, required: true },
|
||||||
email: { type: String, required: true, unique: true, minlength: 5 },
|
email: { type: String, required: true, unique: true, minlength: 5 },
|
||||||
street: { type: String, required: true },
|
street: { type: String, required: true },
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { getDays, dateFormatBackend } from '../helpers/date'
|
|||||||
|
|
||||||
const BookingSchema = new mongoose.Schema(
|
const BookingSchema = new mongoose.Schema(
|
||||||
{
|
{
|
||||||
_id: {
|
// need a seperate uuid to be able to target a booking anonimously
|
||||||
|
uuid: {
|
||||||
type: String,
|
type: String,
|
||||||
default: uuidv4,
|
default: uuidv4,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user