39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
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'
|
|
|
|
@ApiTags('ConsumerAccounts')
|
|
@Controller('consumer/accounts')
|
|
export class AccountsController {
|
|
constructor(private readonly accountsService: AccountsService) {}
|
|
|
|
@Get()
|
|
async findAll(@Param('consumerId') consumerId: string) {
|
|
return this.accountsService.findAll(consumerId)
|
|
}
|
|
|
|
@Get(':id')
|
|
async findOne(@Param('id') id: string) {
|
|
return this.accountsService.findOne(id)
|
|
}
|
|
|
|
@Post()
|
|
async create(
|
|
@Param('consumerId') consumerId: string,
|
|
@Body() data: CreateConsumerAccountDto,
|
|
) {
|
|
return this.accountsService.create(consumerId, data)
|
|
}
|
|
|
|
@Patch(':id')
|
|
async update(@Param('id') id: string, @Body() data: UpdateAccountDto) {
|
|
return this.accountsService.update(id, data)
|
|
}
|
|
|
|
// @Delete(':id')
|
|
// async delete(@Param('id') id: string) {
|
|
// return this.accountsService.delete(id)
|
|
// }
|
|
}
|