feat: v2 GET bookings updated at filters and sort (#19133)

* fix: make Booking.updatedAt update automatically

* feat: return updatedAt by bookings endpoints

* feat: GET bookings beforeUpdatedAt, afterUpdatedAt, sortUpdated params

* docs: api

* chore: bump platform-libraries

* refactor: sortUpdated -> sortUpdatedAt query param

* chore: delete wrong migration
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2025-02-11 08:39:50 +00:00
1 parent c211f181fc
commit 08bcc77e2c
14 files changed
+6261 -95

No files matched your search

@@ -152,6 +152,26 @@ export class GetBookingsInput_2024_08_13 {
})
beforeEnd?: string;
@IsOptional()
@IsISO8601({ strict: true }, { message: "fromDate must be a valid ISO 8601 date." })
@ApiProperty({
type: String,
required: false,
description: "Filter bookings that have been updated after this date string.",
example: "?afterUpdatedAt=2025-03-07T10:00:00.000Z",
})
afterUpdatedAt?: string;
@IsOptional()
@IsISO8601({ strict: true }, { message: "toDate must be a valid ISO 8601 date." })
@ApiProperty({
type: String,
required: false,
description: "Filter bookings that have been updated before this date string.",
example: "?beforeUpdatedAt=2025-03-14T11:00:00.000Z",
})
beforeUpdatedAt?: string;
// note(Lauris): sort
@IsOptional()
@IsEnum(SortOrder, {
@@ -190,6 +210,19 @@ export class GetBookingsInput_2024_08_13 {
})
sortCreated?: SortOrderType;
@IsOptional()
@IsEnum(SortOrder, {
message: 'SortCreated must be either "asc" or "desc".',
})
@ApiProperty({
required: false,
description:
"Sort results by their updated time (for example when booking status changes) in ascending or descending order.",
example: "?sortUpdated=asc OR ?sortUpdated=desc",
enum: SortOrder,
})
sortUpdatedAt?: SortOrderType;
// note(Lauris): pagination
@ApiProperty({ required: false, description: "The number of items to return", example: 10 })
@Transform(({ value }: { value: string }) => value && parseInt(value))
@@ -236,6 +236,11 @@ class BaseBookingOutput_2024_08_13 {
@Expose()
createdAt!: string;
@ApiProperty({ type: String, example: "2024-08-13T15:30:00Z" })
@IsDateString()
@Expose()
updatedAt!: string | null;
@ApiPropertyOptional({
type: Object,
example: { key: "value" },
@@ -128,7 +128,7 @@ export class UpdateEventTypeInput_2024_06_14 {
@ArrayUnique()
@IsInt({ each: true })
@Min(1, { each: true })
@DocsProperty({
@DocsPropertyOptional({
example: [15, 30, 60],
description:
"If you want that user can choose between different lengths of the event you can specify them here. Must include the provided `lengthInMinutes`.",