- Adiciona variáveis globais do Node.js (process, console, __dirname, require, module, exports) - Adiciona variáveis globais do Jest (describe, it, beforeEach, fail, etc.) - Configura ESLint para arquivos JavaScript de configuração - Remove diretivas eslint-disable não utilizadas - Corrige variáveis não usadas prefixando com _ - Ajusta regras do ESLint para ignorar variáveis que começam com _ - Formata código com Prettier
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
/*
|
|
https://docs.nestjs.com/controllers#controllers
|
|
*/
|
|
|
|
import { LogisticService } from './logistic.service';
|
|
import { CarOutDelivery } from '../core/models/car-out-delivery.model';
|
|
import { CarInDelivery } from '../core/models/car-in-delivery.model';
|
|
import { Body, Controller, Get, Param, Post, UseGuards } from '@nestjs/common';
|
|
import { JwtAuthGuard } from 'src/auth/guards/jwt-auth.guard';
|
|
import { ApiBearerAuth, ApiTags, ApiOperation } from '@nestjs/swagger';
|
|
|
|
@ApiTags('Logística')
|
|
@ApiBearerAuth()
|
|
@UseGuards(JwtAuthGuard)
|
|
@Controller('api/v1/logistic')
|
|
export class LogisticController {
|
|
constructor(private readonly logisticService: LogisticService) {}
|
|
|
|
@Get('expedicao')
|
|
@ApiOperation({ summary: 'Retorna informações de expedição' })
|
|
getExpedicao() {
|
|
return this.logisticService.getExpedicao();
|
|
}
|
|
|
|
@Get('employee')
|
|
@ApiOperation({ summary: 'Retorna lista de funcionários' })
|
|
getEmployee() {
|
|
return this.logisticService.getEmployee();
|
|
}
|
|
|
|
@Get('deliveries/:placa')
|
|
@ApiOperation({ summary: 'Retorna entregas por placa' })
|
|
getDelivery(@Param('placa') placa: string) {
|
|
return this.logisticService.getDeliveries(placa);
|
|
}
|
|
|
|
@Get('status-car/:placa')
|
|
@ApiOperation({ summary: 'Retorna status do veículo por placa' })
|
|
getStatusCar(@Param('placa') placa: string) {
|
|
return this.logisticService.getStatusCar(placa);
|
|
}
|
|
|
|
@Post('create')
|
|
@ApiOperation({ summary: 'Registra saída de veículo' })
|
|
createOutCar(@Body() data: CarOutDelivery) {
|
|
return this.logisticService.createCarOut(data);
|
|
}
|
|
|
|
@Post('return-car')
|
|
@ApiOperation({ summary: 'Registra retorno de veículo' })
|
|
createinCar(@Body() data: CarInDelivery) {
|
|
return this.logisticService.createCarIn(data);
|
|
}
|
|
}
|