2026-03-16 00:33:40 +03:30
|
|
|
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
|
|
|
|
import { ApiTags } from '@nestjs/swagger'
|
|
|
|
|
import { AccountsService } from './accounts.service'
|
|
|
|
|
import { CreateConsumerAccountDto, UpdateAccountDto } from './dto/account.dto'
|
2026-04-27 10:45:39 +03:30
|
|
|
import type { AccountsServiceCreateResponseDto, AccountsServiceFindAllResponseDto, AccountsServiceFindOneResponseDto, AccountsServiceUpdateResponseDto } from './dto/accounts-response.dto'
|
2026-03-16 00:33:40 +03:30
|
|
|
|
2026-03-16 17:56:51 +03:30
|
|
|
@ApiTags('AdminConsumerAccounts')
|
2026-03-16 00:33:40 +03:30
|
|
|
@Controller('admin/consumers/:consumerId/accounts')
|
|
|
|
|
export class AccountsController {
|
|
|
|
|
constructor(private readonly accountsService: AccountsService) {}
|
|
|
|
|
|
|
|
|
|
@Get()
|
2026-04-27 10:45:39 +03:30
|
|
|
async findAll(@Param('consumerId') consumerId: string): Promise<AccountsServiceFindAllResponseDto> {
|
2026-03-16 00:33:40 +03:30
|
|
|
return this.accountsService.findAll(consumerId)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get(':id')
|
2026-04-27 10:45:39 +03:30
|
|
|
async findOne(@Param('id') id: string): Promise<AccountsServiceFindOneResponseDto> {
|
2026-03-16 00:33:40 +03:30
|
|
|
return this.accountsService.findOne(id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post()
|
|
|
|
|
async create(
|
|
|
|
|
@Param('consumerId') consumerId: string,
|
|
|
|
|
@Body() data: CreateConsumerAccountDto,
|
2026-04-27 10:45:39 +03:30
|
|
|
): Promise<AccountsServiceCreateResponseDto> {
|
2026-03-16 00:33:40 +03:30
|
|
|
return this.accountsService.create(consumerId, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Patch(':id')
|
2026-04-27 10:45:39 +03:30
|
|
|
async update(@Param('id') id: string, @Body() data: UpdateAccountDto): Promise<AccountsServiceUpdateResponseDto> {
|
2026-03-16 00:33:40 +03:30
|
|
|
return this.accountsService.update(id, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @Delete(':id')
|
|
|
|
|
// async delete(@Param('id') id: string) {
|
|
|
|
|
// return this.accountsService.delete(id)
|
|
|
|
|
// }
|
|
|
|
|
}
|