2026-09-09 06:46:27 +03:30
|
|
|
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';
|
2026-09-13 21:02:25 +03:30
|
|
|
import { Public } from '../auth/guards';
|
2026-09-09 06:46:27 +03:30
|
|
|
|
2026-09-13 21:02:25 +03:30
|
|
|
@Public() // pre-existing unauthenticated endpoint; see Phase 1 notes
|
2026-09-09 06:46:27 +03:30
|
|
|
@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);
|
|
|
|
|
}
|
|
|
|
|
}
|