-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/global-booking-limits
- Loading branch information
Showing
300 changed files
with
10,774 additions
and
9,607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
apps/api/v1/lib/validations/shared/queryExpandRelations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { z } from "zod"; | ||
|
||
const expandEnum = z.enum(["team"]); | ||
|
||
export const schemaQuerySingleOrMultipleExpand = z | ||
.union([ | ||
expandEnum, // Allow a single value from the enum | ||
z.array(expandEnum).refine((arr) => new Set(arr).size === arr.length, { | ||
message: "Array values must be unique", | ||
}), // Allow an array of enum values, with uniqueness constraint | ||
]) | ||
.optional(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,6 @@ describe("GET /api/bookings", async () => { | |
|
||
const responseData = await handler(req); | ||
responseData.bookings.forEach((booking) => { | ||
console.log(booking); | ||
expect(new Date(booking.startTime).getTime()).toBeGreaterThanOrEqual(new Date().getTime()); | ||
}); | ||
}); | ||
|
@@ -188,4 +187,27 @@ describe("GET /api/bookings", async () => { | |
}); | ||
}); | ||
}); | ||
|
||
describe("Expand feature to add relational data in return payload", () => { | ||
it("Returns only team data when expand=team is set", async () => { | ||
const adminUser = await prisma.user.findFirstOrThrow({ where: { email: "[email protected]" } }); | ||
const { req } = createMocks<CustomNextApiRequest, CustomNextApiResponse>({ | ||
method: "GET", | ||
query: { | ||
expand: "team", | ||
}, | ||
pagination: DefaultPagination, | ||
}); | ||
|
||
req.userId = adminUser.id; | ||
req.isOrganizationOwnerOrAdmin = true; | ||
|
||
const responseData = await handler(req); | ||
console.log("bookings=>", responseData.bookings); | ||
responseData.bookings.forEach((booking) => { | ||
if (booking.id === 31) expect(booking.eventType?.team?.slug).toBe("team1"); | ||
if (booking.id === 19) expect(booking.eventType?.team).toBe(null); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
"dependencies": { | ||
"@calcom/platform-constants": "*", | ||
"@calcom/platform-enums": "*", | ||
"@calcom/platform-libraries": "npm:@calcom/[email protected].34", | ||
"@calcom/platform-libraries": "npm:@calcom/[email protected].36", | ||
"@calcom/platform-libraries-0.0.2": "npm:@calcom/[email protected]", | ||
"@calcom/platform-types": "*", | ||
"@calcom/platform-utils": "*", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.