Alterado end point api/v1/delivery/schedule para mostrar a capacidade e saldo da capacidade com 3 casas decimais e criado peso adicional para mostrar a data de entrega na abertura da venda
This commit is contained in:
@@ -1,61 +1,61 @@
|
||||
/*
|
||||
https://docs.nestjs.com/controllers#controllers
|
||||
*/
|
||||
|
||||
import { Body, Controller, Delete, Get, HttpException, HttpStatus, Param, Post, Query } from '@nestjs/common';
|
||||
import { PartnerRange } from 'src/domain/models/partner-range.model';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
import { PartnerRangeService } from './partner-range.service';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('api/v1/partner/range')
|
||||
export class PartnerRangeController {
|
||||
constructor(private partnerRangeService: PartnerRangeService) { }
|
||||
|
||||
@Get()
|
||||
getPartnersCategory(@Query() query) {
|
||||
let type = 'T';
|
||||
type = query['type'];
|
||||
if (query['type'] != null) {
|
||||
type = query['type'];
|
||||
}
|
||||
try {
|
||||
return this.partnerRangeService.getPartnerRanges(type);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
getPartnerRangeById(@Param('id') id: number) {
|
||||
try {
|
||||
return this.partnerRangeService.getPartnerRange(id);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Post('create')
|
||||
createPartner(@Body() data: PartnerRange) {
|
||||
try {
|
||||
return this.partnerRangeService.createOrUpdatePartnerRange(data);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Delete('delete/:id')
|
||||
async deleteRange(@Param('id') id: number) {
|
||||
try {
|
||||
await this.partnerRangeService.deleteRange(id);
|
||||
return new ResultModel(true, 'Faixa de comissão excluída com sucesso!', null, null);
|
||||
}
|
||||
catch(error){
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
https://docs.nestjs.com/controllers#controllers
|
||||
*/
|
||||
|
||||
import { Body, Controller, Delete, Get, HttpException, HttpStatus, Param, Post, Query } from '@nestjs/common';
|
||||
import { PartnerRange } from 'src/domain/models/partner-range.model';
|
||||
import { ResultModel } from 'src/domain/models/result.model';
|
||||
import { PartnerRangeService } from './partner-range.service';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('BackOffice')
|
||||
@Controller('api/v1/partner/range')
|
||||
export class PartnerRangeController {
|
||||
constructor(private partnerRangeService: PartnerRangeService) { }
|
||||
|
||||
@Get()
|
||||
getPartnersCategory(@Query() query) {
|
||||
let type = 'T';
|
||||
type = query['type'];
|
||||
if (query['type'] != null) {
|
||||
type = query['type'];
|
||||
}
|
||||
try {
|
||||
return this.partnerRangeService.getPartnerRanges(type);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
getPartnerRangeById(@Param('id') id: number) {
|
||||
try {
|
||||
return this.partnerRangeService.getPartnerRange(id);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Post('create')
|
||||
createPartner(@Body() data: PartnerRange) {
|
||||
try {
|
||||
return this.partnerRangeService.createOrUpdatePartnerRange(data);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Delete('delete/:id')
|
||||
async deleteRange(@Param('id') id: number) {
|
||||
try {
|
||||
await this.partnerRangeService.deleteRange(id);
|
||||
return new ResultModel(true, 'Faixa de comissão excluída com sucesso!', null, null);
|
||||
}
|
||||
catch(error){
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user