docs: booking attendee absent (#22094)
* refactor: booking attendee absent * docs: swagger generate
This commit is contained in:
1 parent
3a65b372c5
commit
1da25cc85f
5 files changed
+216
-32
No files matched your search
@@ -80,7 +80,7 @@ function RequireEmailOrPhone(validationOptions?: ValidationOptions) {
|
||||
constraints: [],
|
||||
validator: {
|
||||
validate(_: unknown, args: ValidationArguments) {
|
||||
const obj = args.object as Attendee;
|
||||
const obj = args.object as CreateBookingAttendee;
|
||||
|
||||
const hasPhoneNumber = !!obj.phoneNumber;
|
||||
const hasEmail = !!obj.email;
|
||||
@@ -95,7 +95,7 @@ function RequireEmailOrPhone(validationOptions?: ValidationOptions) {
|
||||
}
|
||||
|
||||
@RequireEmailOrPhone()
|
||||
class Attendee {
|
||||
class CreateBookingAttendee {
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
description: "The name of the attendee.",
|
||||
@@ -222,13 +222,13 @@ export class CreateBookingInput_2024_08_13 {
|
||||
start!: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: Attendee,
|
||||
type: CreateBookingAttendee,
|
||||
description: "The attendee's details.",
|
||||
})
|
||||
@IsDefined()
|
||||
@ValidateNested()
|
||||
@Type(() => Attendee)
|
||||
attendee!: Attendee;
|
||||
@Type(() => CreateBookingAttendee)
|
||||
attendee!: CreateBookingAttendee;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: Object,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { Type } from "class-transformer";
|
||||
import { IsOptional, IsBoolean, IsEmail, IsArray, ArrayMinSize, ValidateNested } from "class-validator";
|
||||
|
||||
class Attendee {
|
||||
class MarkAbsentAttendee {
|
||||
@IsEmail()
|
||||
@ApiProperty()
|
||||
email!: string;
|
||||
@@ -21,8 +21,8 @@ export class MarkAbsentBookingInput_2024_08_13 {
|
||||
@ArrayMinSize(1)
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => Attendee)
|
||||
@Type(() => MarkAbsentAttendee)
|
||||
@IsOptional()
|
||||
@ApiPropertyOptional({ type: [Attendee] })
|
||||
attendees?: Attendee[];
|
||||
@ApiPropertyOptional({ type: [MarkAbsentAttendee] })
|
||||
attendees?: MarkAbsentAttendee[];
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
import type { BookingLanguageType } from "../inputs/language";
|
||||
import { BookingLanguage } from "../inputs/language";
|
||||
|
||||
class Attendee {
|
||||
class BookingAttendee {
|
||||
@ApiProperty({ type: String, example: "John Doe" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
@@ -52,7 +52,7 @@ class Attendee {
|
||||
phoneNumber?: string;
|
||||
}
|
||||
|
||||
export class SeatedAttendee extends Attendee {
|
||||
export class SeatedAttendee extends BookingAttendee {
|
||||
@ApiProperty({ type: String, example: "3be561a9-31f1-4b8e-aefc-9d9a085f0dd1" })
|
||||
@IsString()
|
||||
@Expose()
|
||||
@@ -264,11 +264,11 @@ class BaseBookingOutput_2024_08_13 {
|
||||
}
|
||||
|
||||
export class BookingOutput_2024_08_13 extends BaseBookingOutput_2024_08_13 {
|
||||
@ApiProperty({ type: [Attendee] })
|
||||
@ApiProperty({ type: [BookingAttendee] })
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => Attendee)
|
||||
@Type(() => BookingAttendee)
|
||||
@Expose()
|
||||
attendees!: Attendee[];
|
||||
attendees!: BookingAttendee[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: [String],
|
||||
|
||||
Reference in new issue
Block a user