Skip to content

Scheduling infrastructure for absolutely everyone.

remove unnecessary await on all getCalcomUserId() calls

Agusti Fernandez Pardo18c1a2f026bc
diff --git a/pages/api/attendees/index.ts b/pages/api/attendees/index.ts
index ed0707d6361..d96fe3bca47 100644
--- a/pages/api/attendees/index.ts
+++ b/pages/api/attendees/index.ts
@@ -68,7 +68,7 @@ async function createOrlistAllAttendees(
throw new Error("Invalid request body", safe.error);
}
const bookingId = safe.data.bookingId;
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
const userWithBookings = await prisma.user.findUnique({
where: { id: userId },
include: { bookings: true },
diff --git a/pages/api/availabilities/[id].ts b/pages/api/availabilities/[id].ts
index 90d0f72fc1f..bdb1215f742 100644
--- a/pages/api/availabilities/[id].ts
+++ b/pages/api/availabilities/[id].ts
@@ -97,7 +97,7 @@ export async function availabilityById(req: NextApiRequest, res: NextApiResponse
const safeQuery = schemaQueryIdParseInt.safeParse(query);
const safeBody = schemaAvailabilityBodyParams.safeParse(body);
if (!safeQuery.success) throw new Error("Invalid request query", safeQuery.error);
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
const data = await prisma.availability.findMany({ where: { userId } });
const availabiltiesIds = data.map((availability) => availability.id);
if (availabiltiesIds.includes(safeQuery.data.id)) {
diff --git a/pages/api/availabilities/index.ts b/pages/api/availabilities/index.ts
index bcd904ce958..63ae75db493 100644
--- a/pages/api/availabilities/index.ts
+++ b/pages/api/availabilities/index.ts
@@ -47,7 +47,7 @@ async function createOrlistAllAvailabilities(
res: NextApiResponse<AvailabilitiesResponse | AvailabilityResponse>
) {
const { method } = req;
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
if (method === "GET") {
const data = await prisma.availability.findMany({ where: { userId } });
diff --git a/pages/api/booking-references/[id].ts b/pages/api/booking-references/[id].ts
index 3067dc3c151..9a1b40089b6 100644
--- a/pages/api/booking-references/[id].ts
+++ b/pages/api/booking-references/[id].ts
@@ -98,7 +98,7 @@ export async function bookingReferenceById(
const safeQuery = schemaQueryIdParseInt.safeParse(query);
const safeBody = schemaBookingReferenceBodyParams.safeParse(body);
if (!safeQuery.success) throw new Error("Invalid request query", safeQuery.error);
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
const userWithBookings = await prisma.user.findUnique({
where: { id: userId },
include: { bookings: true },
diff --git a/pages/api/booking-references/index.ts b/pages/api/booking-references/index.ts
index d256936ce5a..9ceedeed300 100644
--- a/pages/api/booking-references/index.ts
+++ b/pages/api/booking-references/index.ts
@@ -46,7 +46,7 @@ async function createOrlistAllBookingReferences(
res: NextApiResponse<BookingReferencesResponse | BookingReferenceResponse>
) {
const { method } = req;
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
const userWithBookings = await prisma.user.findUnique({
where: { id: userId },
include: { bookings: true },
@@ -72,7 +72,7 @@ async function createOrlistAllBookingReferences(
}
// const booking_reference = schemaBookingReferencePublic.parse(data);
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
const userWithBookings = await prisma.user.findUnique({
where: { id: userId },
include: { bookings: true },
diff --git a/pages/api/bookings/[id].ts b/pages/api/bookings/[id].ts
index e3e56b9a360..af6a379158c 100644
--- a/pages/api/bookings/[id].ts
+++ b/pages/api/bookings/[id].ts
@@ -91,7 +91,7 @@ export async function bookingById(req: NextApiRequest, res: NextApiResponse<Book
const safeQuery = schemaQueryIdParseInt.safeParse(query);
const safeBody = schemaBookingBodyParams.safeParse(body);
if (!safeQuery.success) throw new Error("Invalid request query", safeQuery.error);
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
const userWithBookings = await prisma.user.findUnique({
where: { id: userId },
include: { bookings: true },
diff --git a/pages/api/bookings/index.ts b/pages/api/bookings/index.ts
index c3d11a91e0a..107236118dc 100644
--- a/pages/api/bookings/index.ts
+++ b/pages/api/bookings/index.ts
@@ -43,7 +43,7 @@ async function createOrlistAllBookings(
res: NextApiResponse<BookingsResponse | BookingResponse>
) {
const { method } = req;
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
if (method === "GET") {
const data = await prisma.booking.findMany({ where: { userId } });
diff --git a/pages/api/event-types/[id].ts b/pages/api/event-types/[id].ts
index c19822d65b8..dc7535cd5ae 100644
--- a/pages/api/event-types/[id].ts
+++ b/pages/api/event-types/[id].ts
@@ -97,7 +97,7 @@ export async function eventTypeById(req: NextApiRequest, res: NextApiResponse<Ev
const safeQuery = schemaQueryIdParseInt.safeParse(query);
const safeBody = schemaEventTypeBodyParams.safeParse(body);
if (!safeQuery.success) throw new Error("Invalid request query", safeQuery.error);
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
const data = await prisma.eventType.findMany({ where: { userId } });
const userEventTypes = data.map((eventType) => eventType.id);
if (userEventTypes.includes(safeQuery.data.id)) {
diff --git a/pages/api/event-types/index.ts b/pages/api/event-types/index.ts
index cd883d719c4..fc6a2a35f73 100644
--- a/pages/api/event-types/index.ts
+++ b/pages/api/event-types/index.ts
@@ -47,7 +47,7 @@ async function createOrlistAllEventTypes(
res: NextApiResponse<EventTypesResponse | EventTypeResponse>
) {
const { method } = req;
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
if (method === "GET") {
const data = await prisma.eventType.findMany({ where: { userId } });
diff --git a/pages/api/payments/[id].ts b/pages/api/payments/[id].ts
index f196b4cac08..295803ca76e 100644
--- a/pages/api/payments/[id].ts
+++ b/pages/api/payments/[id].ts
@@ -38,7 +38,7 @@ import {
export async function paymentById(req: NextApiRequest, res: NextApiResponse<PaymentResponse>) {
const { method, query } = req;
const safeQuery = schemaQueryIdParseInt.safeParse(query);
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
if (safeQuery.success && method === "GET") {
const userWithBookings = await prisma.user.findUnique({
diff --git a/pages/api/payments/index.ts b/pages/api/payments/index.ts
index 20028df1805..bb2c132c0cf 100644
--- a/pages/api/payments/index.ts
+++ b/pages/api/payments/index.ts
@@ -25,7 +25,7 @@ import { schemaPaymentPublic } from "@lib/validations/payment";
* description: No payments were found
*/
async function allPayments(_: NextApiRequest, res: NextApiResponse<PaymentsResponse>) {
- const userId = await getCalcomUserId(res);
+ const userId = getCalcomUserId(res);
const userWithBookings = await prisma.user.findUnique({
where: { id: userId },