fix: only inactive accounts filter

This commit is contained in:
Ahmed Bouhuolia
2025-11-02 19:58:26 +02:00
parent 77dc0778a3
commit fdec94a3f7
5 changed files with 54 additions and 13 deletions

View File

@@ -11,11 +11,11 @@ import {
import { AccountsApplication } from './AccountsApplication.service';
import { CreateAccountDTO } from './CreateAccount.dto';
import { EditAccountDTO } from './EditAccount.dto';
import { IAccountsFilter } from './Accounts.types';
import {
ApiExtraModels,
ApiOperation,
ApiParam,
ApiQuery,
ApiResponse,
ApiTags,
getSchemaPath,
@@ -24,6 +24,7 @@ import { AccountResponseDto } from './dtos/AccountResponse.dto';
import { AccountTypeResponseDto } from './dtos/AccountTypeResponse.dto';
import { GetAccountTransactionResponseDto } from './dtos/GetAccountTransactionResponse.dto';
import { GetAccountTransactionsQueryDto } from './dtos/GetAccountTransactionsQuery.dto';
import { GetAccountsQueryDto } from './dtos/GetAccountsQuery.dto';
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@Controller('accounts')
@@ -33,7 +34,7 @@ import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
@ApiExtraModels(GetAccountTransactionResponseDto)
@ApiCommonHeaders()
export class AccountsController {
constructor(private readonly accountsApplication: AccountsApplication) {}
constructor(private readonly accountsApplication: AccountsApplication) { }
@Post()
@ApiOperation({ summary: 'Create an account' })
@@ -178,7 +179,19 @@ export class AccountsController {
items: { $ref: getSchemaPath(AccountResponseDto) },
},
})
async getAccounts(@Query() filter: Partial<IAccountsFilter>) {
@ApiQuery({
name: 'onlyInactive',
required: false,
type: Boolean,
description: 'Filter to show only inactive accounts',
})
@ApiQuery({
name: 'structure',
required: false,
type: String,
description: 'Structure type for the accounts list',
})
async getAccounts(@Query() filter: GetAccountsQueryDto) {
return this.accountsApplication.getAccounts(filter);
}
}