feat: setup billing services

This commit is contained in:
Nathnael
2026-06-29 07:11:52 +00:00
parent db305d6fcd
commit 5bad245ce8
5 changed files with 419 additions and 338 deletions

View File

@@ -8,7 +8,7 @@ import { BillingService } from "./billing.service";
@Controller("billing")
@FreightAdmin()
export class BillingController {
constructor(private readonly billingService: BillingService) {}
constructor(private readonly billingService: BillingService) { }
@Get("invoices")
@ApiOperation({ summary: "List all invoices" })
@@ -16,21 +16,9 @@ export class BillingController {
return this.billingService.findAll();
}
@Get("invoices/booking/:bookingId")
@ApiOperation({ summary: "List invoices for a booking" })
findByBooking(@Param("bookingId", ParseUUIDPipe) bookingId: string) {
return this.billingService.findByBooking(bookingId);
}
@Get("invoices/:id")
@ApiOperation({ summary: "Get an invoice with its line items" })
findById(@Param("id", ParseUUIDPipe) id: string) {
return this.billingService.findById(id);
}
@Post("invoices/generate/:bookingId")
@ApiOperation({ summary: "Generate (or return the existing) invoice for a booking" })
generate(@Param("bookingId", ParseUUIDPipe) bookingId: string) {
return this.billingService.generateForBooking(bookingId);
}
}