29 lines
775 B
TypeScript
29 lines
775 B
TypeScript
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
|
import { AdminConsumersService } from './consumers.service'
|
|
import { CreateConsumerDto, UpdateConsumerDto } from './dto/consumer.dto'
|
|
|
|
@Controller('admin/consumers')
|
|
export class AdminUsersController {
|
|
constructor(private readonly usersService: AdminConsumersService) {}
|
|
|
|
@Get()
|
|
async findAll() {
|
|
return this.usersService.findAll()
|
|
}
|
|
|
|
@Get(':id')
|
|
async findOne(@Param('id') id: string) {
|
|
return this.usersService.findOne(id)
|
|
}
|
|
|
|
@Post()
|
|
async create(@Body() data: CreateConsumerDto) {
|
|
return this.usersService.create(data)
|
|
}
|
|
|
|
@Patch(':id')
|
|
async update(@Param('id') id: string, @Body() data: UpdateConsumerDto) {
|
|
return this.usersService.update(id, data)
|
|
}
|
|
}
|