mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 18:18:18 +00:00
feat: finish company profile in the backoffice
This commit is contained in:
@@ -136,6 +136,14 @@ export class BookingsController {
|
||||
return this.bookingsService.findAll(filter, companyId);
|
||||
}
|
||||
|
||||
@Get('by-company/:companyId/customer-view')
|
||||
@ApiOperation({ summary: 'List bookings for a company (customer-view shape, backoffice)' })
|
||||
findByCompanyCustomerView(
|
||||
@Param('companyId', ParseUUIDPipe) companyId: string,
|
||||
) {
|
||||
return this.bookingsService.findCustomerBookings(companyId);
|
||||
}
|
||||
|
||||
@Get('list-summary')
|
||||
@ApiOperation({ summary: 'Booking list metrics and tab counts (backoffice)' })
|
||||
@ApiOkResponse({ type: BookingListSummaryDto })
|
||||
|
||||
@@ -1036,4 +1036,37 @@ export class BookingsService {
|
||||
|
||||
return this.findById(id);
|
||||
}
|
||||
|
||||
async findCustomerBookings(companyId: string): Promise<{
|
||||
id: string;
|
||||
reference: string;
|
||||
status: string;
|
||||
tradeDirection: string;
|
||||
freightType: string;
|
||||
originLabel: string;
|
||||
destinationLabel: string;
|
||||
totalAmount: number;
|
||||
currency: string;
|
||||
scheduledDate: Date | null;
|
||||
createdAt: Date;
|
||||
}[]> {
|
||||
const { items } = await this.bookingsRepository.findAllPaginated({
|
||||
page: 1,
|
||||
pageSize: 500,
|
||||
companyId,
|
||||
});
|
||||
return items.map((b) => ({
|
||||
id: b.id,
|
||||
reference: b.reference,
|
||||
status: b.status,
|
||||
tradeDirection: b.tradeDirection,
|
||||
freightType: b.freightType,
|
||||
originLabel: b.originYard?.label ?? '',
|
||||
destinationLabel: b.destinationYard?.label ?? '',
|
||||
totalAmount: Number(b.totalAmount),
|
||||
currency: b.paymentCurrency,
|
||||
scheduledDate: b.scheduledDate ?? null,
|
||||
createdAt: b.createdAt,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user