import { Body, Controller, Get, Param, Post } from "@nestjs/common";
import { DeviceAssignmentsService } from "./device-assignments.service";
import { CreateAssignmentDto } from "./dtos/CreateAssignmentDto.dto";

@Controller("")
export class DeviceAssignmentsController {
  constructor(private service: DeviceAssignmentsService) {}

  @Post("assign")
  assign(@Body() dto: any) {
    const assignedById = 1; // replace with auth user
    return this.service.assign(dto, assignedById);
  }

  @Post(":id/return")
  returnDevice(@Param("id") id: number) {
    return this.service.returnDevice(+id);
  }

  @Post('all')
  findAll(@Body() dto: any) {
    return this.service.findAll(dto);
  }
}
