Skip to content
This repository was archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
fix: fix legalPersonEntityDto im app layer
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielDeSouzza committed Jun 9, 2024
1 parent 0e08a3b commit 1696927
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/app/dtos/LegalPerson/LegalPersonEntityDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class LegalPersonEntityDto {
complement: update?.complement,
city: update?.city,
uf: update?.uf,
cep: update.cep,
cep: update?.cep,
first_phone: update?.first_phone,
second_phone: update?.second_phone,
third_phone: update?.third_phone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class CarrierCompanyUseCases {
created_by: null,
legalPersonId: null,
});
console.log(request);
const legalPerson = LegalPersonEntityDto.updateEntity(request.LegalPerson);

return this.carrierCompanyRepository.updateCarrierCompany(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class FreightExpenseUseCases {
return this.freightExpenseRepository.findAllFreightExpense(request);
}
async createFreightExpense(data: CreateFreightExpenseDTO) {
console.log(data);
if (data.legalClientOrderId && data.physicalCustomerOrderId)
throw new GraphQLError('SEND ONLY ORDER', {
extensions: { code: HttpStatus.BAD_REQUEST },
Expand Down
13 changes: 11 additions & 2 deletions src/app/useCases/LegalClientUseCases/LegalClientUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,20 @@ export class LegalClientUseCases {
created_by: data.created_by,
legal_person_id: data.legal_person_id,
});
const legalPerson = LegalPersonEntityDto.createEntity(data.LegalPerson);

if (data.LegalPerson) {
const legalPerson = LegalPersonEntityDto.createEntity(data.LegalPerson);

return this.legalClientRepository.createLegalClient(
legalClient,
legalPerson,
data.legal_person_id,
);
}

return this.legalClientRepository.createLegalClient(
legalClient,
legalPerson,
null,
data.legal_person_id,
);
}
Expand Down
5 changes: 4 additions & 1 deletion src/app/useCases/LegalPersonUseCases/LegalPersonUseCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ export class LegalPersonUseCases {
state_registration: data?.state_registration,
id: data?.id,
});
console.log(person);
if (person) {
let errors = '';

if (data.id == person.id) {
errors += 'EMPRESA JÁ CADASTRADA';
}

if (data.cnpj == person.cnpj) {
errors += 'CNPJ IN USE;';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ export class FreightExpense extends Entity {
fieldName: 'Expense Name',
maxLength: 80,
},
{
field: this.props.legalClientOrderId,
fieldName: 'Order Id',
maxLength: 1000,
isNullAble: true,
},
{
field: this.props.value,
fieldName: 'Value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class IncidentInput
date_incident: Date;
@Field()
@IsUUID()
@IsNotEmpty()
@IsNotEmpty({ message: 'O PROCESSAMENTO DE ID NÃO PODE SER VAZIO' })
order_process_id: string;
@Field(() => Date, { nullable: true })
@Field(() => Date)
Expand Down

0 comments on commit 1696927

Please sign in to comment.