34 lines
879 B
TypeScript
34 lines
879 B
TypeScript
|
|
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
|
||
|
|
import { AdminUsersService } from './consumers.service'
|
||
|
|
import { CreateConsumerDto, UpdateConsumerDto } from './dto/consumer.dto'
|
||
|
|
|
||
|
|
@Controller('admin/consumers')
|
||
|
|
export class AdminUsersController {
|
||
|
|
constructor(private readonly usersService: AdminUsersService) {}
|
||
|
|
|
||
|
|
@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)
|
||
|
|
}
|
||
|
|
|
||
|
|
@Delete(':id')
|
||
|
|
async delete(@Param('id') id: string) {
|
||
|
|
return this.usersService.delete(id)
|
||
|
|
}
|
||
|
|
}
|