refactor(nestjs): list resources

This commit is contained in:
Ahmed Bouhuolia
2025-05-04 11:19:34 +02:00
parent 4f6ad2b293
commit c9d752d102
36 changed files with 180 additions and 63 deletions

View File

@@ -6,9 +6,13 @@ import {
Param,
Post,
Put,
Query,
} from '@nestjs/common';
import { CustomersApplication } from './CustomersApplication.service';
import { ICustomerOpeningBalanceEditDTO } from './types/Customers.types';
import {
ICustomerOpeningBalanceEditDTO,
ICustomersFilter,
} from './types/Customers.types';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { CreateCustomerDto } from './dtos/CreateCustomer.dto';
import { EditCustomerDto } from './dtos/EditCustomer.dto';
@@ -24,6 +28,12 @@ export class CustomersController {
return this.customersApplication.getCustomer(customerId);
}
@Get()
@ApiOperation({ summary: 'Retrieves the customers paginated list.' })
getCustomers(@Query() filterDTO: Partial<ICustomersFilter>) {
return this.customersApplication.getCustomers(filterDTO);
}
@Post()
@ApiOperation({ summary: 'Create a new customer.' })
createCustomer(@Body() customerDTO: CreateCustomerDto) {