25 lines
741 B
TypeScript
25 lines
741 B
TypeScript
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common';
|
|
import { OrdersService } from './orders.service';
|
|
import { CreateOrderDto } from './dto/create-order.dto';
|
|
import { UpdateOrderStatusDto } from './dto/update-order-status.dto';
|
|
|
|
@Controller('orders')
|
|
export class OrdersController {
|
|
constructor(private readonly orders: OrdersService) {}
|
|
|
|
@Post()
|
|
create(@Body() dto: CreateOrderDto) {
|
|
return this.orders.createOrder(dto);
|
|
}
|
|
|
|
@Get(':id')
|
|
get(@Param('id') id: string) {
|
|
return this.orders.getById(id);
|
|
}
|
|
|
|
@Patch(':id/status')
|
|
updateStatus(@Param('id') id: string, @Body() dto: UpdateOrderStatusDto) {
|
|
return this.orders.updateStatus(id, dto.status, dto.actorAdminUserId, dto.note);
|
|
}
|
|
}
|