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

Commit

Permalink
feat: fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielDeSouzza committed Jun 26, 2024
1 parent 79b831e commit 0eb5bdf
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 19 deletions.
Binary file added OLC12603010
Binary file not shown.
Binary file added OR17010120
Binary file not shown.
6 changes: 3 additions & 3 deletions prisma/dbml/schema.dbml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Table vehicles {
Model vehicle_models [not null]
model_id String [not null]
OutsourcedTransportVehicle outsourced_transport_vehicle
OrderProcessing order_procesing
OrderProcessing order_procesing [not null]
}

Table vehicle_models {
Expand Down Expand Up @@ -647,7 +647,7 @@ Table ciots_for_legal_clients {
Table order_procesing {
id String [pk]
order_processing_number String [unique, not null]
vehicle_id String [unique, not null]
vehicle_id String [not null]
Vehicle vehicles [not null]
total_distance Float [not null]
total_spend_liters Float [not null]
Expand Down Expand Up @@ -950,7 +950,7 @@ Ref: ciots_for_legal_clients.created_by > users.id

Ref: ciots_for_legal_clients.updated_by > users.id

Ref: order_procesing.vehicle_id - vehicles.id
Ref: order_procesing.vehicle_id > vehicles.id

Ref: order_procesing.driver_id > own_drivers.id

Expand Down
2 changes: 2 additions & 0 deletions prisma/migrations/20240626002918_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX "order_procesing_vehicle_id_key";
4 changes: 2 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ model Vehicle {
Model VehicleModel @relation(fields: [model_id], references: [id])
model_id String
OutsourcedTransportVehicle OutsourcedTransportVehicle?
OrderProcessing OrderProcessing?
OrderProcessing OrderProcessing[]
@@map("vehicles")
}
Expand Down Expand Up @@ -748,7 +748,7 @@ model CiotForLegalClient {
model OrderProcessing {
id String @id @default(uuid())
order_processing_number String @unique
vehicle_id String @unique
vehicle_id String
Vehicle Vehicle @relation(fields: [vehicle_id], references: [id])
total_distance Float
total_spend_liters Float
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ export class CompanyVehicleUseCases {
extensions: { code: HttpStatus.CONFLICT },
});

const vehicleEntity = VehicleEntityDTO.createEntity(data.Vehicle);
const vehicleEntity = data.Vehicle
? VehicleEntityDTO.createEntity(data.Vehicle)
: undefined;
const companyVehicleEntity = new CompanyVehicle({
carrier_company_id: data.carrier_company_id,
created_by: data.created_by,
updated_by: data.updated_by,
vehicle_id: vehicleEntity.id,
vehicle_id: vehicleEntity?.id,
});

return await this.companyVehicleRepository.createCompanyVehicle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export class OrderProcessingUseCases {
await this.orderProcessingResitory.findOrderProcessing({
vehicleData: { vehicleId: data.vehicle_id },
});
if (orderProcesingExist)
console.log(orderProcesingExist);
if (orderProcesingExist && orderProcesingExist.status != 'COMPLETE')
throw new GraphQLError('VEHICLE ALREADY IN USE IN AN ORDER PROCESSING ', {
extensions: { code: HttpStatus.CONFLICT },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ export class PhysicalCustomer extends Entity {
maxLength: 80,
isNullAble: true,
},
{
field: this.props.natural_person_id,
fieldName: 'Natural Person ID',
maxLength: 200,
},
{
field: this.props.created_by,
fieldName: 'Created By',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export class CarrierCompanyPrismaService implements CarrierCompanyRepository {
],
},
});
console.log(carrierCompany);

return CarrierCompanyPrismaDTO.PrismaToEntity(carrierCompany);
}
Expand Down Expand Up @@ -185,6 +184,7 @@ export class CarrierCompanyPrismaService implements CarrierCompanyRepository {
),
where: { id },
});
console.log('SSSSS', carriercompanyPrisma);

return CarrierCompanyPrismaDTO.PrismaToEntity(carriercompanyPrisma);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class VehicleTypeResolver {

@Query(() => VehicleTypeModel)
async getVehicleType(@Args() request: GetVehicleTypeArgs) {
console.log(request);

return this.vehicleTypeUseCase.getVehicleType(request);
}

Expand Down
4 changes: 2 additions & 2 deletions src/infra/graphql/generated/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -3948,7 +3948,7 @@ input VehicleOrderByWithRelationInput {
CompanyVehicle: CompanyVehicleOrderByWithRelationInput
Maintenance: MaintenanceOrderByRelationAggregateInput
Model: VehicleModelOrderByWithRelationInput
OrderProcessing: OrderProcessingOrderByWithRelationInput
OrderProcessing: OrderProcessingOrderByRelationAggregateInput
OutsourcedTransportVehicle: OutsourcedTransportVehicleOrderByWithRelationInput
OutsourcedVehicle: OutsourcedVehicleOrderByWithRelationInput
antt: SortOrder
Expand Down Expand Up @@ -4056,7 +4056,7 @@ input VehicleWhereInput {
Model: VehicleModelWhereInput
NOT: [VehicleWhereInput!]
OR: [VehicleWhereInput!]
OrderProcessing: OrderProcessingWhereInput
OrderProcessing: OrderProcessingListRelationFilter
OutsourcedTransportVehicle: OutsourcedTransportVehicleWhereInput
OutsourcedVehicle: OutsourcedVehicleWhereInput
antt: StringFilter
Expand Down
6 changes: 3 additions & 3 deletions src/infra/services/generatePdf/templates/test.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ img{
</td>

</tr>
<tr style="width: 50%; font-size: 0.4rem; vertical-align: top;">
<tr style="width: 50%; font-size: 10px; vertical-align: top;">
<td colspan="2" rowspan="4" style="height: 100px; ">
<% orderData.expenses.forEach(expense=> { %>
<span style="margin: 1px;">
Expand All @@ -351,7 +351,7 @@ img{
</td>

</tr>
<tr style="width: 50%; font-size: 0.4rem;">
<tr style="width: 50%; font-size: 10px;">
<td colspan="2" rowspan="1" style="height: 40px;vertical-align: top;">
<span style="float: left;"> PROD PREDOMIN </span>
<span style="float: right;">
Expand Down Expand Up @@ -389,7 +389,7 @@ img{
</td>

</tr>
<tr style="font-size: 0.4rem;">
<tr style="font-size: 10px;">
<td colspan="2" rowspan="1" style="height: 40px; vertical-align: top;">
<span> SITUAÇÃO TRIBUTARIA</span>
<br>
Expand Down

0 comments on commit 0eb5bdf

Please sign in to comment.