Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ArvindEnvoy committed Nov 22, 2024
1 parent 9940e9e commit eb4fb90
Showing 1 changed file with 33 additions and 20 deletions.
53 changes: 33 additions & 20 deletions src/sdk/EnvoyUserAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,35 +196,47 @@ export default class EnvoyUserAPI extends EnvoyAPI {
return data.data;
}

async createReservation(reservationDetails: ReservationCreationAttributes): Promise<ReservationModel> {
let createReservationBody = {
async createReservation(
reservationDetails: ReservationCreationAttributes
): Promise<ReservationModel> {
const createReservationBody = {
data: {
relationships: {
user: {
data: {
type: 'users',
id: reservationDetails.userId
}},
id: reservationDetails.userId,
},
},
...(reservationDetails.locationId && {
location: {
data: {
type: 'locations',
id: reservationDetails.locationId
}
}
}
)
location: {
data: {
type: 'locations',
id: reservationDetails.locationId,
},
},
}),
...(reservationDetails.entryId && {
entry: {
data: {
type: 'entries',
id: reservationDetails.entryId,
},
},
}),
},
attributes: {
...(reservationDetails.startTime && {
'start-time': reservationDetails.startTime,
...(reservationDetails.endTime && {
'end-time': reservationDetails.endTime
}),
'booking-source': 'EXTERNAL_API',
'booking-type': 'visitor'
}
}
}
}),
...(reservationDetails.endTime && {
'end-time': reservationDetails.endTime,
}),
'booking-source': 'EXTERNAL_API',
'booking-type': 'visitor',
},
},
};
const { data } = await this.axios({
method: 'POST',
url: '/a/rms/reservations',
Expand All @@ -233,6 +245,7 @@ export default class EnvoyUserAPI extends EnvoyAPI {
return data.data;
}


/**
* Requires `invites.write` scope.
*/
Expand Down

0 comments on commit eb4fb90

Please sign in to comment.