Skip to content

Commit

Permalink
608 Backend send confirmation on manual booking (#718)
Browse files Browse the repository at this point in the history
* Change /bookings/create-booking to take a single userid

Changed tests and updated interfaces

* Move create-bookings from BookingController to AdminController

Moved corresponding tests too.

Next objective is to update frontend

* Change client to use /admin/bookings/create

Changed client end to use the endpoint specified instead of /bookings/create-bookings

* Edit AdminController to use an Array of dates & users

Revert change to `UIdssByDateRangeResponse` interface

* Add mail service for manual bookings

Also fixed some weird conflicts

* Add jest mock for nodemailer

This fixes the error while running `yarn test`
  • Loading branch information
jeffplays2005 authored Jul 29, 2024
1 parent 4c3d332 commit 464656c
Show file tree
Hide file tree
Showing 11 changed files with 439 additions and 413 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const WrappedAdminBookingCreationPopUp = ({
isPending={isPending}
isLoading={hasNextPage}
bookingCreationHandler={async (startDate, endDate, uid) => {
await handleAddUserToBooking({ startDate, endDate, userIds: [uid] })
await handleAddUserToBooking({ startDate, endDate, userId: uid })
}}
/>
</span>
Expand Down
74 changes: 37 additions & 37 deletions client/src/models/__generated__/schema.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions client/src/services/Admin/AdminService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,26 +143,26 @@ const AdminService = {
addUsersToBookingForDateRange: async function ({
startDate,
endDate,
userIds
userId
}: {
startDate: Timestamp
endDate: Timestamp
userIds: string[]
userId: string
}) {
const { response, data } = await fetchClient.POST(
"/bookings/create-bookings",
"/admin/bookings/create",
{
body: {
startDate,
endDate,
userIds
userId
}
}
)

if (!response.ok) {
throw new Error(
`Failed to add the users ${userIds.join(",")} to the date range ${startDate.toString()} to ${endDate.toString()} `
`Failed to add the user, ${userId} to the date range ${startDate.toString()} to ${endDate.toString()} `
)
}

Expand Down
100 changes: 50 additions & 50 deletions server/src/middleware/__generated__/routes.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 464656c

Please sign in to comment.