feat: v2 admin GET bookings, user information (#20221)
* feat: membership user return bio and metadata * feat: input and output bio and metadata for users and manager users * test: managed event type appears when fetching user event types * test: managed event type appears when fetching user event types * test: managed event type appears when fetching user event types * test: managed event type appears when fetching non-org team user event types * feat: organizations users bookings endpoint * feat: book using eventSlug & username & organizationSlug * chore: generate latest docs
This commit is contained in:
1 parent
7c6b055cd1
commit
277da187d0
48 files changed
+2263
-525
No files matched your search
@@ -36,6 +36,34 @@ import {
|
||||
} from "./location.input";
|
||||
import { ValidateMetadata } from "./validators/validate-metadata";
|
||||
|
||||
function RequireEventTypeIdentification(validationOptions?: ValidationOptions) {
|
||||
return function (object: any) {
|
||||
registerDecorator({
|
||||
name: "requireEventTypeIdentification",
|
||||
target: object,
|
||||
propertyName: "eventTypeId or eventTypeSlug + username",
|
||||
options: validationOptions,
|
||||
constraints: [],
|
||||
validator: {
|
||||
validate(_value: any, args: ValidationArguments) {
|
||||
const obj = args.object as CreateBookingInput_2024_08_13;
|
||||
|
||||
// Check if eventTypeId is provided
|
||||
const hasEventTypeId = !!obj?.eventTypeId;
|
||||
|
||||
// Check if we have both eventTypeSlug and username
|
||||
const hasSlugAndUsername = !!obj?.eventTypeSlug && !!obj?.username;
|
||||
|
||||
return hasEventTypeId || hasSlugAndUsername;
|
||||
},
|
||||
defaultMessage(): string {
|
||||
return "Either eventTypeId OR (eventTypeSlug + username) must be provided";
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function RequireEmailOrPhone(validationOptions?: ValidationOptions) {
|
||||
return function (target: object, propertyName: string) {
|
||||
registerDecorator({
|
||||
@@ -121,6 +149,7 @@ class Attendee {
|
||||
BookingInputOrganizersDefaultAppLocation_2024_08_13,
|
||||
ValidateBookingLocation_2024_08_13
|
||||
)
|
||||
@RequireEventTypeIdentification()
|
||||
export class CreateBookingInput_2024_08_13 {
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
@@ -140,13 +169,44 @@ export class CreateBookingInput_2024_08_13 {
|
||||
})
|
||||
lengthInMinutes?: number;
|
||||
|
||||
@ApiProperty({
|
||||
@ApiPropertyOptional({
|
||||
type: Number,
|
||||
description: "The ID of the event type that is booked.",
|
||||
description:
|
||||
"The ID of the event type that is booked. Required unless eventTypeSlug and username are provided as an alternative to identifying the event type.",
|
||||
example: 123,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
eventTypeId!: number;
|
||||
eventTypeId?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
description:
|
||||
"The slug of the event type. Required along with username and optionally organizationSlug if eventTypeId is not provided.",
|
||||
example: "my-event-type",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
eventTypeSlug?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
description:
|
||||
"The username of the event owner. Required along with eventTypeSlug and optionally organizationSlug if eventTypeId is not provided.",
|
||||
example: "john-doe",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
username?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
description: "The organization slug. Optional, only used when booking with eventTypeSlug + username.",
|
||||
example: "acme-corp",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
organizationSlug?: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: Attendee,
|
||||
|
||||
Reference in new issue
Block a user