feat: get org bookings endpoint api-v2 (#20462)

* feat: get org bookings endpoint api-v2

* fix userId filter transform

* fix: update getBookings to take filter.userIds in account

* refactor: getBooking where clause

* fixup! refactor: getBooking where clause

* feat: enable org owners to see org member bookings as attendees

* update flaky e2e tests

* fixup! feat: enable org owners to see org member bookings as attendees

* fixup! fixup! feat: enable org owners to see org member bookings as attendees

* chore: differentiate between org/team owner/admin

* chore: throw error with invalid userIds filter

* chore: clearly ensure non team orgs when orgId is not specified

* bump libraries and add comments

* bump libraries

* chore: give main profile orgId to getAllUserBookings

---------

Co-authored-by: Eunjae Lee <hey@eunjae.dev>
This commit is contained in:
Morgan
2025-04-03 17:36:10 -04:00
committed by GitHub
co-authored by Eunjae Lee
parent d63d15b7b2
commit da853958f7
19 changed files with 1601 additions and 239 deletions
+245
View File
@@ -1220,6 +1220,243 @@
"tags": ["Orgs / Attributes / Options"]
}
},
"/v2/organizations/{orgId}/bookings": {
"get": {
"operationId": "OrganizationsBookingsController_getAllOrgTeamBookings",
"summary": "Get organization team bookings",
"parameters": [
{
"name": "status",
"required": false,
"in": "query",
"description": "Filter bookings by status. If you want to filter by multiple statuses, separate them with a comma.",
"example": "?status=upcoming,past",
"schema": {
"type": "array",
"items": {
"type": "string",
"enum": ["upcoming", "recurring", "past", "cancelled", "unconfirmed"]
}
}
},
{
"name": "attendeeEmail",
"required": false,
"in": "query",
"description": "Filter bookings by the attendee's email address.",
"example": "example@domain.com",
"schema": {
"type": "string"
}
},
{
"name": "attendeeName",
"required": false,
"in": "query",
"description": "Filter bookings by the attendee's name.",
"example": "John Doe",
"schema": {
"type": "string"
}
},
{
"name": "eventTypeIds",
"required": false,
"in": "query",
"description": "Filter bookings by event type ids belonging to the user. Event type ids must be separated by a comma.",
"example": "?eventTypeIds=100,200",
"schema": {
"type": "string"
}
},
{
"name": "eventTypeId",
"required": false,
"in": "query",
"description": "Filter bookings by event type id belonging to the user.",
"example": "?eventTypeId=100",
"schema": {
"type": "string"
}
},
{
"name": "teamsIds",
"required": false,
"in": "query",
"description": "Filter bookings by team ids that user is part of. Team ids must be separated by a comma.",
"example": "?teamIds=50,60",
"schema": {
"type": "string"
}
},
{
"name": "teamId",
"required": false,
"in": "query",
"description": "Filter bookings by team id that user is part of",
"example": "?teamId=50",
"schema": {
"type": "string"
}
},
{
"name": "afterStart",
"required": false,
"in": "query",
"description": "Filter bookings with start after this date string.",
"example": "?afterStart=2025-03-07T10:00:00.000Z",
"schema": {
"type": "string"
}
},
{
"name": "beforeEnd",
"required": false,
"in": "query",
"description": "Filter bookings with end before this date string.",
"example": "?beforeEnd=2025-03-07T11:00:00.000Z",
"schema": {
"type": "string"
}
},
{
"name": "afterCreatedAt",
"required": false,
"in": "query",
"description": "Filter bookings that have been created after this date string.",
"example": "?afterCreatedAt=2025-03-07T10:00:00.000Z",
"schema": {
"type": "string"
}
},
{
"name": "beforeCreatedAt",
"required": false,
"in": "query",
"description": "Filter bookings that have been created before this date string.",
"example": "?beforeCreatedAt=2025-03-14T11:00:00.000Z",
"schema": {
"type": "string"
}
},
{
"name": "afterUpdatedAt",
"required": false,
"in": "query",
"description": "Filter bookings that have been updated after this date string.",
"example": "?afterUpdatedAt=2025-03-07T10:00:00.000Z",
"schema": {
"type": "string"
}
},
{
"name": "beforeUpdatedAt",
"required": false,
"in": "query",
"description": "Filter bookings that have been updated before this date string.",
"example": "?beforeUpdatedAt=2025-03-14T11:00:00.000Z",
"schema": {
"type": "string"
}
},
{
"name": "sortStart",
"required": false,
"in": "query",
"description": "Sort results by their start time in ascending or descending order.",
"example": "?sortStart=asc OR ?sortStart=desc",
"schema": {
"enum": ["asc", "desc"],
"type": "string"
}
},
{
"name": "sortEnd",
"required": false,
"in": "query",
"description": "Sort results by their end time in ascending or descending order.",
"example": "?sortEnd=asc OR ?sortEnd=desc",
"schema": {
"enum": ["asc", "desc"],
"type": "string"
}
},
{
"name": "sortCreated",
"required": false,
"in": "query",
"description": "Sort results by their creation time (when booking was made) in ascending or descending order.",
"example": "?sortCreated=asc OR ?sortCreated=desc",
"schema": {
"enum": ["asc", "desc"],
"type": "string"
}
},
{
"name": "sortUpdatedAt",
"required": false,
"in": "query",
"description": "Sort results by their updated time (for example when booking status changes) in ascending or descending order.",
"example": "?sortUpdated=asc OR ?sortUpdated=desc",
"schema": {
"enum": ["asc", "desc"],
"type": "string"
}
},
{
"name": "take",
"required": false,
"in": "query",
"description": "The number of items to return",
"example": 10,
"schema": {
"type": "number"
}
},
{
"name": "skip",
"required": false,
"in": "query",
"description": "The number of items to skip",
"example": 0,
"schema": {
"type": "number"
}
},
{
"name": "userIds",
"required": false,
"in": "query",
"description": "Filter bookings by ids of users within your organization.",
"example": "?userIds=100,200",
"schema": {
"type": "string"
}
},
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetBookingsOutput_2024_08_13"
}
}
}
}
},
"tags": ["Orgs / Bookings"]
}
},
"/v2/organizations/{orgId}/delegation-credentials": {
"post": {
"operationId": "OrganizationsDelegationCredentialController_createDelegationCredential",
@@ -2603,6 +2840,14 @@
"schema": {
"type": "number"
}
},
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {