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,96 +1,96 @@
|
||||
/*
|
||||
https://docs.nestjs.com/controllers#controllers
|
||||
*/
|
||||
|
||||
import { Body, Controller, Get, HttpException, HttpStatus, Param, Post, Query } from '@nestjs/common';
|
||||
import { CreatePaymentPartner } from 'src/domain/models/create-payment-partner.model';
|
||||
import { Partner } from 'src/domain/models/partner.model';
|
||||
import { PartnerService } from './partner.service';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('Partners')
|
||||
@Controller('api/v1/partners')
|
||||
export class PartnerController {
|
||||
|
||||
constructor(
|
||||
private readonly partnerService: PartnerService,
|
||||
) { }
|
||||
|
||||
@Get()
|
||||
getPartners(@Query() query) {
|
||||
let cpf: string = null;
|
||||
let name: string = null;
|
||||
try {
|
||||
const type = query['type'];
|
||||
if ( query['cpf'] != null ) {
|
||||
cpf = query['cpf'];
|
||||
}
|
||||
if ( query['name'] != null ) {
|
||||
name = query['name'];
|
||||
}
|
||||
|
||||
return this.partnerService.getPartners(type, cpf, name);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Get('payment')
|
||||
getPaymentPartner(@Query() query) {
|
||||
|
||||
try {
|
||||
const partnerId = query['partnerId'] as number;
|
||||
const type = query['type'];
|
||||
const month = query['month'];
|
||||
const year = query['year'];
|
||||
console.log("tipo parceiro: " + type);
|
||||
return this.partnerService.getPayment(partnerId, type, month, year);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Get(':cpf')
|
||||
getPartner(@Param('cpf') cpf: string) {
|
||||
try {
|
||||
return this.partnerService.getPartner(cpf);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Get('extract/:id')
|
||||
extractPartner(@Param('id') id: number, @Query() query) {
|
||||
const start = new Date(query.start);
|
||||
const end = new Date(query.end);
|
||||
return this.partnerService.getExtractPartner(id, start, end);
|
||||
}
|
||||
|
||||
|
||||
@Post('create')
|
||||
createPartner(@Body() data: Partner) {
|
||||
try {
|
||||
return this.partnerService.createOrUpdatePartner(data);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Post('paymentcreate')
|
||||
createPaymentPartner(@Body() data: CreatePaymentPartner[]) {
|
||||
console.log('criando payment');
|
||||
try {
|
||||
return this.partnerService.createPayment(data);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
https://docs.nestjs.com/controllers#controllers
|
||||
*/
|
||||
|
||||
import { Body, Controller, Get, HttpException, HttpStatus, Param, Post, Query } from '@nestjs/common';
|
||||
import { CreatePaymentPartner } from 'src/domain/models/create-payment-partner.model';
|
||||
import { Partner } from 'src/domain/models/partner.model';
|
||||
import { PartnerService } from './partner.service';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('Partners')
|
||||
@Controller('api/v1/partners')
|
||||
export class PartnerController {
|
||||
|
||||
constructor(
|
||||
private readonly partnerService: PartnerService,
|
||||
) { }
|
||||
|
||||
@Get()
|
||||
getPartners(@Query() query) {
|
||||
let cpf: string = null;
|
||||
let name: string = null;
|
||||
try {
|
||||
const type = query['type'];
|
||||
if ( query['cpf'] != null ) {
|
||||
cpf = query['cpf'];
|
||||
}
|
||||
if ( query['name'] != null ) {
|
||||
name = query['name'];
|
||||
}
|
||||
|
||||
return this.partnerService.getPartners(type, cpf, name);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Get('payment')
|
||||
getPaymentPartner(@Query() query) {
|
||||
|
||||
try {
|
||||
const partnerId = query['partnerId'] as number;
|
||||
const type = query['type'];
|
||||
const month = query['month'];
|
||||
const year = query['year'];
|
||||
console.log("tipo parceiro: " + type);
|
||||
return this.partnerService.getPayment(partnerId, type, month, year);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Get(':cpf')
|
||||
getPartner(@Param('cpf') cpf: string) {
|
||||
try {
|
||||
return this.partnerService.getPartner(cpf);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Get('extract/:id')
|
||||
extractPartner(@Param('id') id: number, @Query() query) {
|
||||
const start = new Date(query.start);
|
||||
const end = new Date(query.end);
|
||||
return this.partnerService.getExtractPartner(id, start, end);
|
||||
}
|
||||
|
||||
|
||||
@Post('create')
|
||||
createPartner(@Body() data: Partner) {
|
||||
try {
|
||||
return this.partnerService.createOrUpdatePartner(data);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Post('paymentcreate')
|
||||
createPaymentPartner(@Body() data: CreatePaymentPartner[]) {
|
||||
console.log('criando payment');
|
||||
try {
|
||||
return this.partnerService.createPayment(data);
|
||||
}
|
||||
catch (error) {
|
||||
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { PartnerService } from './partner.service';
|
||||
import { PartnerController } from './partner.controller';
|
||||
/*
|
||||
https://docs.nestjs.com/modules
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { CustomerService } from 'src/sales/customer/customer.service';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
],
|
||||
controllers: [
|
||||
PartnerController,],
|
||||
providers: [
|
||||
PartnerService,
|
||||
CustomerService],
|
||||
})
|
||||
export class PartnerModule { }
|
||||
import { PartnerService } from './partner.service';
|
||||
import { PartnerController } from './partner.controller';
|
||||
/*
|
||||
https://docs.nestjs.com/modules
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { CustomerService } from 'src/sales/customer/customer.service';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
],
|
||||
controllers: [
|
||||
PartnerController,],
|
||||
providers: [
|
||||
PartnerService,
|
||||
CustomerService],
|
||||
})
|
||||
export class PartnerModule { }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user