basic booking load behavior
This commit is contained in:
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
echo "workdir ${pwd}"
|
echo "workdir ${pwd}"
|
||||||
wget -O ./openapi/api.json localhost:3000/api-json
|
wget -O ./openapi/api.json localhost:3000/api-json
|
||||||
npx ng-openapi -c ./openapitools.json -i ./openapi/api.json -o ./src/api
|
npx ng-openapi -i ./openapi/api.json -o ./src/api
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -92,6 +92,7 @@ export interface BookingResponseDto {
|
|||||||
notes?: string;
|
notes?: string;
|
||||||
reservedSeatsCount: number;
|
reservedSeatsCount: number;
|
||||||
canceledAt: string | null;
|
canceledAt: string | null;
|
||||||
|
createdAt: string | null;
|
||||||
user: UserResponseDto;
|
user: UserResponseDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@for (booking of bookings.value()?.data; track booking) {
|
@for (booking of bookings.value()?.data; track booking) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{formatDateTime(booking.occurrenceStartTime)}}</td>
|
<td>{{formatDateTime(booking.createdAt)}}</td>
|
||||||
<td>{{booking.reservedSeatsCount}}</td>
|
<td>{{booking.reservedSeatsCount}}</td>
|
||||||
<td><rs-daisy-button [variant]="'error'">
|
<td><rs-daisy-button [variant]="'error'">
|
||||||
Lemondás
|
Lemondás
|
||||||
|
|||||||
@@ -74,7 +74,10 @@ export class SingleEventBookingList {
|
|||||||
this.activePage.set($event);
|
this.activePage.set($event);
|
||||||
}
|
}
|
||||||
|
|
||||||
formatDateTime( dateStr: string|Date){
|
formatDateTime( dateStr?: string|Date|null){
|
||||||
|
if ( !dateStr ){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return format(new Date(dateStr),'yyyy-MM-dd HH:mm');
|
return format(new Date(dateStr),'yyyy-MM-dd HH:mm');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -607,15 +607,16 @@ export class CalendarService {
|
|||||||
eventId: number,
|
eventId: number,
|
||||||
queryParams: CalendarGetBookingDto,
|
queryParams: CalendarGetBookingDto,
|
||||||
): Promise<CalenderControllerGetBookingResponse> {
|
): Promise<CalenderControllerGetBookingResponse> {
|
||||||
console.info('getBookings', userId, eventId);
|
// const { page = 1, limit = 0 } = queryParams;
|
||||||
await Promise.resolve();
|
const { page = 1, limit = 0, order } = queryParams;
|
||||||
const { page = 1, limit = 0 } = queryParams;
|
|
||||||
// const { page = 1, limit = 0, sortBy, order } = queryParams;
|
|
||||||
const findOptions: FindManyOptions<Booking> = {
|
const findOptions: FindManyOptions<Booking> = {
|
||||||
where: {
|
where: {
|
||||||
eventId: eventId,
|
eventId: eventId,
|
||||||
occurrenceStartTime: queryParams.startTime,
|
occurrenceStartTime: queryParams.startTime,
|
||||||
},
|
},
|
||||||
|
order: {
|
||||||
|
['createdAt']: order!,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const paginated = limit > 0;
|
const paginated = limit > 0;
|
||||||
const [data, totalItems] =
|
const [data, totalItems] =
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ export class BookingResponseDto {
|
|||||||
@ApiProperty({ nullable: true })
|
@ApiProperty({ nullable: true })
|
||||||
canceledAt?: string;
|
canceledAt?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ nullable: true })
|
||||||
|
createdAt?: string; // ISO String for the client
|
||||||
|
|
||||||
// Flattened User Info (Avoid sending the whole User object)
|
// Flattened User Info (Avoid sending the whole User object)
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
@@ -36,6 +39,7 @@ export class BookingResponseDto {
|
|||||||
this.notes = booking.notes;
|
this.notes = booking.notes;
|
||||||
this.reservedSeatsCount = booking.reservedSeatsCount;
|
this.reservedSeatsCount = booking.reservedSeatsCount;
|
||||||
this.canceledAt = booking.canceledAt?.toISOString() || undefined;
|
this.canceledAt = booking.canceledAt?.toISOString() || undefined;
|
||||||
|
this.createdAt = booking.createdAt?.toISOString() || undefined;
|
||||||
|
|
||||||
// Safety check: Only map user if relation is loaded
|
// Safety check: Only map user if relation is loaded
|
||||||
if (booking.user) {
|
if (booking.user) {
|
||||||
|
|||||||
Reference in New Issue
Block a user