refactor: update time group handling in booking order controller

pull/157/head
shancheas 2025-06-11 13:03:48 +07:00
parent b476c92b70
commit 9bbd37ba38
2 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,5 @@
import { Controller, Get, Query } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { ApiTags } from '@nestjs/swagger';
import { Public } from 'src/core/guards';
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';

View File

@ -145,10 +145,18 @@ export class BookingOrderController {
items,
} = data;
let timeGroup = null;
const usageItems = items.map((item) => {
const itemData = item.item;
const timeGroupData = itemData.time_group;
const { id: groupId, name, start_time, end_time } = timeGroupData;
timeGroup = {
id: groupId,
name,
start_time,
end_time,
};
const {
id,
item_id,
@ -170,12 +178,6 @@ export class BookingOrderController {
total_net_price,
qty,
qty_remaining,
time_group: {
id: groupId,
name,
start_time,
end_time,
},
};
});
@ -194,6 +196,7 @@ export class BookingOrderController {
status,
id,
items: usageItems,
time_group: timeGroup,
};
}