28 lines
626 B
TypeScript
28 lines
626 B
TypeScript
import { Controller, Get, Param } from '@nestjs/common';
|
|||
|
|
import { CustomersService } from './customers.service';
|
||
|
|
|
||
|
|
@Controller('customers')
|
||
|
|
export class CustomersController {
|
||
|
|
constructor(private readonly customers: CustomersService) {}
|
||
|
|
|
||
|
|
@Get()
|
||
|
|
list() {
|
||
|
|
return this.customers.list();
|
||
|
|
}
|
||
|
|
|
||
|
|
@Get(':id')
|
||
|
|
get(@Param('id') id: string) {
|
||
|
|
return this.customers.getOrThrow(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Get(':id/orders')
|
||
|
|
getOrders(@Param('id') id: string) {
|
||
|
|
return this.customers.getOrders(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Get(':id/ledger-entries')
|
||
|
|
getLedgerEntries(@Param('id') id: string) {
|
||
|
|
return this.customers.getLedgerEntries(id);
|
||
|
|
}
|
||
|
|
}
|