From 703475a26344be488dea2e50c02ad9c9f48dd624 Mon Sep 17 00:00:00 2001 From: GabrieldeSouzza Date: Fri, 17 May 2024 22:38:04 -0300 Subject: [PATCH] feat: change entities to generate CTE correctly --- .eslintrc.json | 121 +- dump.sql | 3145 ++--------------- prisma/dbml/schema.dbml | 69 +- .../20230609171326_init/migration.sql | 11 - .../migrations/20230820000102_/migration.sql | 646 ---- .../migration.sql | 182 - .../migration.sql | 2 - .../migrations/20230912201735_/migration.sql | 2 - .../migrations/20231007214630_/migration.sql | 16 - .../migrations/20231008140047_/migration.sql | 244 -- .../migrations/20231012185010_/migration.sql | 8 - .../migrations/20231017214516_/migration.sql | 20 - .../migrations/20231018232059_/migration.sql | 20 - .../migrations/20231022201723_/migration.sql | 40 - .../migrations/20231024233540_/migration.sql | 9 - .../migrations/20231025213429_/migration.sql | 12 - .../migrations/20231102204736_/migration.sql | 474 --- .../migrations/20231123223551_/migration.sql | 7 - .../migrations/20231128233242_/migration.sql | 37 - .../migrations/20231204231759_/migration.sql | 11 - .../migrations/20231206210538_/migration.sql | 2 - .../migrations/20231207223816_/migration.sql | 131 - .../migrations/20231212223708_/migration.sql | 29 - .../migrations/20240103223054_/migration.sql | 30 - .../migrations/20240123214447_/migration.sql | 12 - .../migrations/20240123232954_/migration.sql | 12 - .../migrations/20240207230346_/migration.sql | 46 - .../migrations/20240213144500_/migration.sql | 23 - .../migration.sql | 12 - .../migration.sql | 10 - .../migration.sql | 10 - .../migrations/20240307215512_/migration.sql | 34 - .../migration.sql | 16 - .../migrations/20240307224431_/migration.sql | 11 - .../migrations/20240309010946_/migration.sql | 12 - .../migration.sql | 2 - .../migrations/20240309233038_/migration.sql | 160 - .../migrations/20240312203959_/migration.sql | 60 - .../migrations/20240314203951_/migration.sql | 65 - .../migrations/20240317150314_/migration.sql | 67 - .../migrations/20240317181959_/migration.sql | 2 - .../migrations/20240317183039_/migration.sql | 12 - .../migrations/20240320210539_/migration.sql | 148 - .../migrations/20240320211615_/migration.sql | 2 - .../migrations/20240322230238_/migration.sql | 227 -- .../migrations/20240328213005_/migration.sql | 16 - .../migrations/20240401215129_/migration.sql | 18 - .../migrations/20240405223110_/migration.sql | 16 - .../migrations/20240406132931_/migration.sql | 36 - .../migrations/20240406135042_/migration.sql | 5 - .../migrations/20240406153248_/migration.sql | 27 - .../migration.sql | 26 - .../migrations/20240502203157_/migration.sql | 1075 ++++++ .../migration.sql | 56 + .../migrations/20240509223512_/migration.sql | 32 + .../migrations/20240513230541_/migration.sql | 41 + prisma/schema.prisma | 149 +- .../CreateLegalClientOrderDto.ts | 14 +- .../UpdateLegalClientOrderDto.ts | 6 + .../UpdateManyLegalClientOrderDto.ts | 6 + .../CreateLegalClientQuoteTableDto.ts | 10 +- .../UpdateLegalClientQuoteTableDto.ts | 10 +- .../UpdateManyLegalClientQuoteTableDto.ts | 10 +- .../CreatePhysicalCustomerOrderDto.ts | 6 +- .../UpdateManyPhysicalCustomerOrderDto.ts | 6 + .../UpdatePhysicalCustomerOrderDto.ts | 6 + .../CreatePhysicalCustomerQuoteTableDto.ts | 11 +- .../UpdatePhysicalCustomerQuoteTableDto.ts | 11 +- src/app/useCases/CtePdf/CtePdfUseCase.ts | 51 +- .../FreightExpenseUseCases.ts | 4 +- .../IncidentUseCases/IncidentUseCases.ts | 8 +- .../LegalClientOrderUseCases.ts | 13 + .../LegalClientQuoteTable.ts | 24 +- .../PhysicalCustomerOrderUseCases.ts | 12 + .../PhysicalCustomerQuoteTable.ts | 16 +- .../PhysicalCustomerUseCases.ts | 6 +- .../dto/providers/CepSearchProviderDto.ts | 8 + .../whereDtos/FreightExpenseRepository.Dto.ts | 29 +- .../FreightIncidentRepository.Dto.ts | 39 +- .../Cte Entities/CtePdfEntity/CtePdf.spec.ts | 75 - .../Cte Entities/CtePdfEntity/CtePdf.ts | 68 - .../CtePdfLegalClient.spec.ts | 163 + .../CtePdfLegalClient/CtePdfLegalClient.ts | 100 + .../CtePdfPhysicalCustomer.spec.ts | 166 + .../CtePdfPhysicalCustomer.ts | 100 + .../LegalClientOrder/LegaClientOrder.ts | 102 + .../PhysicalCustomerOrder.ts | 98 + .../entities/QuoteTables/AdressesType.ts | 10 + .../LegalClientQuoteTable.spec.ts | 24 +- .../LegalClientQuoteTable.ts | 75 +- .../PhysicalCustomerQuoteTable.spec.ts | 24 +- .../PhysicalCustomerQuoteTable.ts | 73 +- src/domain/providers/CepSearchProvider.ts | 5 + src/domain/repositories/CtePdfRepository.ts | 11 +- .../repositories/FreightExpenseResitory.ts | 4 +- src/domain/repositories/IncidentResitory.ts | 10 +- src/domain/shared/taxes/taxes.ts | 2 + .../prisma/services/CtePdf.service.ts | 255 +- .../prisma/services/FreightExpense.service.ts | 4 +- .../prisma/services/Incident.service.ts | 8 +- .../services/LegalClientOrder.service.ts | 88 +- .../services/LegalClientQuoteTable.service.ts | 35 +- .../services/PhysicalCustomerOrder.service.ts | 97 +- .../PhysicalCustomerQuoteTable.service.ts | 12 + .../services/prismaDTO/AdressPrismaDto.ts | 18 + .../prismaDTO/LegalClientOrderPrismaDto.ts | 46 +- .../LegalClientQuoteTablePrismaDto.ts | 126 +- .../PhysicalCustomerOrderPrismaDto.ts | 43 +- .../prismaDTO/PhysicalCustomerPrismaDto.ts | 67 +- .../PhysicalCustomerQuoteTablePrismaDto.ts | 149 +- .../AdressesGraphql/Adresses.input.ts | 21 + .../AdressesGraphql/Adresses.model.ts | 23 + .../FreightExpense.input.ts | 22 + .../FreightExpense.model.ts | 10 + .../FreightExpense.resolver.ts | 7 +- .../GenerateCtePdfGraphql/CtePdf.input.ts | 4 +- .../GenerateCtePdfGraphql/CtePdf.resolver.ts | 4 +- .../LegalClientOrder.input.ts | 50 +- .../LegalClientOrder.model.ts | 28 +- .../LegalClientOrder.resolver.ts | 7 - .../LegalClientQuoteTable.input.ts | 44 +- .../LegalClientQuoteTable.model.ts | 29 +- .../LegalClientQuoteTable.module.ts | 3 +- .../LegalClientQuoteTable.resolver.ts | 7 + .../PhysicalCustomerOrder.input.ts | 38 +- .../PhysicalCustomerOrder.model.ts | 14 +- .../PhysicalCustomerOrder.resolver.ts | 7 - .../PhysicalCustomerQuoteTable.input.ts | 38 +- .../PhysicalCustomerQuoteTable.model.ts | 27 +- .../PhysicalCustomerQuoteTable.module.ts | 3 +- .../PhysicalCustomerQuoteTable.resolver.ts | 7 + src/infra/graphql/generated/schema.gql | 238 +- src/infra/guard/auth.resolver.ts | 2 +- .../services/generatePdf/GenerateCtePdf.ts | 14 +- .../generatePdf/GeneratePdfCteModule.ts | 8 +- .../services/generatePdf/templates/test.ejs | 358 +- src/infra/services/services.module.ts | 5 +- .../services/viaCep/provider/ViaCepService.ts | 40 + 138 files changed, 4594 insertions(+), 6536 deletions(-) delete mode 100644 prisma/migrations/20230609171326_init/migration.sql delete mode 100644 prisma/migrations/20230820000102_/migration.sql delete mode 100644 prisma/migrations/20230828010254_updated_relations_and_add_colum_updated_by_in_fields/migration.sql delete mode 100644 prisma/migrations/20230910004900_add_collum_capaciy_per_axle_in_vehicle_model/migration.sql delete mode 100644 prisma/migrations/20230912201735_/migration.sql delete mode 100644 prisma/migrations/20231007214630_/migration.sql delete mode 100644 prisma/migrations/20231008140047_/migration.sql delete mode 100644 prisma/migrations/20231012185010_/migration.sql delete mode 100644 prisma/migrations/20231017214516_/migration.sql delete mode 100644 prisma/migrations/20231018232059_/migration.sql delete mode 100644 prisma/migrations/20231022201723_/migration.sql delete mode 100644 prisma/migrations/20231024233540_/migration.sql delete mode 100644 prisma/migrations/20231025213429_/migration.sql delete mode 100644 prisma/migrations/20231102204736_/migration.sql delete mode 100644 prisma/migrations/20231123223551_/migration.sql delete mode 100644 prisma/migrations/20231128233242_/migration.sql delete mode 100644 prisma/migrations/20231204231759_/migration.sql delete mode 100644 prisma/migrations/20231206210538_/migration.sql delete mode 100644 prisma/migrations/20231207223816_/migration.sql delete mode 100644 prisma/migrations/20231212223708_/migration.sql delete mode 100644 prisma/migrations/20240103223054_/migration.sql delete mode 100644 prisma/migrations/20240123214447_/migration.sql delete mode 100644 prisma/migrations/20240123232954_/migration.sql delete mode 100644 prisma/migrations/20240207230346_/migration.sql delete mode 100644 prisma/migrations/20240213144500_/migration.sql delete mode 100644 prisma/migrations/20240306003738_add_rntc_field_in_carrier_company_table/migration.sql delete mode 100644 prisma/migrations/20240306202547_change_field_rntrc_expiration_for_antt_in_vehicle_table/migration.sql delete mode 100644 prisma/migrations/20240306205703_add_field_registration_and_is_ipva_paid_in_vehicle/migration.sql delete mode 100644 prisma/migrations/20240307215512_/migration.sql delete mode 100644 prisma/migrations/20240307215818_ajust_physical_customer_order_name_physical_merchandise/migration.sql delete mode 100644 prisma/migrations/20240307224431_/migration.sql delete mode 100644 prisma/migrations/20240309010946_/migration.sql delete mode 100644 prisma/migrations/20240309023509_alter_user_add_avatar_url/migration.sql delete mode 100644 prisma/migrations/20240309233038_/migration.sql delete mode 100644 prisma/migrations/20240312203959_/migration.sql delete mode 100644 prisma/migrations/20240314203951_/migration.sql delete mode 100644 prisma/migrations/20240317150314_/migration.sql delete mode 100644 prisma/migrations/20240317181959_/migration.sql delete mode 100644 prisma/migrations/20240317183039_/migration.sql delete mode 100644 prisma/migrations/20240320210539_/migration.sql delete mode 100644 prisma/migrations/20240320211615_/migration.sql delete mode 100644 prisma/migrations/20240322230238_/migration.sql delete mode 100644 prisma/migrations/20240328213005_/migration.sql delete mode 100644 prisma/migrations/20240401215129_/migration.sql delete mode 100644 prisma/migrations/20240405223110_/migration.sql delete mode 100644 prisma/migrations/20240406132931_/migration.sql delete mode 100644 prisma/migrations/20240406135042_/migration.sql delete mode 100644 prisma/migrations/20240406153248_/migration.sql delete mode 100644 prisma/migrations/20240423224132_add_status_in_order_processing_entity/migration.sql create mode 100644 prisma/migrations/20240502203157_/migration.sql create mode 100644 prisma/migrations/20240505191636_add_table_adress_for_using_in_quote_tables/migration.sql create mode 100644 prisma/migrations/20240509223512_/migration.sql create mode 100644 prisma/migrations/20240513230541_/migration.sql create mode 100644 src/domain/dto/providers/CepSearchProviderDto.ts delete mode 100644 src/domain/entities/Cte Entities/CtePdfEntity/CtePdf.spec.ts delete mode 100644 src/domain/entities/Cte Entities/CtePdfEntity/CtePdf.ts create mode 100644 src/domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient.spec.ts create mode 100644 src/domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient.ts create mode 100644 src/domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer.spec.ts create mode 100644 src/domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer.ts create mode 100644 src/domain/entities/QuoteTables/AdressesType.ts create mode 100644 src/domain/providers/CepSearchProvider.ts create mode 100644 src/domain/shared/taxes/taxes.ts create mode 100644 src/infra/database/prisma/services/prismaDTO/AdressPrismaDto.ts create mode 100644 src/infra/graphql/entities/AdressesGraphql/Adresses.input.ts create mode 100644 src/infra/graphql/entities/AdressesGraphql/Adresses.model.ts create mode 100644 src/infra/services/viaCep/provider/ViaCepService.ts diff --git a/.eslintrc.json b/.eslintrc.json index 79aa43e3..a41aee11 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,10 +12,7 @@ "import/resolver": { "typescript": {}, "node": { - "extensions": [ - ".js", - ".ts" - ] + "extensions": [".js", ".ts"] } } }, @@ -23,9 +20,7 @@ "parserOptions": { "ecmaVersion": 13, "sourceType": "module", - "project": [ - "./tsconfig.eslint.json" - ] + "project": ["./tsconfig.eslint.json"] }, "extends": [ "prettier", @@ -49,18 +44,14 @@ ], "overrides": [ { - "files": [ - "main.ts" - ], + "files": ["main.ts"], "rules": { "unicorn/prefer-top-level-await": "off", "@typescript-eslint/no-floating-promises": "off" } }, { - "files": [ - "prisma.service.ts" - ], + "files": ["prisma.service.ts"], "rules": { "@typescript-eslint/no-unsafe-call": "off", "@typescript-eslint/require-await": "off", @@ -68,26 +59,19 @@ } }, { - "files": [ - "test/**" - ], + "files": ["test/**"], "rules": { "jest/expect-expect": "off" } }, { - "files": [ - "jest.config.ts", - "commitlint.config.ts" - ], + "files": ["jest.config.ts", "commitlint.config.ts"], "rules": { "import/no-default-export": "off" } }, { - "files": [ - "**.js" - ], + "files": ["**.js"], "rules": { "no-undef": "off", "unicorn/prefer-module": "off", @@ -95,12 +79,7 @@ } }, { - "files": [ - "spec.ts", - "spec.tsx", - "test.ts", - "test.tsx" - ], + "files": ["spec.ts", "spec.tsx", "test.ts", "test.tsx"], "rules": { "unicorn/prefer-module": "off", "@typescript-eslint/no-var-requires": "off" @@ -113,9 +92,7 @@ } }, { - "files": [ - "**.d.ts" - ], + "files": ["**.d.ts"], "rules": { "@typescript-eslint/naming-convention": "off", "@typescript-eslint/no-empty-interface": "off", @@ -128,26 +105,20 @@ } }, { - "files": [ - "src/helpers/*" - ], + "files": ["src/helpers/*"], "rules": { "@typescript-eslint/naming-convention": "off" } }, { - "files": [ - "src/dtos/*" - ], + "files": ["src/dtos/*"], "rules": { "unicorn/filename-case": "off", "@typescript-eslint/naming-convention": [ "error", { "selector": "interface", - "format": [ - "PascalCase" - ], + "format": ["PascalCase"], "custom": { "regex": "[A-Z]*DTO$", "match": true @@ -155,9 +126,7 @@ }, { "selector": "typeAlias", - "format": [ - "PascalCase" - ], + "format": ["PascalCase"], "custom": { "regex": "[A-Z]*DTO$", "match": true @@ -168,6 +137,7 @@ } ], "rules": { + "unicorn/prefer-math-trunc": "off", "prettier/prettier": "error", "jest/valid-expect": "error", "jest/no-focused-tests": "error", @@ -187,28 +157,16 @@ "@darraghor/nestjs-typed/injectable-should-be-provided": "off", "@typescript-eslint/no-unsafe-call": "off", "@darraghor/nestjs-typed/should-specify-forbid-unknown-values": "off", - "quote-props": [ - "error", - "consistent-as-needed" - ], - "arrow-body-style": [ - "error", - "as-needed" - ], + "quote-props": ["error", "consistent-as-needed"], + "arrow-body-style": ["error", "as-needed"], "import/no-duplicates": [ "error", { "prefer-inline": true } ], - "import/consistent-type-specifier-style": [ - "error", - "prefer-inline" - ], - "@typescript-eslint/consistent-type-definitions": [ - "error", - "interface" - ], + "import/consistent-type-specifier-style": ["error", "prefer-inline"], + "@typescript-eslint/consistent-type-definitions": ["error", "interface"], "import/no-extraneous-dependencies": [ "error", { @@ -291,12 +249,7 @@ "error", { "selector": "default", - "format": [ - "camelCase", - "PascalCase", - "snake_case", - "UPPER_CASE" - ], + "format": ["camelCase", "PascalCase", "snake_case", "UPPER_CASE"], "filter": { "regex": "^_.*$", "match": false @@ -304,16 +257,11 @@ }, { "selector": "variable", - "format": [ - "camelCase", - "UPPER_CASE" - ] + "format": ["camelCase", "UPPER_CASE"] }, { "selector": "interface", - "format": [ - "PascalCase" - ], + "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": true @@ -321,9 +269,7 @@ }, { "selector": "typeAlias", - "format": [ - "PascalCase" - ], + "format": ["PascalCase"], "custom": { "regex": "[A-Z]*Props$", "match": true @@ -331,20 +277,9 @@ }, { "selector": "variable", - "types": [ - "boolean" - ], - "format": [ - "PascalCase" - ], - "prefix": [ - "is", - "should", - "has", - "can", - "did", - "will" - ] + "types": ["boolean"], + "format": ["PascalCase"], + "prefix": ["is", "should", "has", "can", "did", "will"] } ], "import/extensions": [ @@ -377,11 +312,7 @@ "/^utils/", "/^constants/", "/^styles/", - [ - "parent", - "sibling", - "index" - ] + ["parent", "sibling", "index"] ], "alphabetize": { "order": "asc", diff --git a/dump.sql b/dump.sql index 223e3d4b..20987f1d 100644 --- a/dump.sql +++ b/dump.sql @@ -1,2954 +1,581 @@ --- --- PostgreSQL database dump --- - --- Dumped from database version 16.2 (Debian 16.2-1.pgdg120+2) --- Dumped by pg_dump version 16.2 (Debian 16.2-1.pgdg120+2) - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- Name: public; Type: SCHEMA; Schema: -; Owner: admin --- - --- *not* creating schema, since initdb creates it - - -ALTER SCHEMA public OWNER TO admin; - --- --- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: admin --- - -COMMENT ON SCHEMA public IS ''; - - -SET default_tablespace = ''; - -SET default_table_access_method = heap; - --- --- Name: Incident; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public."Incident" ( - id text NOT NULL, - description text NOT NULL, - date_incident timestamp(3) without time zone NOT NULL, - order_process_id text NOT NULL, - date_resolved timestamp(3) without time zone, - created_by text NOT NULL, - updated_by text NOT NULL, - created_at timestamp(3) without time zone NOT NULL, - updated_at timestamp(3) without time zone NOT NULL -); - - -ALTER TABLE public."Incident" OWNER TO admin; - --- --- Name: OutsourcedTransportCompany; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public."OutsourcedTransportCompany" ( - id text NOT NULL, - legal_person_id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public."OutsourcedTransportCompany" OWNER TO admin; - --- --- Name: OutsourcedTransportCompanyContract; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public."OutsourcedTransportCompanyContract" ( - id text NOT NULL, - outsourced_transport_company_id text NOT NULL, - carrier_company_id text NOT NULL, - legal_client_order_id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_by text NOT NULL, - contract_number text NOT NULL -); - - -ALTER TABLE public."OutsourcedTransportCompanyContract" OWNER TO admin; - --- --- Name: _VehicleBodyworkToVehicleType; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public."_VehicleBodyworkToVehicleType" ( - "A" text NOT NULL, - "B" text NOT NULL -); - - -ALTER TABLE public."_VehicleBodyworkToVehicleType" OWNER TO admin; - --- --- Name: _prisma_migrations; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public._prisma_migrations ( - id character varying(36) NOT NULL, - checksum character varying(64) NOT NULL, - finished_at timestamp with time zone, - migration_name character varying(255) NOT NULL, - logs text, - rolled_back_at timestamp with time zone, - started_at timestamp with time zone DEFAULT now() NOT NULL, - applied_steps_count integer DEFAULT 0 NOT NULL -); - - -ALTER TABLE public._prisma_migrations OWNER TO admin; - --- --- Name: carrier_companies; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.carrier_companies ( - id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - legal_person_id text NOT NULL, - rntrc text NOT NULL -); - - -ALTER TABLE public.carrier_companies OWNER TO admin; - --- --- Name: ciots_for_legal_clients; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.ciots_for_legal_clients ( - id text NOT NULL, - ciot text NOT NULL, - emission_date timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - legal_contract_id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.ciots_for_legal_clients OWNER TO admin; - --- --- Name: company_vehicles; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.company_vehicles ( - id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - vehicle_id text NOT NULL, - updated_by text NOT NULL, - company_id text NOT NULL, - "orderProcessingLegalClientId" text -); - - -ALTER TABLE public.company_vehicles OWNER TO admin; - --- --- Name: completed_orders; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.completed_orders ( - id text NOT NULL, - order_processing_number text NOT NULL, - vehicle_id text NOT NULL, - total_distance double precision NOT NULL, - total_spend_liters double precision NOT NULL, - total_spending_money double precision NOT NULL, - start_at timestamp(3) without time zone NOT NULL, - end_at timestamp(3) without time zone NOT NULL, - updated_at timestamp(3) without time zone NOT NULL, - created_at timestamp(3) without time zone NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.completed_orders OWNER TO admin; - --- --- Name: contract_outsourced_drivers; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.contract_outsourced_drivers ( - id text NOT NULL, - type text NOT NULL, - situation text NOT NULL, - start_at timestamp(3) without time zone NOT NULL, - end_at timestamp(3) without time zone, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - cpf text NOT NULL, - updated_by text NOT NULL, - outsourced_driver_id text NOT NULL, - contract_number text NOT NULL -); - - -ALTER TABLE public.contract_outsourced_drivers OWNER TO admin; - --- --- Name: freight_expenses; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.freight_expenses ( - id text NOT NULL, - expense_name text NOT NULL, - value double precision NOT NULL, - legal_client_order_id text, - physical_customer_id text -); - - -ALTER TABLE public.freight_expenses OWNER TO admin; - --- --- Name: icms; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.icms ( - id text NOT NULL, - state_orgin text NOT NULL, - recipient_state text NOT NULL, - aliquot double precision NOT NULL, - effective_date timestamp(3) without time zone NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.icms OWNER TO admin; - --- --- Name: legal_Contracts; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public."legal_Contracts" ( - id text NOT NULL, - legal_client_id text NOT NULL, - carrier_company_id text NOT NULL, - contract_number text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - delivery_conditions character varying(500) NOT NULL, - effective_date timestamp(3) without time zone NOT NULL, - observations character varying(500), - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public."legal_Contracts" OWNER TO admin; - --- --- Name: legal_client_cte; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.legal_client_cte ( - id text NOT NULL, - order_id text NOT NULL, - access_key text NOT NULL, - type_cte text NOT NULL, - observations text NOT NULL, - cte_number text NOT NULL -); - - -ALTER TABLE public.legal_client_cte OWNER TO admin; - --- --- Name: legal_client_quote; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.legal_client_quote ( - id text NOT NULL, - cod_quote text NOT NULL, - recipient_id text NOT NULL, - sender_id text NOT NULL, - who_pays text NOT NULL, - postal_cod_origin text NOT NULL, - postal_cod_destiny text NOT NULL, - type_merchandise text NOT NULL, - amount integer NOT NULL, - description text NOT NULL, - mass double precision NOT NULL, - volume double precision NOT NULL, - nf_value double precision NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.legal_client_quote OWNER TO admin; - --- --- Name: legal_clients; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.legal_clients ( - id text NOT NULL, - branch text NOT NULL, - legal_person_id text NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.legal_clients OWNER TO admin; - --- --- Name: legal_orders; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.legal_orders ( - id text NOT NULL, - "order" text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - legal_contract_id text NOT NULL, - order_processing_id text, - completed_orders_id text, - quote_table_id text NOT NULL, - carrier_id text NOT NULL -); - - -ALTER TABLE public.legal_orders OWNER TO admin; - --- --- Name: legal_people; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.legal_people ( - id text NOT NULL, - fantasy_name text NOT NULL, - cnpj text NOT NULL, - state_registration text NOT NULL, - corporate_name text NOT NULL, - public_place text NOT NULL, - address_number text NOT NULL, - neighborhood text NOT NULL, - complement text, - city text NOT NULL, - uf text NOT NULL, - first_phone text NOT NULL, - second_phone text, - third_phone text, - email text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); - - -ALTER TABLE public.legal_people OWNER TO admin; - --- --- Name: maintenance; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.maintenance ( - id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_by text NOT NULL, - maintenance_company_id text NOT NULL, - finished_at timestamp(3) without time zone, - type_of_maintenance_id text NOT NULL, - vehicle_id text NOT NULL -); - - -ALTER TABLE public.maintenance OWNER TO admin; - --- --- Name: maintenance_companies; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.maintenance_companies ( - id text NOT NULL, - specialty_maintenance text, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_by text NOT NULL, - legal_person_id text NOT NULL -); - - -ALTER TABLE public.maintenance_companies OWNER TO admin; - --- --- Name: natural_people; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.natural_people ( - id text NOT NULL, - name text NOT NULL, - date_birth timestamp(3) without time zone NOT NULL, - gender text NOT NULL, - cpf text NOT NULL, - rg text NOT NULL, - cep text NOT NULL, - public_place text NOT NULL, - address_number text NOT NULL, - neighborhood text NOT NULL, - complement text, - city text NOT NULL, - uf text NOT NULL, - first_phone text NOT NULL, - second_phone text, - third_phone text, - email text NOT NULL, - nationality text NOT NULL -); - - -ALTER TABLE public.natural_people OWNER TO admin; - --- --- Name: order_procesing; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.order_procesing ( - id text NOT NULL, - order_processing_number text NOT NULL, - vehicle_id text NOT NULL, - total_distance double precision NOT NULL, - total_spend_liters double precision NOT NULL, - total_spending_money double precision NOT NULL, - start_at timestamp(3) without time zone NOT NULL, - end_at timestamp(3) without time zone, - updated_at timestamp(3) without time zone NOT NULL, - created_at timestamp(3) without time zone NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - status text DEFAULT 'created'::text NOT NULL -); - - -ALTER TABLE public.order_procesing OWNER TO admin; - --- --- Name: outsourcedT_transport_company_driver; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public."outsourcedT_transport_company_driver" ( - id text NOT NULL, - cnh text NOT NULL, - cnh_expiration timestamp(3) without time zone NOT NULL, - course_mopp boolean DEFAULT false NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - natural_person_id text NOT NULL, - outsourced_transport_company_id text NOT NULL, - cnh_category text NOT NULL -); - - -ALTER TABLE public."outsourcedT_transport_company_driver" OWNER TO admin; - --- --- Name: outsourced_drivers; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.outsourced_drivers ( - id text NOT NULL, - cnh text NOT NULL, - cnh_expiration timestamp(3) without time zone NOT NULL, - course_mopp boolean DEFAULT false NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - outsourced_vehicle_id text, - updated_by text NOT NULL, - natural_person_id text NOT NULL, - cnh_category text NOT NULL, - company_vehicle_id text -); - - -ALTER TABLE public.outsourced_drivers OWNER TO admin; - --- --- Name: outsourced_transport_vehicle; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.outsourced_transport_vehicle ( - id text NOT NULL, - outsourced_company_id text NOT NULL, - vehicle_id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.outsourced_transport_vehicle OWNER TO admin; - --- --- Name: outsourced_vehicles; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.outsourced_vehicles ( - id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - vehicle_id text NOT NULL, - order_processing_id text, - updated_by text NOT NULL, - "orderProcessingLegalClientId" text -); - - -ALTER TABLE public.outsourced_vehicles OWNER TO admin; - --- --- Name: own_drivers; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.own_drivers ( - id text NOT NULL, - cnh text NOT NULL, - cnh_expiration timestamp(3) without time zone NOT NULL, - company_vehicle boolean DEFAULT false NOT NULL, - course_mopp boolean DEFAULT false NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL, - natural_person_id text NOT NULL, - cnh_category text NOT NULL -); - - -ALTER TABLE public.own_drivers OWNER TO admin; - --- --- Name: physical_customer_cte; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.physical_customer_cte ( - id text NOT NULL, - order_id text NOT NULL, - access_key text NOT NULL, - type_cte text NOT NULL, - observations text NOT NULL, - cte_number text NOT NULL -); - - -ALTER TABLE public.physical_customer_cte OWNER TO admin; - --- --- Name: physical_customer_quote; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.physical_customer_quote ( - id text NOT NULL, - cod_quote text NOT NULL, - recipient_id text NOT NULL, - "senderId" text NOT NULL, - who_pays text NOT NULL, - postal_cod_origin text NOT NULL, - postal_cod_destiny text NOT NULL, - type_merchandise text NOT NULL, - amount integer NOT NULL, - description text NOT NULL, - mass double precision NOT NULL, - volume double precision NOT NULL, - nf_value double precision NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.physical_customer_quote OWNER TO admin; - --- --- Name: physical_customers; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.physical_customers ( - id text NOT NULL, - branch text, - created_by text NOT NULL, - updated_by text NOT NULL, - natural_person_id text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL -); - - -ALTER TABLE public.physical_customers OWNER TO admin; - --- --- Name: physical_orders; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.physical_orders ( - id text NOT NULL, - "order" text NOT NULL, - updated_by text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - physical_customer_id text NOT NULL, - "completedOrdersId" text, - order_processing_id text, - quote_table_id text NOT NULL, - carrier_id text NOT NULL -); - - -ALTER TABLE public.physical_orders OWNER TO admin; - --- --- Name: recipient; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.recipient ( - id text NOT NULL, - legal_person_id text, - natural_person_id text, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.recipient OWNER TO admin; - --- --- Name: sender; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.sender ( - id text NOT NULL, - legal_person_id text, - natural_person_id text, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.sender OWNER TO admin; - --- --- Name: types_of_maintenances; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.types_of_maintenances ( - id text NOT NULL, - description text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_by text NOT NULL, - "typeMaintenance" text NOT NULL -); - - -ALTER TABLE public.types_of_maintenances OWNER TO admin; - --- --- Name: users; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.users ( - id text NOT NULL, - name text NOT NULL, - username text NOT NULL, - email text NOT NULL, - password text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - role text NOT NULL, - avatar_url text -); - - -ALTER TABLE public.users OWNER TO admin; - --- --- Name: vehicle_bodyworks; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.vehicle_bodyworks ( - id text NOT NULL, - name text NOT NULL, - axles integer NOT NULL, - mass double precision NOT NULL, - volume double precision NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.vehicle_bodyworks OWNER TO admin; - --- --- Name: vehicle_brands; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.vehicle_brands ( - id text NOT NULL, - name text NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.vehicle_brands OWNER TO admin; - --- --- Name: vehicle_models; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.vehicle_models ( - id text NOT NULL, - name text NOT NULL, - weight double precision NOT NULL, - capacity_max double precision NOT NULL, - axles integer NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - brand_id text NOT NULL, - type_id text NOT NULL, - capacity_per_axle integer, - updated_by text NOT NULL -); - - -ALTER TABLE public.vehicle_models OWNER TO admin; - --- --- Name: vehicle_types; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.vehicle_types ( - id text NOT NULL, - name text NOT NULL, - bodywork boolean DEFAULT false NOT NULL, - created_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - updated_at timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by text NOT NULL, - updated_by text NOT NULL -); - - -ALTER TABLE public.vehicle_types OWNER TO admin; - --- --- Name: vehicles; Type: TABLE; Schema: public; Owner: admin --- - -CREATE TABLE public.vehicles ( - id text NOT NULL, - plate text NOT NULL, - year text NOT NULL, - color text NOT NULL, - renavam text NOT NULL, - model_id text NOT NULL, - antt text NOT NULL, - is_ipva_paid boolean NOT NULL, - registration timestamp(3) without time zone NOT NULL -); - - -ALTER TABLE public.vehicles OWNER TO admin; - --- --- Data for Name: Incident; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public."Incident" (id, description, date_incident, order_process_id, date_resolved, created_by, updated_by, created_at, updated_at) FROM stdin; -ca5557fe-0550-4b67-8ab5-1e94c3ae24a3 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:15.888 2024-04-25 23:06:15.888 -3689b656-5fb5-43b2-80dd-3a9669e949f0 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:18.263 2024-04-25 23:06:18.263 -fb10357a-c8b6-43a2-99d1-3ce210554347 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:18.906 2024-04-25 23:06:18.906 -53c49e2a-7745-4c12-a3b2-6fb6b1edbf23 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:19.406 2024-04-25 23:06:19.406 -551786ae-6892-420a-be9b-c3edd9565191 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:19.863 2024-04-25 23:06:19.863 -26d857c3-d85c-4544-9009-d28229098744 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:20.802 2024-04-25 23:06:20.802 -d9ed0ef5-8fbd-4d67-b3fe-28dbf1a03642 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.093 2024-04-25 23:06:21.093 -49726d48-42e7-4aef-a0ab-dd5db0f8b85c Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.273 2024-04-25 23:06:21.273 -e8db7f0a-6e6b-4fb2-a634-a29d8fac2f9f Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.502 2024-04-25 23:06:21.502 -cb52912f-a5e4-42d0-8838-8a6cd0b56161 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.602 2024-04-25 23:06:21.602 -2d7d108a-f6a6-44a5-917f-8a0bd4ec6131 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.758 2024-04-25 23:06:21.758 -9e2c3b40-2c5d-4b5e-bbc6-7300da232f3a Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.933 2024-04-25 23:06:21.933 -c5ddfdb5-263d-4023-927b-2d4562588570 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.082 2024-04-25 23:06:22.082 -c4395936-8e54-4883-af86-055e09ad505e Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.242 2024-04-25 23:06:22.242 -62ae3146-4217-41e7-8c98-728e4b9f9e80 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.401 2024-04-25 23:06:22.401 -beb6b230-2ed1-4562-95f7-0457913f3a40 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.591 2024-04-25 23:06:22.591 -8963474f-8dd3-44f0-aee2-ca01b34fcacd Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.752 2024-04-25 23:06:22.752 -d121766b-4735-4afe-ac19-979eb51b7e30 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.899 2024-04-25 23:06:22.899 -5b89812b-31a6-465c-b4ea-7260a526c42f Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.054 2024-04-25 23:06:23.054 -cf700905-c91c-49a8-ba64-072d69c755ea Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.151 2024-04-25 23:06:23.151 -1ed9bbc4-ba1d-4e28-b71a-8edfdfa076b0 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.311 2024-04-25 23:06:23.311 -73003aab-0e73-48e3-9243-ae6f70e46a88 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.481 2024-04-25 23:06:23.481 -ea69c569-65e8-4e71-a3a0-8885bb7aa35b Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.652 2024-04-25 23:06:23.652 -c1546047-a274-4768-a65f-68252d24321b Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.892 2024-04-25 23:06:23.892 -305bf500-c4c8-4ed9-9d84-a8cf40455534 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.191 2024-04-25 23:06:24.191 -4d97f47d-8f08-4c2a-811d-abfc591ec4aa Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.331 2024-04-25 23:06:24.331 -8ca44084-54ec-42d3-8a96-540e82bb34ed Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.481 2024-04-25 23:06:24.481 -b5e1ab0a-6cf4-4c4c-a388-e0c80ae17b1f Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.621 2024-04-25 23:06:24.621 -472f501d-5c39-428a-b965-de86b03af9d6 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.771 2024-04-25 23:06:24.771 -65ab0d8c-5437-4efa-b57a-88e5dfb78338 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.931 2024-04-25 23:06:24.931 -9496dcc5-2c45-46c2-abe9-aaea6e150928 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.084 2024-04-25 23:06:25.084 -7734a541-b2a8-48ac-b846-36612d85e32a Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.221 2024-04-25 23:06:25.221 -c5ab9600-4bb6-4b81-8bd3-c6ac6f360ac8 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.361 2024-04-25 23:06:25.361 -c90b3c20-7d03-4202-aaf3-f0ee9526b9dd Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.521 2024-04-25 23:06:25.521 -ab17944e-7d35-499d-9ccb-a6b5c8748101 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.681 2024-04-25 23:06:25.681 -bd31bca8-ca40-436a-b2e0-d94644580f9d Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.841 2024-04-25 23:06:25.841 -838a2587-c892-44b0-8a22-3d5793eba5b9 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.002 2024-04-25 23:06:26.002 -7554cb1f-d233-47af-876d-8c767b7f4aa3 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.161 2024-04-25 23:06:26.161 -8ea90c2f-668f-4477-ba39-4c9012322e04 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.311 2024-04-25 23:06:26.311 -d4be9848-1a1a-4853-b41f-05eeddba98ad Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.461 2024-04-25 23:06:26.461 -83bf5264-105b-4a19-abee-04bf905f04d3 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.611 2024-04-25 23:06:26.611 -88f5bc1c-6c45-4df6-8e44-cfe141186475 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.761 2024-04-25 23:06:26.761 -a4671558-f32d-4f48-9db6-775c812776e6 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.921 2024-04-25 23:06:26.921 -eee19a3d-f312-4cd7-975d-0b1b843f2bf1 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.082 2024-04-25 23:06:27.082 -2a1d7b29-634a-472c-9163-9774263e5d82 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.221 2024-04-25 23:06:27.221 -2f6140de-8ed3-462f-a5f3-cc34c1717e38 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.361 2024-04-25 23:06:27.361 -e847cd33-9109-4baa-837d-43e2459c2508 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.531 2024-04-25 23:06:27.531 -d624b780-8474-4c75-aca9-db7f2764b821 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.683 2024-04-25 23:06:27.683 -585acb9f-1118-43ee-880d-f1eb5f9368f3 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.872 2024-04-25 23:06:27.872 -6c90d39f-a353-4a56-97b7-9ee8940de401 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.971 2024-04-25 23:06:27.971 -196d831a-efab-4107-ba08-d20e00b64bff TTE 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.032 2024-04-25 23:20:02.757 -28608229-79c7-4ec9-a4ed-03899cc454e0 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.322 2024-04-25 23:06:28.322 -14bcbc2a-96f7-4ff5-9796-a7d74cda4e99 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.484 2024-04-25 23:06:28.484 -7e625d7a-a70e-4251-81e6-7c8ce202824e Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.631 2024-04-25 23:06:28.631 -ff8b0dba-2b67-44af-9722-330d350c95b6 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.791 2024-04-25 23:06:28.791 -834259f2-a3d2-4647-922c-e5634e178095 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.924 2024-04-25 23:06:28.924 -f30c7ace-2120-4781-9667-d8c93b7c6d59 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:29.081 2024-04-25 23:06:29.081 -f2cc415f-f086-4f78-9692-ba570eb7d9be Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:29.551 2024-04-25 23:06:29.551 -a9b86bfc-286c-442f-b5ab-bc6bb2cb725b Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:29.701 2024-04-25 23:06:29.701 -5b0fc440-56dd-49ba-a750-00c2dd21fca4 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:29.851 2024-04-25 23:06:29.851 -db8751a2-4237-4c23-9f6e-4677158b83c6 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:30.061 2024-04-25 23:06:30.061 -f9941760-a140-4c3f-aa7f-25c4abde46aa Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:30.141 2024-04-25 23:06:30.141 -1317fc3e-1548-4d24-b560-55d6d9eda30e Sasds 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:20.372 2024-04-25 23:20:02.757 -\. - - --- --- Data for Name: OutsourcedTransportCompany; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public."OutsourcedTransportCompany" (id, legal_person_id, created_at, updated_at, created_by, updated_by) FROM stdin; -\. - - --- --- Data for Name: OutsourcedTransportCompanyContract; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public."OutsourcedTransportCompanyContract" (id, outsourced_transport_company_id, carrier_company_id, legal_client_order_id, created_at, created_by, updated_at, updated_by, contract_number) FROM stdin; -\. - - --- --- Data for Name: _VehicleBodyworkToVehicleType; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public."_VehicleBodyworkToVehicleType" ("A", "B") FROM stdin; -\. - - --- --- Data for Name: _prisma_migrations; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public._prisma_migrations (id, checksum, finished_at, migration_name, logs, rolled_back_at, started_at, applied_steps_count) FROM stdin; -86f97020-8108-4e9e-8666-0fb7c1d01be4 45431af10c9cd3c2c808a4db361262f7a9e15241f3e02cabd8c03790b9422b65 2024-04-06 13:52:13.750487+00 20240207230346_ \N \N 2024-04-06 13:52:13.707158+00 1 -035c2fac-7439-4b7b-b98a-9ac7af47004a acba2316af180aaef7710a119059c0003851e91ea8c7cdbb1cc5131ce09b5fc7 2024-04-06 13:52:12.192844+00 20230609171326_init \N \N 2024-04-06 13:52:12.158706+00 1 -b4b98278-9861-40d1-8681-7dd35d7dea96 568d8939593ff4e3131b5ba1ea6d142f639ad7985ee702d51dca014884d47a4e 2024-04-06 13:52:13.433401+00 20231123223551_ \N \N 2024-04-06 13:52:13.424836+00 1 -3b8b9bce-1b26-4d97-b6af-3ab8a433afab 87f0bda62860a1689756c82cda25bdc99fd3b7cfc362f15cf62ca553c0ed2362 2024-04-06 13:52:12.761983+00 20230820000102_ \N \N 2024-04-06 13:52:12.196793+00 1 -37648ece-f08f-4957-8e23-7216130a5a39 d9a4e20063ef26f2dccc70d99378e645092456d5883b953bc04336102f9faf29 2024-04-06 13:52:12.786274+00 20230828010254_updated_relations_and_add_colum_updated_by_in_fields \N \N 2024-04-06 13:52:12.764554+00 1 -dd9d47be-5ec5-41b6-b902-f9960700c0cb e0dc270780a3f856760800327b298c745b3f568608543be5afadb3e15cb3486f 2024-04-06 13:52:12.833108+00 20230910004900_add_collum_capaciy_per_axle_in_vehicle_model \N \N 2024-04-06 13:52:12.788884+00 1 -df0f469f-6c67-440f-9bfe-cfb68e6a8e1e ea35a2cd2680d8294c64c77919baa399708b514f24dd321e61b5d172b76cebd9 2024-04-06 13:52:13.457032+00 20231128233242_ \N \N 2024-04-06 13:52:13.436136+00 1 -ea577176-d735-4504-8dd5-cf2ca6956acc 9825c28c2661af92618bcdbf92f57b94aae7616ccf367734c4ae441de2ab2a9d 2024-04-06 13:52:12.846145+00 20230912201735_ \N \N 2024-04-06 13:52:12.837274+00 1 -9aec36be-a393-409c-a4ac-10ba8cbfce38 2a21bff14e930a4db63183cab333045f86031c4ef9073fe24462a4a0cb3500fd 2024-04-06 13:52:12.860912+00 20231007214630_ \N \N 2024-04-06 13:52:12.850319+00 1 -d9b80eb4-ebf7-46f2-842e-a4eaaaa2d08d aa8e79339cb9b1067a8f65da6005dca8d5c8c13bda4e065ab6588882f065322f 2024-04-06 13:52:13.90455+00 20240309023509_alter_user_add_avatar_url \N \N 2024-04-06 13:52:13.892391+00 1 -7d581197-100e-4ac6-8dad-fb972a8026fd a2a58e276630960a219a79cc1af00cd30e2245d17a1b9e30fc47f0bd3fc1d05c 2024-04-06 13:52:12.885955+00 20231008140047_ \N \N 2024-04-06 13:52:12.863634+00 1 -b4705e33-56c8-4c5b-b1ba-f8543a23eb9a c4f7af956fb1731c74163da6ac8590ca8ebe764ce33df1e9fcace7c9754326b5 2024-04-06 13:52:13.473465+00 20231204231759_ \N \N 2024-04-06 13:52:13.460855+00 1 -297115a3-1cd4-4a6c-9d8f-d0fa8a1b2bca a236cd4fb43bd1b1e801808b3d41fc6b1581c55d1fc094febe6985cfe15f1e49 2024-04-06 13:52:12.911231+00 20231012185010_ \N \N 2024-04-06 13:52:12.890024+00 1 -7bea0690-0db7-4a74-b89e-461fca0b3c2c 04f690086bec157b7dc2b31f82e74acd81d65192aa4a05f78cbd48c09f956fe0 2024-04-06 13:52:12.950014+00 20231017214516_ \N \N 2024-04-06 13:52:12.915248+00 1 -b6dafbe2-9e68-44d6-8d79-75329dbd366c 0874c641a7e2895ade40edc8ce35aacdac6905a23086f646fb776c102c747618 2024-04-06 13:52:13.767414+00 20240213144500_ \N \N 2024-04-06 13:52:13.752953+00 1 -4b38609c-cdad-4b85-aed0-860a7eea22d7 9f7ae82ef8431e3c9afd90e5f9790a133952c5361684104c0144047a36d968f1 2024-04-06 13:52:12.966952+00 20231018232059_ \N \N 2024-04-06 13:52:12.953844+00 1 -8b04a995-dd48-4b1c-b0ae-cee5924f989e ecc1d33a81024087bd391902b40f7f3f267bae8a9d1fd9d0a42601473927b599 2024-04-06 13:52:13.484662+00 20231206210538_ \N \N 2024-04-06 13:52:13.476158+00 1 -7e3c79d9-17a2-49f0-bb2b-f48385fd53af c711294d8f228b18384079f750c5c42b08c99ec00b7dfb8b80751011a5d3ed44 2024-04-06 13:52:12.991545+00 20231022201723_ \N \N 2024-04-06 13:52:12.97118+00 1 -2ca3390f-d142-4fb8-93f5-4ff9d4541051 d892ff69e669ff9be048ecddcba48553d1f1c81216707a213028eb82947be66a 2024-04-06 13:52:13.016427+00 20231024233540_ \N \N 2024-04-06 13:52:12.995495+00 1 -cfb2b223-7e85-413e-9a5a-40df931b6070 4511c3f1e2ebd7df47a4dbdfcefe7ee7ed0dd2e0eb4ad31ddc3eda900ef98b95 2024-04-06 13:52:13.044639+00 20231025213429_ \N \N 2024-04-06 13:52:13.020487+00 1 -6cd7f4c1-e5a6-4617-a4a5-dabc56745bf6 b1a5463e7ee12eeee14daaac06347cd5adfb3f4d32cc399d9ab294d29b4ff57a 2024-04-06 13:52:13.619868+00 20231207223816_ \N \N 2024-04-06 13:52:13.487338+00 1 -cd7cbe5b-2aee-4496-bda5-a918f32d17d1 50e1710fe40d82ecf7e3b1930e7047f55ac9d01e4c59ef955d3b808b2921b44a 2024-04-06 13:52:13.422383+00 20231102204736_ \N \N 2024-04-06 13:52:13.048991+00 1 -b16f66f8-361e-4b3b-8d6a-9160d161f849 ae96487c5846ebca7011d9b32ed54819e9e00c8d5931877c8bd2d913779a08d0 2024-04-06 13:52:13.855807+00 20240307215818_ajust_physical_customer_order_name_physical_merchandise \N \N 2024-04-06 13:52:13.842156+00 1 -5ca754cd-ba67-44bf-8936-80c970bfb743 13e387555de8213a13cb51c4bfc968db4adbc1ca91f8883b1e71c563d5ff47f1 2024-04-06 13:52:13.64265+00 20231212223708_ \N \N 2024-04-06 13:52:13.622525+00 1 -f6c6c049-2a5b-4bc4-9a02-d7cd589778b2 3e7fc3877ff9f25ac3c3db60344da39889fecdb33d59ae9800fce6340df6ddc2 2024-04-06 13:52:13.791199+00 20240306003738_add_rntc_field_in_carrier_company_table \N \N 2024-04-06 13:52:13.771194+00 1 -3847e840-2586-4f06-92a0-7f754862dabc cea223ee81c3c8c8203f035ac121303caca6a8709969a7dc906d00ba99b61968 2024-04-06 13:52:13.659786+00 20240103223054_ \N \N 2024-04-06 13:52:13.646674+00 1 -d167db32-9e6d-41df-9280-93785263599f 512345d7b210fcc03a1ba80fa7d8e2c968173909e89fb514055c090b91017dc9 2024-04-06 13:52:13.677612+00 20240123214447_ \N \N 2024-04-06 13:52:13.662456+00 1 -c8082c19-7d68-44b8-9e1f-206e84d71be2 0e6c4b57a15f54b6c944aca0c19ad58fee9eb3ade2debb51453ff6ba532e0761 2024-04-06 13:52:13.702903+00 20240123232954_ \N \N 2024-04-06 13:52:13.681731+00 1 -ef330ce8-fbe9-4c80-aab5-bf5b652450e2 31c71430881ced0eed19c974c519eef6ab9e8dedbc511c869af2aa8960a8de47 2024-04-06 13:52:13.804732+00 20240306202547_change_field_rntrc_expiration_for_antt_in_vehicle_table \N \N 2024-04-06 13:52:13.795188+00 1 -0902ad20-fb16-45f2-b456-44dec60c93fc a60bc65baede98c063337f076a4d583d39b406653df414a4a78eb19955acd3cf 2024-04-06 13:52:13.870599+00 20240307224431_ \N \N 2024-04-06 13:52:13.859952+00 1 -60bced6e-4b54-44b4-a5e7-ce551ef59a95 5bdb5270d77daddd84cc974ece77213d3b64f98367c1d3ac80d5d98447329839 2024-04-06 13:52:13.815712+00 20240306205703_add_field_registration_and_is_ipva_paid_in_vehicle \N \N 2024-04-06 13:52:13.807234+00 1 -e8ce51eb-fb65-4eed-ae65-b745f52c20a4 dd5a2e2ac68423fbbd10290809eca4768c9217e596bed8fac3e9338b84fb8d37 2024-04-06 13:52:13.838042+00 20240307215512_ \N \N 2024-04-06 13:52:13.818551+00 1 -f2020582-0abc-4c4a-a6e1-b6b2d1d628ec 42756acc2997db4b8b29e90b5dc4400874d6aebd0bf4fa7fd1c0bddba512fb93 2024-04-06 13:52:13.888307+00 20240309010946_ \N \N 2024-04-06 13:52:13.87333+00 1 -d68571a8-aced-48e2-8bc6-cff0d818b9a0 f7f59f7bc3668f0d235bac5e6b5d76fe06fa14cb5ab36d402b0e419509784561 2024-04-06 13:52:14.098032+00 20240314203951_ \N \N 2024-04-06 13:52:14.045754+00 1 -ccd1da8e-a370-47c1-b1f8-eb975e57d21f 0cf76e44c3474d633ce5e9b56ad7811bb5bd725ad5b186f4a28aeba43006db52 2024-04-06 13:52:14.022541+00 20240309233038_ \N \N 2024-04-06 13:52:13.908785+00 1 -fa89cbce-fd10-4992-b084-c2e087d4d9b6 5c2023e3b7147bbb15ac8fce81b883d9a2a1924b5b0a85d6844ca420b9f25938 2024-04-06 13:52:14.041759+00 20240312203959_ \N \N 2024-04-06 13:52:14.026354+00 1 -98e8777f-034d-4699-a189-9119605444d2 d47d95bcc01e8a19299da996e13b27486cbb7440132df3c5bf133af2010f0423 2024-04-06 13:52:14.162124+00 20240317181959_ \N \N 2024-04-06 13:52:14.15005+00 1 -139d3df5-afb7-408b-9e91-32f8ecd5cc53 a290351ffc28d69e35c5c2db54af498fbc7d42e7bfa39f5ee65a3fa60cc468fd 2024-04-06 13:52:14.146317+00 20240317150314_ \N \N 2024-04-06 13:52:14.101748+00 1 -22b7ac84-d46a-4788-b987-1cf8111a27f0 4e1d8b23d929bee18b10a2ceb7b7244b85c8a40c070dab54769bdbfe3a8ab065 2024-04-06 13:52:14.186785+00 20240317183039_ \N \N 2024-04-06 13:52:14.166083+00 1 -a46f7ded-3fab-4f9d-a168-ea05203bb543 dff0a82a2ff2832debaa745a67ac0b2b7a815e711e08d29b242e1690b52d070a 2024-04-06 13:52:14.264106+00 20240320210539_ \N \N 2024-04-06 13:52:14.189357+00 1 -7b62022d-fda5-4e48-bd3d-870cd74a9a7d f84aeb97c662a768ba25a4ae2ecf11a5e94d245af5637118d48c81e456d66546 2024-04-06 13:52:14.28068+00 20240320211615_ \N \N 2024-04-06 13:52:14.267897+00 1 -752e7219-d57f-4782-b5da-ca8cb5539342 7f89276b06ab582101d24d20da3b8d2373fb9e75d4d6fa8951328e1c7a0c961c 2024-04-06 13:52:14.399714+00 20240322230238_ \N \N 2024-04-06 13:52:14.283863+00 1 -0880b2b6-fbc9-4395-a24d-d23f8cf91615 65a324cfcb6798443980343aba66d07f5dbbd89923f1f5328fcbc472162940a0 2024-04-06 13:52:14.428769+00 20240328213005_ \N \N 2024-04-06 13:52:14.402157+00 1 -c4f8cb69-25c3-45a0-936b-0e1fa3041659 40fe5f3ea588b176a4f5ff14a618d0755358a485753e9eee2146fab9a65133a7 2024-04-06 13:52:14.440571+00 20240401215129_ \N \N 2024-04-06 13:52:14.431315+00 1 -cd7957f8-1d69-42dd-8644-26b6a35ea57f 1778ca6485dcbe411ae1764d2836095f4cc2938a0cf7e34e4361e358fca6bde4 2024-04-06 13:52:14.461796+00 20240405223110_ \N \N 2024-04-06 13:52:14.443135+00 1 -6abce501-8470-4039-87ff-947df176bd55 91df33b423381710351db6da2e86d85e2ddbedaaea17358b7fdbfa66b0a73e91 2024-04-06 13:52:14.484653+00 20240406132931_ \N \N 2024-04-06 13:52:14.46564+00 1 -c23c39f7-fcad-45f8-b7e2-4f3583ec9e2d 7985528159c7e73d724599a92d92061fc6d4d9dbab211c2aed528c7ad6679dbf 2024-04-06 13:52:14.495939+00 20240406135042_ \N \N 2024-04-06 13:52:14.487204+00 1 -280f2a5c-70e0-4bf7-8038-da1b40e0263d f5b3711b14236779cdddf6e337f92643f1bba6956948e10a44b1f43b96dd3937 2024-04-06 15:32:48.743248+00 20240406153248_ \N \N 2024-04-06 15:32:48.72288+00 1 -38a13786-6462-4520-9196-d2482518bd7c 0d682df77e7a36a7988d2961ff25d34b37974a0578336a0657e559e0ae756314 2024-04-23 22:41:32.974907+00 20240423224132_add_status_in_order_processing_entity \N \N 2024-04-23 22:41:32.91874+00 1 -\. - - --- --- Data for Name: carrier_companies; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.carrier_companies (id, created_at, updated_at, created_by, updated_by, legal_person_id, rntrc) FROM stdin; -470a163e-653a-4ede-81f5-793523d012c1 2024-04-06 15:38:54.437 2024-04-07 19:16:13.352 123 123 1fe38c07-ef31-49c1-8ebd-f14cacf0383d 1452781914545 -\. - - --- --- Data for Name: ciots_for_legal_clients; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.ciots_for_legal_clients (id, ciot, emission_date, legal_contract_id, created_at, updated_at, created_by, updated_by) FROM stdin; -\. - - --- --- Data for Name: company_vehicles; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.company_vehicles (id, created_at, updated_at, created_by, vehicle_id, updated_by, company_id, "orderProcessingLegalClientId") FROM stdin; -6dbc6ae0-c120-4dc0-bc88-ec57eb35b90f 2024-04-06 18:53:39.459 2024-04-06 18:53:39.459 123 54db2725-2297-497f-a0a0-848c57e14315 123 470a163e-653a-4ede-81f5-793523d012c1 \N -\. - - --- --- Data for Name: completed_orders; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.completed_orders (id, order_processing_number, vehicle_id, total_distance, total_spend_liters, total_spending_money, start_at, end_at, updated_at, created_at, created_by, updated_by) FROM stdin; -\. - - --- --- Data for Name: contract_outsourced_drivers; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.contract_outsourced_drivers (id, type, situation, start_at, end_at, created_at, updated_at, created_by, cpf, updated_by, outsourced_driver_id, contract_number) FROM stdin; -f1671112-7b1a-4963-8d55-13d0c72f00b9 Temporario ABERTO 1970-01-20 20:02:06.004 1970-01-20 20:02:06.004 2024-04-21 19:02:02.078 2024-04-21 19:02:02.078 123 14521452361 123 a64a956b-0a49-46e1-9e55-6dcee8647aa2 11012101 -55b00d8c-5977-49d4-9a93-b6b455aaaac2 Temporario Temporada 1970-01-20 20:02:06.004 1970-01-20 20:02:06.005 2024-04-21 19:22:49.821 2024-04-21 19:22:49.821 123 14521452361 123 a64a956b-0a49-46e1-9e55-6dcee8647aa2 10201000 -e2181f42-2145-4229-9f60-c45e2dd39b6b Temporario Finalizado 1970-01-20 20:02:06.004 1970-01-20 20:02:06.005 2024-04-21 19:22:49.822 2024-04-21 19:22:49.822 123 14521452361 123 a64a956b-0a49-46e1-9e55-6dcee8647aa2 21204110 -\. - - --- --- Data for Name: freight_expenses; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.freight_expenses (id, expense_name, value, legal_client_order_id, physical_customer_id) FROM stdin; -be85ba9d-52c2-4735-aa43-31774f7aab3c GASOLINA 452.4 \N 49dc129e-c222-488d-9e11-6961ef36d528 -\. - - --- --- Data for Name: icms; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.icms (id, state_orgin, recipient_state, aliquot, effective_date, created_at, updated_at, created_by, updated_by) FROM stdin; -f2da4c2f-be79-400d-9450-623119958e98 SP SP 14 1970-01-20 20:08:00.459 2024-04-25 21:28:01.51 2024-04-25 21:28:01.51 123 123 -\. - - --- --- Data for Name: legal_Contracts; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public."legal_Contracts" (id, legal_client_id, carrier_company_id, contract_number, created_at, created_by, delivery_conditions, effective_date, observations, updated_at, updated_by) FROM stdin; -d9655225-b9ec-44c6-983d-d798f4d66aaf 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC11002010 2024-04-29 21:01:30.609 123 sdasd 1970-01-01 04:52:25.145 dsadsad 2024-04-29 21:01:30.609 123 -714eec05-ecdc-4774-9876-1e894da57889 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC40000110 2024-04-29 22:31:44.39 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:44.39 123 -7c547329-f7fe-4464-804a-ff7978bbfae3 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC00122511 2024-04-29 22:31:44.969 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:44.969 123 -f0922a91-fae8-4536-866d-9a9138dd3153 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC05021742 2024-04-29 22:31:45.429 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:45.429 123 -ba8129fe-f77b-4eec-b4d1-cc5a2bc92222 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC02441202 2024-04-29 22:31:45.63 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:45.63 123 -ba2891c2-91e5-4dba-b401-2df5b28915ac 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC02100252 2024-04-29 22:31:46.12 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.12 123 -e52ea003-6861-4e65-8d6c-ff3c6397e3b1 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC00000380 2024-04-29 22:31:46.251 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.251 123 -b4736032-4bac-4d8f-bfa8-4fb9f516f12b 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC20511001 2024-04-29 22:31:46.468 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.468 123 -8baa2319-bca2-4118-a780-ee9621b810e4 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC20200200 2024-04-29 22:31:46.681 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.681 123 -c5b6a5e9-3fb3-4dea-8ed9-52ff5fa6e0a8 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC11007112 2024-04-29 22:31:46.829 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.829 123 -84f1b3b0-4f96-4f11-8ef3-dc03e4ac2a5b 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC06004003 2024-04-29 22:31:46.969 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.969 123 -c4f4d320-766b-48b1-86cb-c443596283f2 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC02180520 2024-04-29 22:31:47.131 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.131 123 -b12d0feb-959d-469a-a036-26cc2bd8aa66 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC02111003 2024-04-29 22:31:47.45 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.45 123 -59e1d7e2-71c5-4062-ada3-a04824e5cb26 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC12302011 2024-04-29 22:31:47.599 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.599 123 -d315bed4-fd82-45bc-9b3e-c0d9489f3ce9 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC03110110 2024-04-29 22:31:47.739 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.739 123 -90fc930c-a806-461d-9ffc-dc4c9e95bf55 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC00001330 2024-04-29 22:31:47.9 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.9 123 -5d29908c-348c-4862-9a8e-7d7fdf45dae5 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC01102144 2024-04-29 22:31:48.04 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:48.04 123 -b1268bb0-1340-4025-88b7-11ac1116dd8a 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC00424000 2024-04-29 22:32:52.24 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:32:52.24 123 -40e1dd30-a701-405e-8905-39f339f1575e 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC21400200 2024-04-29 22:31:47.32 123 11446 1970-01-02 17:04:01.456 AAAA 2024-04-29 22:35:10.504 123 -47679f92-d415-4497-a83f-312a45d0cc73 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC63702103 2024-04-29 22:31:45.801 123 11446 1970-01-02 17:04:01.456 BBBBBB 2024-04-29 22:35:10.504 123 -\. - - --- --- Data for Name: legal_client_cte; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.legal_client_cte (id, order_id, access_key, type_cte, observations, cte_number) FROM stdin; -\. - - --- --- Data for Name: legal_client_quote; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.legal_client_quote (id, cod_quote, recipient_id, sender_id, who_pays, postal_cod_origin, postal_cod_destiny, type_merchandise, amount, description, mass, volume, nf_value, created_at, updated_at, created_by, updated_by) FROM stdin; -2bc444bc-4165-469f-8027-3b6f306d14c5 QT74550300 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:27.364 2024-04-27 15:19:27.364 123 123 -be08488b-9657-45a5-a943-948f34ae7b7e QT00160011 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:31.208 2024-04-27 15:19:31.208 123 123 -81d48c7f-96c0-47e0-bbb0-beb0c5270c0c QT05222000 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:41.417 2024-04-27 15:19:41.417 123 123 -9fc1fbfd-0119-4e38-b582-e6bcbfa734d1 QT03350061 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:42.833 2024-04-27 15:19:42.833 123 123 -40baeeb1-80e7-43ca-8ab3-02b350044bb9 QT00000313 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:43.253 2024-04-27 15:19:43.253 123 123 -ecce88b7-b92a-4b15-93cf-6b087888f1ae QT72030260 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:43.473 2024-04-27 15:19:43.473 123 123 -ff0fedbe-b272-4b4b-bce1-5f3f0d876add QT01212011 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:43.643 2024-04-27 15:19:43.643 123 123 -8a3e6181-e687-4402-9842-3b6ec9ec08ff QT02101130 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:43.857 2024-04-27 15:19:43.857 123 123 -c841cdca-b00b-47b1-9787-1354bead5bb1 QT10204001 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.183 2024-04-27 15:19:44.183 123 123 -774af8b5-7727-4ffa-a65d-c3d91364ba0e QT46001310 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.334 2024-04-27 15:19:44.334 123 123 -bcc5b815-837e-4f1d-916b-a8a650a27ac1 QT20210101 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.473 2024-04-27 15:19:44.473 123 123 -1c22018f-1269-4755-b172-355a14ceb166 QT00031041 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.602 2024-04-27 15:19:44.602 123 123 -1a8ccea5-083c-47aa-94eb-806e08c5b575 QT11201001 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.867 2024-04-27 15:19:44.867 123 123 -fe35057a-fe14-48ec-b8ea-e1af5876e88b QT30103030 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.962 2024-04-27 15:19:44.962 123 123 -5e8f7f44-9cdc-42ca-b985-5ac46dee7f9d QT31226021 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.152 2024-04-27 15:19:45.152 123 123 -b176f7a1-e105-49ec-bd7d-4faaf416c0b1 QT21020012 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.301 2024-04-27 15:19:45.301 123 123 -e43ed624-9543-458b-bb5a-1d9cffc88f03 QT51052510 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.434 2024-04-27 15:19:45.434 123 123 -4d68b92c-6604-46ae-8ea2-a6070c9084c8 QT10000002 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.574 2024-04-27 15:19:45.574 123 123 -aa2e953c-7275-4d0c-b9ae-41556f60e4bc QT00000032 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.822 2024-04-27 15:19:45.822 123 123 -d224ee84-ba4f-430b-a8c0-6ac1a82f8412 QT30001211 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.963 2024-04-27 15:19:45.963 123 123 -f205797b-4538-4841-aa45-c889322ce341 QT32090152 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.112 2024-04-27 15:19:46.112 123 123 -ecddb122-b42b-4bb6-8fd1-f92d1bd599cb QT51301030 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.423 2024-04-27 15:19:46.423 123 123 -b918f148-a52c-4fbb-975a-e0ec09162600 QT13400210 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.563 2024-04-27 15:19:46.563 123 123 -f791e669-6e07-4b5c-b17a-cd949cc54523 QT10000011 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.702 2024-04-27 15:19:46.702 123 123 -6627d9d6-cf50-432b-93fc-9b45e0ffa3e7 QT00200112 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.863 2024-04-27 15:19:46.863 123 123 -4dfb76d9-ef51-454e-95a1-6adbc285497e QT93001010 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.002 2024-04-27 15:19:47.002 123 123 -f41f8b97-fc71-475e-b492-dad1b5491042 QT10100020 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.152 2024-04-27 15:19:47.152 123 123 -82a441f0-04aa-483f-938d-913a3719f588 QT00060100 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.313 2024-04-27 15:19:47.313 123 123 -6b5873e3-923b-4cef-8f1a-e21ffcacb353 QT03220010 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.465 2024-04-27 15:19:47.465 123 123 -da200013-becd-4966-a727-c6889547a733 QT24111030 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.622 2024-04-27 15:19:47.622 123 123 -4c2ee03f-d463-4f41-a9f4-4401c516e560 QT10120001 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.825 2024-04-27 15:19:47.825 123 123 -137fb510-bbe3-41e6-8a3a-fe7a2fdcfd06 QT01000150 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 477 2024-04-27 15:19:46.273 2024-04-27 16:49:38.005 123 123 -8f6df0d6-bf4a-47f8-a110-263c2490f360 QT60412301 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.929 2024-04-27 15:19:47.929 123 123 -3312cd1f-db8d-4bcf-a1cc-ad8556a55568 QT04000001 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:48.102 2024-04-27 15:19:48.102 123 123 -a85f16e0-a6a1-4cb4-b712-16b2a292c569 QT15011120 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:48.542 2024-04-27 15:19:48.542 123 123 -59e8661b-b56f-497f-ba4d-97fc53439494 QT01001601 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:48.692 2024-04-27 15:19:48.692 123 123 -7d8642bb-d02e-481c-98af-33ff81a2cf83 QT00400452 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:48.847 2024-04-27 15:19:48.847 123 123 -110e1e70-f3a2-42ba-8d1d-4ddd03885566 QT31005300 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.013 2024-04-27 15:19:49.013 123 123 -304c56fa-a0cb-4b8a-8844-c76b423d57ea QT30210011 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.182 2024-04-27 15:19:49.182 123 123 -c48a4700-159f-4135-aab4-3aa5eba29425 QT20012010 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.322 2024-04-27 15:19:49.322 123 123 -2a6d9849-56c2-4cb2-9b3a-fa84d7d1ed76 QT01301301 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.492 2024-04-27 15:19:49.492 123 123 -c23364ba-c80a-42a4-a37c-4b2272374de2 QT10100250 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.642 2024-04-27 15:19:49.642 123 123 -85c800e1-2dab-41de-b7fd-4777f04e9eaa QT12029113 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.856 2024-04-27 15:19:49.856 123 123 -39a20a2c-a4c5-4943-8e56-eeea05430f1b QT11643010 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.965 2024-04-27 15:19:49.965 123 123 -4e5309aa-1718-4a55-a71d-6ec3c5bc29e6 QT10001000 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:50.132 2024-04-27 15:19:50.132 123 123 -2d66c8a0-319a-441e-acf7-34159f391b11 QT10303100 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:50.462 2024-04-27 15:19:50.462 123 123 -14638bb4-1630-4237-8d95-1b33107999ea QT40000107 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 155 2024-04-27 15:19:50.303 2024-04-27 16:49:38.005 123 123 -\. - - --- --- Data for Name: legal_clients; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.legal_clients (id, branch, legal_person_id, created_by, updated_by) FROM stdin; -37bedfee-082f-4d06-8798-62842276a59f Tesd ecf45722-63cb-4322-9e53-f0fed1e370fb 123 123 -\. - - --- --- Data for Name: legal_orders; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.legal_orders (id, "order", created_at, updated_at, created_by, updated_by, legal_contract_id, order_processing_id, completed_orders_id, quote_table_id, carrier_id) FROM stdin; -30ed1d70-b584-4ad4-9ab0-eab4ecd1c62c OLC01313110 2024-04-29 21:02:45.751 2024-04-29 21:02:45.751 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -cf7a660b-76a2-471f-921a-d78ba9ed283e OLC11300212 2024-04-29 21:02:46.452 2024-04-29 21:02:46.452 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -8b57dab0-ee2a-4482-a4d6-451eaa16a8a9 OLC50111205 2024-04-29 21:02:46.974 2024-04-29 21:02:46.974 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -ffd4ac5b-a5ea-409a-b200-45a0b72e63f2 OLC52002650 2024-04-29 21:02:47.364 2024-04-29 21:02:47.364 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -76ed8d68-c22f-41e8-9801-dbd1b89d8d0f OLC20105010 2024-04-29 21:02:47.619 2024-04-29 21:02:47.619 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -21b6cf11-7b18-40d3-b6a2-043edf54096e OLC10013000 2024-04-29 21:02:47.851 2024-04-29 21:02:47.851 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -97eb95e9-8706-49b7-b80d-33c9ad5a6f94 OLC21306344 2024-04-29 21:02:48.066 2024-04-29 21:02:48.066 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -bf495782-640b-4987-90ef-f025a13709c3 OLC23010362 2024-04-29 21:02:48.262 2024-04-29 21:02:48.262 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -59a344f4-26ac-4cbb-8261-1a61c265eaed OLC11106211 2024-04-29 21:02:48.412 2024-04-29 21:02:48.412 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -d1d2ba6b-ffd6-42f4-a61b-174e1de5c509 OLC12501001 2024-04-29 21:02:48.595 2024-04-29 21:02:48.595 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -7399160e-4e49-4f41-8d57-98b40099e144 OLC31100652 2024-04-29 21:02:48.78 2024-04-29 21:02:48.78 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -b3d246d2-cf18-4479-a753-c42c95f973d9 OLC10100110 2024-04-29 21:02:48.948 2024-04-29 21:02:48.948 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -5cb73d77-8ae8-4f5e-b972-5c8f297b59a2 OLC12220100 2024-04-29 21:02:49.125 2024-04-29 21:02:49.125 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -5a96785a-f212-4816-8884-bf7d7b645850 OLC00500003 2024-04-29 21:02:49.286 2024-04-29 21:02:49.286 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -42cc8db6-a1ea-4125-9351-5763f8b6478e OLC15010400 2024-04-29 21:02:49.464 2024-04-29 21:02:49.464 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -4487a139-023d-4dbf-acde-083ac62dd31d OLC21143423 2024-04-29 21:02:49.644 2024-04-29 21:02:49.644 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -817b65bc-6298-4a12-9501-bc34e7439938 OLC12082100 2024-04-29 21:02:49.804 2024-04-29 21:02:49.804 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -87d4957b-d5ba-4220-8aef-7af521b0d763 OLC00521183 2024-04-29 21:02:50.151 2024-04-29 21:02:50.151 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -c343243a-6fae-4259-93ba-dc69bf62cdbd OLC01400352 2024-04-29 21:02:50.324 2024-04-29 21:02:50.324 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -fafd5343-cc8d-40c1-8031-dc8bedc8df0e OLC11002000 2024-04-29 21:02:50.493 2024-04-29 21:02:50.493 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -aec58633-eba7-4aed-b829-6473d189db65 OLC12220004 2024-04-29 21:02:50.669 2024-04-29 21:02:50.669 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -2a5ef9e3-d7f5-4ff5-beaf-6c67011866ec OLC00000201 2024-04-29 21:02:50.831 2024-04-29 21:02:50.831 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -bb5564ed-768c-4cd5-ab42-b788a58f33d1 OLC03120010 2024-04-29 21:02:50.99 2024-04-29 21:02:50.99 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -7fb0d687-ff81-410b-a80c-f51ed9b8f699 OLC40003021 2024-04-29 21:02:51.166 2024-04-29 21:02:51.166 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -5cc440fc-fa76-40d7-938b-eeb6835943ee OLC23415304 2024-04-29 21:02:51.337 2024-04-29 21:02:51.337 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -b7ecb699-14a4-499f-b1e0-85b8d1917c49 OLC20011502 2024-04-29 21:02:51.47 2024-04-29 21:02:51.47 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -1e571494-d073-4049-ac89-3863eaed98e8 OLC22002100 2024-04-29 21:02:51.798 2024-04-29 21:02:51.797 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -583d8ff6-052a-4d45-907d-4c437d4679e1 OLC00105001 2024-04-29 21:02:51.969 2024-04-29 21:02:51.969 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -ab353878-f914-41a6-8cfb-67ffc2b5dd20 OLC22008211 2024-04-29 21:02:52.277 2024-04-29 21:02:52.277 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -89e5759e-d443-465e-9c17-01a8196c92cc OLC12320020 2024-04-29 21:02:52.459 2024-04-29 21:02:52.459 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -1b6c53f3-4ae9-459b-8e0e-e76a0a7cb8f7 OLC01500711 2024-04-29 21:02:52.62 2024-04-29 21:02:52.62 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -2e05e747-4165-4892-a768-077b1a98b0b1 OLC02006111 2024-04-29 21:02:52.77 2024-04-29 21:02:52.77 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -c48b3f7f-7b05-46a5-a13a-f0f337a0c269 OLC03200800 2024-04-29 21:02:52.932 2024-04-29 21:02:52.932 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -4116390f-f122-4cb3-917f-8fa6230f91f5 OLC02430023 2024-04-29 21:02:53.099 2024-04-29 21:02:53.099 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -17a096d5-5378-49e3-aaa6-b90dbc9bf2fa OLC41200010 2024-04-29 21:02:53.269 2024-04-29 21:02:53.269 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -fee2948b-af1e-496f-a7a2-268d0182dad7 OLC10102022 2024-04-29 21:02:53.596 2024-04-29 21:02:53.596 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -3a65e00c-87fa-441d-9e5b-b76d2dd5d725 OLC20305302 2024-04-29 21:02:53.768 2024-04-29 21:02:53.768 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -b49513aa-4adc-48a3-8a8e-962f17f2ed5a OLC14114011 2024-04-29 21:02:53.947 2024-04-29 21:02:53.947 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -17a7674e-a67c-4bfc-b5a3-defee336f790 OLC16401101 2024-04-29 21:02:54.259 2024-04-29 21:02:54.259 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -976d6b21-d91a-410c-91f4-2b4f77f8e0ae OLC12010111 2024-04-29 21:02:54.422 2024-04-29 21:02:54.422 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -789ef1b9-f466-45ac-a3c9-3032691e9fc8 OLC73400000 2024-04-29 21:02:54.584 2024-04-29 21:02:54.584 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -9b4438a7-3331-40bc-a009-8bf30257d9fe OLC00024111 2024-04-29 21:02:54.751 2024-04-29 21:02:54.751 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -0df52267-6594-463e-b70e-8aab17b66719 OLC21152003 2024-04-29 21:02:54.904 2024-04-29 21:02:54.904 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -d0ec612a-72bc-44bc-8cc0-b58c7112e905 OLC30655260 2024-04-29 21:02:55.085 2024-04-29 21:02:55.085 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -8bd0de97-d893-44f3-8e8f-e2b8d92b2bd9 OLC51030030 2024-04-29 21:02:55.246 2024-04-29 21:02:55.246 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -1ef0be39-a36a-4a4b-9974-8967949d1776 OLC13500003 2024-04-29 21:02:55.392 2024-04-29 21:02:55.392 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -fb63037e-1dcd-4a8f-b44c-c211dc818629 OLC10332001 2024-04-29 21:02:55.567 2024-04-29 21:02:55.567 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -e844580a-9513-4b10-9a04-8beae761fc77 OLC20001141 2024-04-29 21:02:55.732 2024-04-29 21:02:55.732 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -d558a4d1-3308-4912-8400-38c1c002f532 OLC10200063 2024-04-29 21:02:55.896 2024-04-29 21:02:55.896 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -b39a9b2e-6f27-44fe-83bc-676a2b6f6abe OLC73001103 2024-04-29 21:18:12.491 2024-04-29 21:18:12.491 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -0a13fba5-2876-40fe-8ad2-8f1519e765dc OLC02012111 2024-04-29 21:02:53.432 2024-04-29 21:32:18.247 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 -\. - - --- --- Data for Name: legal_people; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.legal_people (id, fantasy_name, cnpj, state_registration, corporate_name, public_place, address_number, neighborhood, complement, city, uf, first_phone, second_phone, third_phone, email, created_at, updated_at) FROM stdin; -ecf45722-63cb-4322-9e53-f0fed1e370fb Sdsadas 14521412541245 14512541474 sdasdasd asdsadas 1254 fsdf ASDASDSAD sdas UF 12345645124 14521451251 \N SADASD@asdsad 2024-04-29 21:01:10.518 2024-04-29 21:01:10.518 -1fe38c07-ef31-49c1-8ebd-f14cacf0383d TLS 12345678910254 1452314781 TLS LTDA RUA 2 451 LAPA \N São Paulo RJ 12047845124 \N \N Mainteadsd@test 2024-04-07 19:16:13.352 2024-05-01 01:07:20.533 -ab36a21a-f786-4745-bd00-47e302ac36e3 sdasdasd 14521210147854 1474125214 asadsf nullsdasdas 98749 asdasdas \N dasdsa SP 145214785414 \N \N sdsad@fsfas 2024-05-01 01:10:05.89 2024-05-01 01:10:05.89 -9ab7c52f-c148-4db2-acf6-0c1c7542df75 sdasdas1d 14521211147854 1471125214 as1adsf nullsdasdas 98749 asdasdas \N dasdsa SP 147214785414 \N \N sdsad@fsfas 2024-05-01 01:10:34.517 2024-05-01 01:10:34.517 -6dcc0516-ebcd-4348-be65-30247dfb5804 sd2sdas1d 14521221147854 1471225214 a21adsf nullsdasdas 98749 asdasdas \N dasdsa SP 147214785414 \N \N sdsad@fsfas 2024-05-01 01:10:53.166 2024-05-01 01:10:53.166 -\. - - --- --- Data for Name: maintenance; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.maintenance (id, created_at, created_by, updated_at, updated_by, maintenance_company_id, finished_at, type_of_maintenance_id, vehicle_id) FROM stdin; -76bc24b2-049f-475c-b8d2-aea31214360c 2024-04-06 18:55:45.314 123 2024-04-06 18:55:45.314 123 4c8a6e47-0e0d-451f-950d-d8ea42a029e6 \N a2c78f83-b59b-4e52-bbf0-cbc8b048bed0 54db2725-2297-497f-a0a0-848c57e14315 -\. - - --- --- Data for Name: maintenance_companies; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.maintenance_companies (id, specialty_maintenance, created_at, created_by, updated_at, updated_by, legal_person_id) FROM stdin; -4c8a6e47-0e0d-451f-950d-d8ea42a029e6 Test 2024-04-06 13:59:17.305 123 2024-04-06 13:59:17.305 123 1fe38c07-ef31-49c1-8ebd-f14cacf0383d -4c16ec7c-1165-4f99-a894-1bca035d34c4 sdasad 2024-05-01 01:10:05.892 123 2024-05-01 01:10:05.892 123 ab36a21a-f786-4745-bd00-47e302ac36e3 -26fb2dc4-05db-45fc-bdec-6ff417a1b81b sdasad 2024-05-01 01:10:34.519 123 2024-05-01 01:10:34.519 123 9ab7c52f-c148-4db2-acf6-0c1c7542df75 -\. - - --- --- Data for Name: natural_people; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.natural_people (id, name, date_birth, gender, cpf, rg, cep, public_place, address_number, neighborhood, complement, city, uf, first_phone, second_phone, third_phone, email, nationality) FROM stdin; -e39d4ab2-58e0-4b3c-8df1-41420bb0c233 John Kennedy 1970-01-20 19:41:44.726 MASC 14785436521 147152365 1478523 Asuia 205 Albany \N teresinha US 145247541254 \N \N john@test RUSSIAN -a612681f-15af-4dc5-bbc2-a45b9d30f379 John Kennedy 1970-01-20 19:41:44.726 MASC 14785236521 147852365 1478523 Asuia 205 Albany 123 teresinha US 145247541254 \N \N john@test RUSSIAN -46fac594-30d5-4d96-9e6a-aace32ed529b JÃO 1970-01-20 19:57:57.071 MASC 14141414141 1414141414 07142090 SRW TEST 144 TEST WSS \N GUA SP 14247845741 \N \N SDASd@sfs BRASIL -3b11a7c4-1c0c-4d29-b350-df48d08712c2 JÃO 1970-01-20 19:57:57.071 MASC 15151515151 1515151515 07142090 SRW TEST 487 TEST WSS \N GUA SP 14247845741 \N \N SDASd@sfs BRASIL -ea7cbad6-bfe3-4d10-b7b1-7457b954a91f TIO PAULO 1970-01-20 20:02:05.749 MASC 14521452361 1026587412 0741025 ddgsdg 2145 Sdadsa GRU SP 1478541254 \N \N Fsfs@ets Brasileiro -\. - - --- --- Data for Name: order_procesing; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.order_procesing (id, order_processing_number, vehicle_id, total_distance, total_spend_liters, total_spending_money, start_at, end_at, updated_at, created_at, created_by, updated_by, status) FROM stdin; -1fc6f459-5fdf-4db8-a859-ed65a340da6d OP15012041 54db2725-2297-497f-a0a0-848c57e14315 25 5 20 1970-01-20 20:05:11.979 \N 2024-04-23 23:19:38.249 2024-04-23 23:19:38.249 123 123 CREATED -\. - - --- --- Data for Name: outsourcedT_transport_company_driver; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public."outsourcedT_transport_company_driver" (id, cnh, cnh_expiration, course_mopp, created_at, updated_at, created_by, updated_by, natural_person_id, outsourced_transport_company_id, cnh_category) FROM stdin; -\. - - --- --- Data for Name: outsourced_drivers; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.outsourced_drivers (id, cnh, cnh_expiration, course_mopp, created_at, updated_at, created_by, outsourced_vehicle_id, updated_by, natural_person_id, cnh_category, company_vehicle_id) FROM stdin; -a64a956b-0a49-46e1-9e55-6dcee8647aa2 14147851254 1970-01-20 20:02:05.749 t 2024-04-21 19:00:24.692 2024-04-21 19:00:24.692 123 \N 123 ea7cbad6-bfe3-4d10-b7b1-7457b954a91f B 6dbc6ae0-c120-4dc0-bc88-ec57eb35b90f -\. - - --- --- Data for Name: outsourced_transport_vehicle; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.outsourced_transport_vehicle (id, outsourced_company_id, vehicle_id, created_at, updated_at, created_by, updated_by) FROM stdin; -\. - - --- --- Data for Name: outsourced_vehicles; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.outsourced_vehicles (id, created_at, updated_at, created_by, vehicle_id, order_processing_id, updated_by, "orderProcessingLegalClientId") FROM stdin; -\. - - --- --- Data for Name: own_drivers; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.own_drivers (id, cnh, cnh_expiration, company_vehicle, course_mopp, created_at, updated_at, created_by, updated_by, natural_person_id, cnh_category) FROM stdin; -91e23780-a5a9-4a67-a85e-d7117f649e6b 14512478541 1970-01-20 19:41:44.726 t t 2024-04-07 16:35:40.439 2024-04-07 16:35:40.439 123 123 e39d4ab2-58e0-4b3c-8df1-41420bb0c233 A -7553ec92-f532-4e2c-9259-76cb1e4e1565 14524478141 1970-01-20 19:41:44.726 t t 2024-04-07 18:47:18.335 2024-04-07 18:47:18.335 123 123 a612681f-15af-4dc5-bbc2-a45b9d30f379 B -\. - - --- --- Data for Name: physical_customer_cte; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.physical_customer_cte (id, order_id, access_key, type_cte, observations, cte_number) FROM stdin; -\. - - --- --- Data for Name: physical_customer_quote; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.physical_customer_quote (id, cod_quote, recipient_id, "senderId", who_pays, postal_cod_origin, postal_cod_destiny, type_merchandise, amount, description, mass, volume, nf_value, created_at, updated_at, created_by, updated_by) FROM stdin; -1aa86854-2304-40c5-83fc-ef047f23a6c3 QT06004031 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 0741414 1415474 TEST 45 Arroz 4115 4500 10000 2024-04-18 22:00:21.773 2024-04-18 22:00:21.773 123 123 -\. - - --- --- Data for Name: physical_customers; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.physical_customers (id, branch, created_by, updated_by, natural_person_id, created_at, updated_at) FROM stdin; -682f2c0d-90ac-431a-b6b9-0d2f38be6411 \N 123 123 a612681f-15af-4dc5-bbc2-a45b9d30f379 2024-04-18 22:13:00.586 2024-04-18 22:13:00.586 -\. - - --- --- Data for Name: physical_orders; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.physical_orders (id, "order", updated_by, created_at, updated_at, created_by, physical_customer_id, "completedOrdersId", order_processing_id, quote_table_id, carrier_id) FROM stdin; -49dc129e-c222-488d-9e11-6961ef36d528 OR04001035 123 2024-04-18 22:13:32.569 2024-04-18 22:13:32.569 123 682f2c0d-90ac-431a-b6b9-0d2f38be6411 \N 1fc6f459-5fdf-4db8-a859-ed65a340da6d 1aa86854-2304-40c5-83fc-ef047f23a6c3 470a163e-653a-4ede-81f5-793523d012c1 -\. - - --- --- Data for Name: recipient; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.recipient (id, legal_person_id, natural_person_id, created_at, updated_at, created_by, updated_by) FROM stdin; -5e12366b-6bed-487a-bf7d-09dfeabe7799 \N 3b11a7c4-1c0c-4d29-b350-df48d08712c2 2024-04-18 21:54:08.486 2024-04-18 21:54:08.486 123 123 -\. - - --- --- Data for Name: sender; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.sender (id, legal_person_id, natural_person_id, created_at, updated_at, created_by, updated_by) FROM stdin; -b3034daa-e9a3-4864-bf99-c10a7514eca0 \N 46fac594-30d5-4d96-9e6a-aace32ed529b 2024-04-18 21:52:24.129 2024-04-18 21:52:24.129 123 123 -\. - - --- --- Data for Name: types_of_maintenances; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.types_of_maintenances (id, description, created_at, created_by, updated_at, updated_by, "typeMaintenance") FROM stdin; -a2c78f83-b59b-4e52-bbf0-cbc8b048bed0 Troca de Oléo 2024-04-06 15:36:10.324 123 2024-04-06 15:36:10.323 123 MANUTENÇÃO PREDITIVA -\. - - --- --- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.users (id, name, username, email, password, created_at, updated_at, role, avatar_url) FROM stdin; -123 test test test@test $2b$10$MlfwVUV79ZON9/EcD08PKef4RofumOuOsKEmz7niXqefMZx0A0u7m 2024-04-06 13:57:19.391 2024-04-06 13:57:19.391 ADMIN \N -\. - - --- --- Data for Name: vehicle_bodyworks; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.vehicle_bodyworks (id, name, axles, mass, volume, created_at, updated_at, created_by, updated_by) FROM stdin; -\. - - --- --- Data for Name: vehicle_brands; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.vehicle_brands (id, name, created_at, updated_at, created_by, updated_by) FROM stdin; -59ae26e5-f966-49b4-aea4-7708325de9fd FORD 2024-04-06 18:34:50.402 2024-04-06 18:34:50.402 123 123 -\. - - --- --- Data for Name: vehicle_models; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.vehicle_models (id, name, weight, capacity_max, axles, created_at, updated_at, created_by, brand_id, type_id, capacity_per_axle, updated_by) FROM stdin; -f9d23e17-ae1f-48cc-b687-6d8be4e275d6 FORD K 45.4 500.5 4 2024-04-06 18:49:20.548 2024-04-06 18:49:20.548 123 59ae26e5-f966-49b4-aea4-7708325de9fd bbe91666-6a4b-4349-9fd9-695c69b96e05 4 123 -\. - - --- --- Data for Name: vehicle_types; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.vehicle_types (id, name, bodywork, created_at, updated_at, created_by, updated_by) FROM stdin; -bbe91666-6a4b-4349-9fd9-695c69b96e05 SD f 2024-04-06 18:44:47.942 2024-04-06 18:44:47.942 123 123 -\. - - --- --- Data for Name: vehicles; Type: TABLE DATA; Schema: public; Owner: admin --- - -COPY public.vehicles (id, plate, year, color, renavam, model_id, antt, is_ipva_paid, registration) FROM stdin; -54db2725-2297-497f-a0a0-848c57e14315 cgs1414 2024 VERDE str145212 f9d23e17-ae1f-48cc-b687-6d8be4e275d6 TSD1245 t 1970-01-20 19:40:29.557 -\. - - --- --- Name: Incident Incident_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."Incident" - ADD CONSTRAINT "Incident_pkey" PRIMARY KEY (id); - - --- --- Name: OutsourcedTransportCompanyContract OutsourcedTransportCompanyContract_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompanyContract" - ADD CONSTRAINT "OutsourcedTransportCompanyContract_pkey" PRIMARY KEY (id); - - --- --- Name: OutsourcedTransportCompany OutsourcedTransportCompany_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompany" - ADD CONSTRAINT "OutsourcedTransportCompany_pkey" PRIMARY KEY (id); - - --- --- Name: _prisma_migrations _prisma_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public._prisma_migrations - ADD CONSTRAINT _prisma_migrations_pkey PRIMARY KEY (id); - - --- --- Name: carrier_companies carrier_companies_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.carrier_companies - ADD CONSTRAINT carrier_companies_pkey PRIMARY KEY (id); - - --- --- Name: ciots_for_legal_clients ciots_for_legal_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.ciots_for_legal_clients - ADD CONSTRAINT ciots_for_legal_clients_pkey PRIMARY KEY (id); - - --- --- Name: company_vehicles company_vehicles_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.company_vehicles - ADD CONSTRAINT company_vehicles_pkey PRIMARY KEY (id); - - --- --- Name: completed_orders completed_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.completed_orders - ADD CONSTRAINT completed_orders_pkey PRIMARY KEY (id); - - --- --- Name: contract_outsourced_drivers contract_outsourced_drivers_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.contract_outsourced_drivers - ADD CONSTRAINT contract_outsourced_drivers_pkey PRIMARY KEY (id); - - --- --- Name: freight_expenses freight_expenses_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.freight_expenses - ADD CONSTRAINT freight_expenses_pkey PRIMARY KEY (id); - - --- --- Name: icms icms_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.icms - ADD CONSTRAINT icms_pkey PRIMARY KEY (id); - - --- --- Name: legal_Contracts legal_Contracts_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."legal_Contracts" - ADD CONSTRAINT "legal_Contracts_pkey" PRIMARY KEY (id); - - --- --- Name: legal_client_cte legal_client_cte_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_client_cte - ADD CONSTRAINT legal_client_cte_pkey PRIMARY KEY (id); - - --- --- Name: legal_client_quote legal_client_quote_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_client_quote - ADD CONSTRAINT legal_client_quote_pkey PRIMARY KEY (id); - - --- --- Name: legal_clients legal_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_clients - ADD CONSTRAINT legal_clients_pkey PRIMARY KEY (id); - - --- --- Name: legal_orders legal_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_orders - ADD CONSTRAINT legal_orders_pkey PRIMARY KEY (id); - - --- --- Name: legal_people legal_people_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_people - ADD CONSTRAINT legal_people_pkey PRIMARY KEY (id); - - --- --- Name: maintenance_companies maintenance_companies_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance_companies - ADD CONSTRAINT maintenance_companies_pkey PRIMARY KEY (id); - - --- --- Name: maintenance maintenance_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance - ADD CONSTRAINT maintenance_pkey PRIMARY KEY (id); - - --- --- Name: natural_people natural_people_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.natural_people - ADD CONSTRAINT natural_people_pkey PRIMARY KEY (id); - - --- --- Name: order_procesing order_procesing_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.order_procesing - ADD CONSTRAINT order_procesing_pkey PRIMARY KEY (id); - - --- --- Name: outsourcedT_transport_company_driver outsourcedT_transport_company_driver_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."outsourcedT_transport_company_driver" - ADD CONSTRAINT "outsourcedT_transport_company_driver_pkey" PRIMARY KEY (id); - - --- --- Name: outsourced_drivers outsourced_drivers_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_drivers - ADD CONSTRAINT outsourced_drivers_pkey PRIMARY KEY (id); - - --- --- Name: outsourced_transport_vehicle outsourced_transport_vehicle_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_transport_vehicle - ADD CONSTRAINT outsourced_transport_vehicle_pkey PRIMARY KEY (id); - - --- --- Name: outsourced_vehicles outsourced_vehicles_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_vehicles - ADD CONSTRAINT outsourced_vehicles_pkey PRIMARY KEY (id); - - --- --- Name: own_drivers own_drivers_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.own_drivers - ADD CONSTRAINT own_drivers_pkey PRIMARY KEY (id); - - --- --- Name: physical_customer_cte physical_customer_cte_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.physical_customer_cte - ADD CONSTRAINT physical_customer_cte_pkey PRIMARY KEY (id); - - --- --- Name: physical_customer_quote physical_customer_quote_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.physical_customer_quote - ADD CONSTRAINT physical_customer_quote_pkey PRIMARY KEY (id); - - --- --- Name: physical_customers physical_customers_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.physical_customers - ADD CONSTRAINT physical_customers_pkey PRIMARY KEY (id); - - --- --- Name: physical_orders physical_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.physical_orders - ADD CONSTRAINT physical_orders_pkey PRIMARY KEY (id); - - --- --- Name: recipient recipient_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.recipient - ADD CONSTRAINT recipient_pkey PRIMARY KEY (id); - - --- --- Name: sender sender_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.sender - ADD CONSTRAINT sender_pkey PRIMARY KEY (id); - - --- --- Name: types_of_maintenances types_of_maintenances_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.types_of_maintenances - ADD CONSTRAINT types_of_maintenances_pkey PRIMARY KEY (id); - - --- --- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.users - ADD CONSTRAINT users_pkey PRIMARY KEY (id); - - --- --- Name: vehicle_bodyworks vehicle_bodyworks_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.vehicle_bodyworks - ADD CONSTRAINT vehicle_bodyworks_pkey PRIMARY KEY (id); - - --- --- Name: vehicle_brands vehicle_brands_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.vehicle_brands - ADD CONSTRAINT vehicle_brands_pkey PRIMARY KEY (id); - - --- --- Name: vehicle_models vehicle_models_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.vehicle_models - ADD CONSTRAINT vehicle_models_pkey PRIMARY KEY (id); - - --- --- Name: vehicle_types vehicle_types_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.vehicle_types - ADD CONSTRAINT vehicle_types_pkey PRIMARY KEY (id); - - --- --- Name: vehicles vehicles_pkey; Type: CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.vehicles - ADD CONSTRAINT vehicles_pkey PRIMARY KEY (id); - - --- --- Name: OutsourcedTransportCompanyContract_contract_number_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX "OutsourcedTransportCompanyContract_contract_number_key" ON public."OutsourcedTransportCompanyContract" USING btree (contract_number); - - --- --- Name: OutsourcedTransportCompanyContract_legal_client_order_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX "OutsourcedTransportCompanyContract_legal_client_order_id_key" ON public."OutsourcedTransportCompanyContract" USING btree (legal_client_order_id); - - --- --- Name: OutsourcedTransportCompany_legal_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX "OutsourcedTransportCompany_legal_person_id_key" ON public."OutsourcedTransportCompany" USING btree (legal_person_id); - - --- --- Name: _VehicleBodyworkToVehicleType_AB_unique; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX "_VehicleBodyworkToVehicleType_AB_unique" ON public."_VehicleBodyworkToVehicleType" USING btree ("A", "B"); - - --- --- Name: _VehicleBodyworkToVehicleType_B_index; Type: INDEX; Schema: public; Owner: admin --- - -CREATE INDEX "_VehicleBodyworkToVehicleType_B_index" ON public."_VehicleBodyworkToVehicleType" USING btree ("B"); - - --- --- Name: carrier_companies_legal_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX carrier_companies_legal_person_id_key ON public.carrier_companies USING btree (legal_person_id); - - --- --- Name: carrier_companies_rntrc_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX carrier_companies_rntrc_key ON public.carrier_companies USING btree (rntrc); - - --- --- Name: ciots_for_legal_clients_ciot_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX ciots_for_legal_clients_ciot_key ON public.ciots_for_legal_clients USING btree (ciot); - - --- --- Name: company_vehicles_vehicle_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX company_vehicles_vehicle_id_key ON public.company_vehicles USING btree (vehicle_id); - - --- --- Name: completed_orders_vehicle_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX completed_orders_vehicle_id_key ON public.completed_orders USING btree (vehicle_id); - - --- --- Name: contract_outsourced_drivers_contract_number_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX contract_outsourced_drivers_contract_number_key ON public.contract_outsourced_drivers USING btree (contract_number); - - --- --- Name: icms_state_orgin_recipient_state_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX icms_state_orgin_recipient_state_key ON public.icms USING btree (state_orgin, recipient_state); - - --- --- Name: legal_Contracts_contract_number_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX "legal_Contracts_contract_number_key" ON public."legal_Contracts" USING btree (contract_number); - - --- --- Name: legal_client_cte_order_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX legal_client_cte_order_id_key ON public.legal_client_cte USING btree (order_id); - - --- --- Name: legal_clients_legal_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX legal_clients_legal_person_id_key ON public.legal_clients USING btree (legal_person_id); - - --- --- Name: legal_orders_order_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX legal_orders_order_key ON public.legal_orders USING btree ("order"); - - --- --- Name: legal_people_cnpj_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX legal_people_cnpj_key ON public.legal_people USING btree (cnpj); - - --- --- Name: legal_people_state_registration_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX legal_people_state_registration_key ON public.legal_people USING btree (state_registration); - - --- --- Name: maintenance_companies_legal_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX maintenance_companies_legal_person_id_key ON public.maintenance_companies USING btree (legal_person_id); - - --- --- Name: natural_people_cpf_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX natural_people_cpf_key ON public.natural_people USING btree (cpf); - - --- --- Name: natural_people_rg_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX natural_people_rg_key ON public.natural_people USING btree (rg); - - --- --- Name: order_procesing_order_processing_number_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX order_procesing_order_processing_number_key ON public.order_procesing USING btree (order_processing_number); - - --- --- Name: order_procesing_vehicle_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX order_procesing_vehicle_id_key ON public.order_procesing USING btree (vehicle_id); - - --- --- Name: outsourcedT_transport_company_driver_cnh_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX "outsourcedT_transport_company_driver_cnh_key" ON public."outsourcedT_transport_company_driver" USING btree (cnh); - - --- --- Name: outsourcedT_transport_company_driver_natural_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX "outsourcedT_transport_company_driver_natural_person_id_key" ON public."outsourcedT_transport_company_driver" USING btree (natural_person_id); - - --- --- Name: outsourced_drivers_cnh_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX outsourced_drivers_cnh_key ON public.outsourced_drivers USING btree (cnh); - - --- --- Name: outsourced_drivers_company_vehicle_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX outsourced_drivers_company_vehicle_id_key ON public.outsourced_drivers USING btree (company_vehicle_id); - - --- --- Name: outsourced_drivers_natural_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX outsourced_drivers_natural_person_id_key ON public.outsourced_drivers USING btree (natural_person_id); - - --- --- Name: outsourced_drivers_outsourced_vehicle_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX outsourced_drivers_outsourced_vehicle_id_key ON public.outsourced_drivers USING btree (outsourced_vehicle_id); - - --- --- Name: outsourced_transport_vehicle_vehicle_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX outsourced_transport_vehicle_vehicle_id_key ON public.outsourced_transport_vehicle USING btree (vehicle_id); - - --- --- Name: outsourced_vehicles_vehicle_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX outsourced_vehicles_vehicle_id_key ON public.outsourced_vehicles USING btree (vehicle_id); - - --- --- Name: own_drivers_cnh_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX own_drivers_cnh_key ON public.own_drivers USING btree (cnh); - - --- --- Name: physical_customer_cte_order_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX physical_customer_cte_order_id_key ON public.physical_customer_cte USING btree (order_id); - - --- --- Name: physical_customer_quote_postal_cod_destiny_postal_cod_origi_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX physical_customer_quote_postal_cod_destiny_postal_cod_origi_key ON public.physical_customer_quote USING btree (postal_cod_destiny, postal_cod_origin); - - --- --- Name: physical_customers_natural_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX physical_customers_natural_person_id_key ON public.physical_customers USING btree (natural_person_id); - - --- --- Name: physical_orders_order_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX physical_orders_order_key ON public.physical_orders USING btree ("order"); - - --- --- Name: recipient_legal_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX recipient_legal_person_id_key ON public.recipient USING btree (legal_person_id); - - --- --- Name: recipient_natural_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX recipient_natural_person_id_key ON public.recipient USING btree (natural_person_id); - - --- --- Name: sender_legal_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX sender_legal_person_id_key ON public.sender USING btree (legal_person_id); - - --- --- Name: sender_natural_person_id_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX sender_natural_person_id_key ON public.sender USING btree (natural_person_id); - - --- --- Name: types_of_maintenances_description_typeMaintenance_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX "types_of_maintenances_description_typeMaintenance_key" ON public.types_of_maintenances USING btree (description, "typeMaintenance"); - - --- --- Name: users_email_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX users_email_key ON public.users USING btree (email); - - --- --- Name: users_username_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX users_username_key ON public.users USING btree (username); - - --- --- Name: vehicle_brands_name_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX vehicle_brands_name_key ON public.vehicle_brands USING btree (name); - - --- --- Name: vehicle_types_name_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX vehicle_types_name_key ON public.vehicle_types USING btree (name); - - --- --- Name: vehicles_plate_key; Type: INDEX; Schema: public; Owner: admin --- - -CREATE UNIQUE INDEX vehicles_plate_key ON public.vehicles USING btree (plate); - - --- --- Name: Incident Incident_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."Incident" - ADD CONSTRAINT "Incident_created_by_fkey" FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: Incident Incident_order_process_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."Incident" - ADD CONSTRAINT "Incident_order_process_id_fkey" FOREIGN KEY (order_process_id) REFERENCES public.order_procesing(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: Incident Incident_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."Incident" - ADD CONSTRAINT "Incident_updated_by_fkey" FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: OutsourcedTransportCompanyContract OutsourcedTransportCompanyContract_carrier_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompanyContract" - ADD CONSTRAINT "OutsourcedTransportCompanyContract_carrier_company_id_fkey" FOREIGN KEY (carrier_company_id) REFERENCES public.carrier_companies(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: OutsourcedTransportCompanyContract OutsourcedTransportCompanyContract_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompanyContract" - ADD CONSTRAINT "OutsourcedTransportCompanyContract_created_by_fkey" FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: OutsourcedTransportCompanyContract OutsourcedTransportCompanyContract_legal_client_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompanyContract" - ADD CONSTRAINT "OutsourcedTransportCompanyContract_legal_client_order_id_fkey" FOREIGN KEY (legal_client_order_id) REFERENCES public.legal_orders(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: OutsourcedTransportCompanyContract OutsourcedTransportCompanyContract_outsourced_transport_co_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompanyContract" - ADD CONSTRAINT "OutsourcedTransportCompanyContract_outsourced_transport_co_fkey" FOREIGN KEY (outsourced_transport_company_id) REFERENCES public."OutsourcedTransportCompany"(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: OutsourcedTransportCompanyContract OutsourcedTransportCompanyContract_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompanyContract" - ADD CONSTRAINT "OutsourcedTransportCompanyContract_updated_by_fkey" FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: OutsourcedTransportCompany OutsourcedTransportCompany_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompany" - ADD CONSTRAINT "OutsourcedTransportCompany_created_by_fkey" FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: OutsourcedTransportCompany OutsourcedTransportCompany_legal_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompany" - ADD CONSTRAINT "OutsourcedTransportCompany_legal_person_id_fkey" FOREIGN KEY (legal_person_id) REFERENCES public.legal_people(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: OutsourcedTransportCompany OutsourcedTransportCompany_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."OutsourcedTransportCompany" - ADD CONSTRAINT "OutsourcedTransportCompany_updated_by_fkey" FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: _VehicleBodyworkToVehicleType _VehicleBodyworkToVehicleType_A_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."_VehicleBodyworkToVehicleType" - ADD CONSTRAINT "_VehicleBodyworkToVehicleType_A_fkey" FOREIGN KEY ("A") REFERENCES public.vehicle_bodyworks(id) ON UPDATE CASCADE ON DELETE CASCADE; - - --- --- Name: _VehicleBodyworkToVehicleType _VehicleBodyworkToVehicleType_B_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."_VehicleBodyworkToVehicleType" - ADD CONSTRAINT "_VehicleBodyworkToVehicleType_B_fkey" FOREIGN KEY ("B") REFERENCES public.vehicle_types(id) ON UPDATE CASCADE ON DELETE CASCADE; - - --- --- Name: carrier_companies carrier_companies_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.carrier_companies - ADD CONSTRAINT carrier_companies_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: carrier_companies carrier_companies_legal_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.carrier_companies - ADD CONSTRAINT carrier_companies_legal_person_id_fkey FOREIGN KEY (legal_person_id) REFERENCES public.legal_people(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: carrier_companies carrier_companies_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.carrier_companies - ADD CONSTRAINT carrier_companies_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: ciots_for_legal_clients ciots_for_legal_clients_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.ciots_for_legal_clients - ADD CONSTRAINT ciots_for_legal_clients_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: ciots_for_legal_clients ciots_for_legal_clients_legal_contract_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.ciots_for_legal_clients - ADD CONSTRAINT ciots_for_legal_clients_legal_contract_id_fkey FOREIGN KEY (legal_contract_id) REFERENCES public."legal_Contracts"(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: ciots_for_legal_clients ciots_for_legal_clients_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.ciots_for_legal_clients - ADD CONSTRAINT ciots_for_legal_clients_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: company_vehicles company_vehicles_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.company_vehicles - ADD CONSTRAINT company_vehicles_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.carrier_companies(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: company_vehicles company_vehicles_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.company_vehicles - ADD CONSTRAINT company_vehicles_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: company_vehicles company_vehicles_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.company_vehicles - ADD CONSTRAINT company_vehicles_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: company_vehicles company_vehicles_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.company_vehicles - ADD CONSTRAINT company_vehicles_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES public.vehicles(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: completed_orders completed_orders_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.completed_orders - ADD CONSTRAINT completed_orders_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES public.vehicles(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: contract_outsourced_drivers contract_outsourced_drivers_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.contract_outsourced_drivers - ADD CONSTRAINT contract_outsourced_drivers_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: contract_outsourced_drivers contract_outsourced_drivers_outsourced_driver_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.contract_outsourced_drivers - ADD CONSTRAINT contract_outsourced_drivers_outsourced_driver_id_fkey FOREIGN KEY (outsourced_driver_id) REFERENCES public.outsourced_drivers(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: contract_outsourced_drivers contract_outsourced_drivers_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.contract_outsourced_drivers - ADD CONSTRAINT contract_outsourced_drivers_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: freight_expenses freight_expenses_physical_customer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.freight_expenses - ADD CONSTRAINT freight_expenses_physical_customer_id_fkey FOREIGN KEY (physical_customer_id) REFERENCES public.physical_orders(id) ON UPDATE CASCADE ON DELETE SET NULL; - - --- --- Name: icms icms_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.icms - ADD CONSTRAINT icms_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: icms icms_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.icms - ADD CONSTRAINT icms_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_Contracts legal_Contracts_carrier_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."legal_Contracts" - ADD CONSTRAINT "legal_Contracts_carrier_company_id_fkey" FOREIGN KEY (carrier_company_id) REFERENCES public.carrier_companies(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_Contracts legal_Contracts_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."legal_Contracts" - ADD CONSTRAINT "legal_Contracts_created_by_fkey" FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_Contracts legal_Contracts_legal_client_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."legal_Contracts" - ADD CONSTRAINT "legal_Contracts_legal_client_id_fkey" FOREIGN KEY (legal_client_id) REFERENCES public.legal_clients(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_Contracts legal_Contracts_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."legal_Contracts" - ADD CONSTRAINT "legal_Contracts_updated_by_fkey" FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_client_cte legal_client_cte_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_client_cte - ADD CONSTRAINT legal_client_cte_order_id_fkey FOREIGN KEY (order_id) REFERENCES public.legal_orders(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: freight_expenses legal_client_order_fk; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.freight_expenses - ADD CONSTRAINT legal_client_order_fk FOREIGN KEY (legal_client_order_id) REFERENCES public.legal_orders(id) ON UPDATE CASCADE ON DELETE SET NULL; - - --- --- Name: legal_client_quote legal_client_quote_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_client_quote - ADD CONSTRAINT legal_client_quote_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_client_quote legal_client_quote_recipient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_client_quote - ADD CONSTRAINT legal_client_quote_recipient_id_fkey FOREIGN KEY (recipient_id) REFERENCES public.recipient(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_client_quote legal_client_quote_sender_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_client_quote - ADD CONSTRAINT legal_client_quote_sender_id_fkey FOREIGN KEY (sender_id) REFERENCES public.sender(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_client_quote legal_client_quote_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_client_quote - ADD CONSTRAINT legal_client_quote_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_clients legal_clients_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_clients - ADD CONSTRAINT legal_clients_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_clients legal_clients_legal_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_clients - ADD CONSTRAINT legal_clients_legal_person_id_fkey FOREIGN KEY (legal_person_id) REFERENCES public.legal_people(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_clients legal_clients_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_clients - ADD CONSTRAINT legal_clients_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_orders legal_orders_carrier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_orders - ADD CONSTRAINT legal_orders_carrier_id_fkey FOREIGN KEY (carrier_id) REFERENCES public.carrier_companies(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_orders legal_orders_completed_orders_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_orders - ADD CONSTRAINT legal_orders_completed_orders_id_fkey FOREIGN KEY (completed_orders_id) REFERENCES public.completed_orders(id) ON UPDATE CASCADE ON DELETE SET NULL; - - --- --- Name: legal_orders legal_orders_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_orders - ADD CONSTRAINT legal_orders_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_orders legal_orders_legal_contract_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_orders - ADD CONSTRAINT legal_orders_legal_contract_id_fkey FOREIGN KEY (legal_contract_id) REFERENCES public."legal_Contracts"(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_orders legal_orders_order_processing_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_orders - ADD CONSTRAINT legal_orders_order_processing_id_fkey FOREIGN KEY (order_processing_id) REFERENCES public.order_procesing(id) ON UPDATE CASCADE ON DELETE SET NULL; - - --- --- Name: legal_orders legal_orders_quote_table_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_orders - ADD CONSTRAINT legal_orders_quote_table_id_fkey FOREIGN KEY (quote_table_id) REFERENCES public.legal_client_quote(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: legal_orders legal_orders_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.legal_orders - ADD CONSTRAINT legal_orders_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: maintenance_companies maintenance_companies_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance_companies - ADD CONSTRAINT maintenance_companies_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: maintenance_companies maintenance_companies_legal_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance_companies - ADD CONSTRAINT maintenance_companies_legal_person_id_fkey FOREIGN KEY (legal_person_id) REFERENCES public.legal_people(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: maintenance_companies maintenance_companies_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance_companies - ADD CONSTRAINT maintenance_companies_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: maintenance maintenance_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance - ADD CONSTRAINT maintenance_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: maintenance maintenance_maintenance_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance - ADD CONSTRAINT maintenance_maintenance_company_id_fkey FOREIGN KEY (maintenance_company_id) REFERENCES public.maintenance_companies(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: maintenance maintenance_type_of_maintenance_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance - ADD CONSTRAINT maintenance_type_of_maintenance_id_fkey FOREIGN KEY (type_of_maintenance_id) REFERENCES public.types_of_maintenances(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: maintenance maintenance_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance - ADD CONSTRAINT maintenance_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: maintenance maintenance_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.maintenance - ADD CONSTRAINT maintenance_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES public.vehicles(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: order_procesing order_procesing_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.order_procesing - ADD CONSTRAINT order_procesing_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES public.vehicles(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourcedT_transport_company_driver outsourcedT_transport_company_driver_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."outsourcedT_transport_company_driver" - ADD CONSTRAINT "outsourcedT_transport_company_driver_created_by_fkey" FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourcedT_transport_company_driver outsourcedT_transport_company_driver_natural_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."outsourcedT_transport_company_driver" - ADD CONSTRAINT "outsourcedT_transport_company_driver_natural_person_id_fkey" FOREIGN KEY (natural_person_id) REFERENCES public.natural_people(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourcedT_transport_company_driver outsourcedT_transport_company_driver_outsourced_transport__fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."outsourcedT_transport_company_driver" - ADD CONSTRAINT "outsourcedT_transport_company_driver_outsourced_transport__fkey" FOREIGN KEY (outsourced_transport_company_id) REFERENCES public."OutsourcedTransportCompany"(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourcedT_transport_company_driver outsourcedT_transport_company_driver_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public."outsourcedT_transport_company_driver" - ADD CONSTRAINT "outsourcedT_transport_company_driver_updated_by_fkey" FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_drivers outsourced_drivers_company_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_drivers - ADD CONSTRAINT outsourced_drivers_company_vehicle_id_fkey FOREIGN KEY (company_vehicle_id) REFERENCES public.company_vehicles(id) ON UPDATE CASCADE ON DELETE SET NULL; - - --- --- Name: outsourced_drivers outsourced_drivers_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_drivers - ADD CONSTRAINT outsourced_drivers_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_drivers outsourced_drivers_natural_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_drivers - ADD CONSTRAINT outsourced_drivers_natural_person_id_fkey FOREIGN KEY (natural_person_id) REFERENCES public.natural_people(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_drivers outsourced_drivers_outsourced_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_drivers - ADD CONSTRAINT outsourced_drivers_outsourced_vehicle_id_fkey FOREIGN KEY (outsourced_vehicle_id) REFERENCES public.outsourced_vehicles(id) ON UPDATE CASCADE ON DELETE SET NULL; - - --- --- Name: outsourced_drivers outsourced_drivers_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_drivers - ADD CONSTRAINT outsourced_drivers_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_transport_vehicle outsourced_transport_vehicle_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_transport_vehicle - ADD CONSTRAINT outsourced_transport_vehicle_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_transport_vehicle outsourced_transport_vehicle_outsourced_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_transport_vehicle - ADD CONSTRAINT outsourced_transport_vehicle_outsourced_company_id_fkey FOREIGN KEY (outsourced_company_id) REFERENCES public."OutsourcedTransportCompany"(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_transport_vehicle outsourced_transport_vehicle_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_transport_vehicle - ADD CONSTRAINT outsourced_transport_vehicle_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_transport_vehicle outsourced_transport_vehicle_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_transport_vehicle - ADD CONSTRAINT outsourced_transport_vehicle_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES public.vehicles(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_vehicles outsourced_vehicles_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_vehicles - ADD CONSTRAINT outsourced_vehicles_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_vehicles outsourced_vehicles_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_vehicles - ADD CONSTRAINT outsourced_vehicles_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: outsourced_vehicles outsourced_vehicles_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.outsourced_vehicles - ADD CONSTRAINT outsourced_vehicles_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES public.vehicles(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: own_drivers own_drivers_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.own_drivers - ADD CONSTRAINT own_drivers_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; - - --- --- Name: own_drivers own_drivers_natural_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin --- - -ALTER TABLE ONLY public.own_drivers - ADD CONSTRAINT own_drivers_natural_person_id_fkey FOREIGN KEY (natural_person_id) REFERENCES public.natural_people(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public."Incident" (id, description, date_incident, order_process_id, date_resolved, created_by, updated_by, created_at, updated_at) FROM stdin; +ca5557fe-0550-4b67-8ab5-1e94c3ae24a3 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:15.888 2024-04-25 23:06:15.888 +3689b656-5fb5-43b2-80dd-3a9669e949f0 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:18.263 2024-04-25 23:06:18.263 +fb10357a-c8b6-43a2-99d1-3ce210554347 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:18.906 2024-04-25 23:06:18.906 +53c49e2a-7745-4c12-a3b2-6fb6b1edbf23 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:19.406 2024-04-25 23:06:19.406 +551786ae-6892-420a-be9b-c3edd9565191 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:19.863 2024-04-25 23:06:19.863 +26d857c3-d85c-4544-9009-d28229098744 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:20.802 2024-04-25 23:06:20.802 +d9ed0ef5-8fbd-4d67-b3fe-28dbf1a03642 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.093 2024-04-25 23:06:21.093 +49726d48-42e7-4aef-a0ab-dd5db0f8b85c Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.273 2024-04-25 23:06:21.273 +e8db7f0a-6e6b-4fb2-a634-a29d8fac2f9f Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.502 2024-04-25 23:06:21.502 +cb52912f-a5e4-42d0-8838-8a6cd0b56161 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.602 2024-04-25 23:06:21.602 +2d7d108a-f6a6-44a5-917f-8a0bd4ec6131 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.758 2024-04-25 23:06:21.758 +9e2c3b40-2c5d-4b5e-bbc6-7300da232f3a Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:21.933 2024-04-25 23:06:21.933 +c5ddfdb5-263d-4023-927b-2d4562588570 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.082 2024-04-25 23:06:22.082 +c4395936-8e54-4883-af86-055e09ad505e Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.242 2024-04-25 23:06:22.242 +62ae3146-4217-41e7-8c98-728e4b9f9e80 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.401 2024-04-25 23:06:22.401 +beb6b230-2ed1-4562-95f7-0457913f3a40 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.591 2024-04-25 23:06:22.591 +8963474f-8dd3-44f0-aee2-ca01b34fcacd Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.752 2024-04-25 23:06:22.752 +d121766b-4735-4afe-ac19-979eb51b7e30 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:22.899 2024-04-25 23:06:22.899 +5b89812b-31a6-465c-b4ea-7260a526c42f Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.054 2024-04-25 23:06:23.054 +cf700905-c91c-49a8-ba64-072d69c755ea Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.151 2024-04-25 23:06:23.151 +1ed9bbc4-ba1d-4e28-b71a-8edfdfa076b0 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.311 2024-04-25 23:06:23.311 +73003aab-0e73-48e3-9243-ae6f70e46a88 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.481 2024-04-25 23:06:23.481 +ea69c569-65e8-4e71-a3a0-8885bb7aa35b Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.652 2024-04-25 23:06:23.652 +c1546047-a274-4768-a65f-68252d24321b Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:23.892 2024-04-25 23:06:23.892 +305bf500-c4c8-4ed9-9d84-a8cf40455534 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.191 2024-04-25 23:06:24.191 +4d97f47d-8f08-4c2a-811d-abfc591ec4aa Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.331 2024-04-25 23:06:24.331 +8ca44084-54ec-42d3-8a96-540e82bb34ed Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.481 2024-04-25 23:06:24.481 +b5e1ab0a-6cf4-4c4c-a388-e0c80ae17b1f Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.621 2024-04-25 23:06:24.621 +472f501d-5c39-428a-b965-de86b03af9d6 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.771 2024-04-25 23:06:24.771 +65ab0d8c-5437-4efa-b57a-88e5dfb78338 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.931 2024-04-25 23:06:24.931 +9496dcc5-2c45-46c2-abe9-aaea6e150928 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.084 2024-04-25 23:06:25.084 +7734a541-b2a8-48ac-b846-36612d85e32a Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.221 2024-04-25 23:06:25.221 +c5ab9600-4bb6-4b81-8bd3-c6ac6f360ac8 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.361 2024-04-25 23:06:25.361 +c90b3c20-7d03-4202-aaf3-f0ee9526b9dd Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.521 2024-04-25 23:06:25.521 +ab17944e-7d35-499d-9ccb-a6b5c8748101 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.681 2024-04-25 23:06:25.681 +bd31bca8-ca40-436a-b2e0-d94644580f9d Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:25.841 2024-04-25 23:06:25.841 +838a2587-c892-44b0-8a22-3d5793eba5b9 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.002 2024-04-25 23:06:26.002 +7554cb1f-d233-47af-876d-8c767b7f4aa3 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.161 2024-04-25 23:06:26.161 +8ea90c2f-668f-4477-ba39-4c9012322e04 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.311 2024-04-25 23:06:26.311 +d4be9848-1a1a-4853-b41f-05eeddba98ad Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.461 2024-04-25 23:06:26.461 +83bf5264-105b-4a19-abee-04bf905f04d3 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.611 2024-04-25 23:06:26.611 +88f5bc1c-6c45-4df6-8e44-cfe141186475 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.761 2024-04-25 23:06:26.761 +a4671558-f32d-4f48-9db6-775c812776e6 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:26.921 2024-04-25 23:06:26.921 +eee19a3d-f312-4cd7-975d-0b1b843f2bf1 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.082 2024-04-25 23:06:27.082 +2a1d7b29-634a-472c-9163-9774263e5d82 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.221 2024-04-25 23:06:27.221 +2f6140de-8ed3-462f-a5f3-cc34c1717e38 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.361 2024-04-25 23:06:27.361 +e847cd33-9109-4baa-837d-43e2459c2508 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.531 2024-04-25 23:06:27.531 +d624b780-8474-4c75-aca9-db7f2764b821 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.683 2024-04-25 23:06:27.683 +585acb9f-1118-43ee-880d-f1eb5f9368f3 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.872 2024-04-25 23:06:27.872 +6c90d39f-a353-4a56-97b7-9ee8940de401 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:27.971 2024-04-25 23:06:27.971 +196d831a-efab-4107-ba08-d20e00b64bff TTE 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:24.032 2024-04-25 23:20:02.757 +28608229-79c7-4ec9-a4ed-03899cc454e0 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.322 2024-04-25 23:06:28.322 +14bcbc2a-96f7-4ff5-9796-a7d74cda4e99 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.484 2024-04-25 23:06:28.484 +7e625d7a-a70e-4251-81e6-7c8ce202824e Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.631 2024-04-25 23:06:28.631 +ff8b0dba-2b67-44af-9722-330d350c95b6 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.791 2024-04-25 23:06:28.791 +834259f2-a3d2-4647-922c-e5634e178095 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:28.924 2024-04-25 23:06:28.924 +f30c7ace-2120-4781-9667-d8c93b7c6d59 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:29.081 2024-04-25 23:06:29.081 +f2cc415f-f086-4f78-9692-ba570eb7d9be Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:29.551 2024-04-25 23:06:29.551 +a9b86bfc-286c-442f-b5ab-bc6bb2cb725b Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:29.701 2024-04-25 23:06:29.701 +5b0fc440-56dd-49ba-a750-00c2dd21fca4 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:29.851 2024-04-25 23:06:29.851 +db8751a2-4237-4c23-9f6e-4677158b83c6 Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:30.061 2024-04-25 23:06:30.061 +f9941760-a140-4c3f-aa7f-25c4abde46aa Tesdr 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:30.141 2024-04-25 23:06:30.141 +1317fc3e-1548-4d24-b560-55d6d9eda30e Sasds 1970-01-20 20:08:00.458 1fc6f459-5fdf-4db8-a859-ed65a340da6d \N 123 123 2024-04-25 23:06:20.372 2024-04-25 23:20:02.757 +\. -- --- Name: own_drivers own_drivers_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: OutsourcedTransportCompany; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.own_drivers - ADD CONSTRAINT own_drivers_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public."OutsourcedTransportCompany" (id, legal_person_id, created_at, updated_at, created_by, updated_by) FROM stdin; +\. -- --- Name: physical_customer_cte physical_customer_cte_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: OutsourcedTransportCompanyContract; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_customer_cte - ADD CONSTRAINT physical_customer_cte_order_id_fkey FOREIGN KEY (order_id) REFERENCES public.physical_orders(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public."OutsourcedTransportCompanyContract" (id, outsourced_transport_company_id, carrier_company_id, legal_client_order_id, created_at, created_by, updated_at, updated_by, contract_number) FROM stdin; +\. -- --- Name: physical_customer_quote physical_customer_quote_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: _VehicleBodyworkToVehicleType; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_customer_quote - ADD CONSTRAINT physical_customer_quote_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public."_VehicleBodyworkToVehicleType" ("A", "B") FROM stdin; +\. -- --- Name: physical_customer_quote physical_customer_quote_recipient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: _prisma_migrations; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_customer_quote - ADD CONSTRAINT physical_customer_quote_recipient_id_fkey FOREIGN KEY (recipient_id) REFERENCES public.recipient(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public._prisma_migrations (id, checksum, finished_at, migration_name, logs, rolled_back_at, started_at, applied_steps_count) FROM stdin; +86f97020-8108-4e9e-8666-0fb7c1d01be4 45431af10c9cd3c2c808a4db361262f7a9e15241f3e02cabd8c03790b9422b65 2024-04-06 13:52:13.750487+00 20240207230346_ \N \N 2024-04-06 13:52:13.707158+00 1 +035c2fac-7439-4b7b-b98a-9ac7af47004a acba2316af180aaef7710a119059c0003851e91ea8c7cdbb1cc5131ce09b5fc7 2024-04-06 13:52:12.192844+00 20230609171326_init \N \N 2024-04-06 13:52:12.158706+00 1 +b4b98278-9861-40d1-8681-7dd35d7dea96 568d8939593ff4e3131b5ba1ea6d142f639ad7985ee702d51dca014884d47a4e 2024-04-06 13:52:13.433401+00 20231123223551_ \N \N 2024-04-06 13:52:13.424836+00 1 +3b8b9bce-1b26-4d97-b6af-3ab8a433afab 87f0bda62860a1689756c82cda25bdc99fd3b7cfc362f15cf62ca553c0ed2362 2024-04-06 13:52:12.761983+00 20230820000102_ \N \N 2024-04-06 13:52:12.196793+00 1 +37648ece-f08f-4957-8e23-7216130a5a39 d9a4e20063ef26f2dccc70d99378e645092456d5883b953bc04336102f9faf29 2024-04-06 13:52:12.786274+00 20230828010254_updated_relations_and_add_colum_updated_by_in_fields \N \N 2024-04-06 13:52:12.764554+00 1 +dd9d47be-5ec5-41b6-b902-f9960700c0cb e0dc270780a3f856760800327b298c745b3f568608543be5afadb3e15cb3486f 2024-04-06 13:52:12.833108+00 20230910004900_add_collum_capaciy_per_axle_in_vehicle_model \N \N 2024-04-06 13:52:12.788884+00 1 +df0f469f-6c67-440f-9bfe-cfb68e6a8e1e ea35a2cd2680d8294c64c77919baa399708b514f24dd321e61b5d172b76cebd9 2024-04-06 13:52:13.457032+00 20231128233242_ \N \N 2024-04-06 13:52:13.436136+00 1 +ea577176-d735-4504-8dd5-cf2ca6956acc 9825c28c2661af92618bcdbf92f57b94aae7616ccf367734c4ae441de2ab2a9d 2024-04-06 13:52:12.846145+00 20230912201735_ \N \N 2024-04-06 13:52:12.837274+00 1 +9aec36be-a393-409c-a4ac-10ba8cbfce38 2a21bff14e930a4db63183cab333045f86031c4ef9073fe24462a4a0cb3500fd 2024-04-06 13:52:12.860912+00 20231007214630_ \N \N 2024-04-06 13:52:12.850319+00 1 +d9b80eb4-ebf7-46f2-842e-a4eaaaa2d08d aa8e79339cb9b1067a8f65da6005dca8d5c8c13bda4e065ab6588882f065322f 2024-04-06 13:52:13.90455+00 20240309023509_alter_user_add_avatar_url \N \N 2024-04-06 13:52:13.892391+00 1 +7d581197-100e-4ac6-8dad-fb972a8026fd a2a58e276630960a219a79cc1af00cd30e2245d17a1b9e30fc47f0bd3fc1d05c 2024-04-06 13:52:12.885955+00 20231008140047_ \N \N 2024-04-06 13:52:12.863634+00 1 +b4705e33-56c8-4c5b-b1ba-f8543a23eb9a c4f7af956fb1731c74163da6ac8590ca8ebe764ce33df1e9fcace7c9754326b5 2024-04-06 13:52:13.473465+00 20231204231759_ \N \N 2024-04-06 13:52:13.460855+00 1 +297115a3-1cd4-4a6c-9d8f-d0fa8a1b2bca a236cd4fb43bd1b1e801808b3d41fc6b1581c55d1fc094febe6985cfe15f1e49 2024-04-06 13:52:12.911231+00 20231012185010_ \N \N 2024-04-06 13:52:12.890024+00 1 +7bea0690-0db7-4a74-b89e-461fca0b3c2c 04f690086bec157b7dc2b31f82e74acd81d65192aa4a05f78cbd48c09f956fe0 2024-04-06 13:52:12.950014+00 20231017214516_ \N \N 2024-04-06 13:52:12.915248+00 1 +b6dafbe2-9e68-44d6-8d79-75329dbd366c 0874c641a7e2895ade40edc8ce35aacdac6905a23086f646fb776c102c747618 2024-04-06 13:52:13.767414+00 20240213144500_ \N \N 2024-04-06 13:52:13.752953+00 1 +4b38609c-cdad-4b85-aed0-860a7eea22d7 9f7ae82ef8431e3c9afd90e5f9790a133952c5361684104c0144047a36d968f1 2024-04-06 13:52:12.966952+00 20231018232059_ \N \N 2024-04-06 13:52:12.953844+00 1 +8b04a995-dd48-4b1c-b0ae-cee5924f989e ecc1d33a81024087bd391902b40f7f3f267bae8a9d1fd9d0a42601473927b599 2024-04-06 13:52:13.484662+00 20231206210538_ \N \N 2024-04-06 13:52:13.476158+00 1 +7e3c79d9-17a2-49f0-bb2b-f48385fd53af c711294d8f228b18384079f750c5c42b08c99ec00b7dfb8b80751011a5d3ed44 2024-04-06 13:52:12.991545+00 20231022201723_ \N \N 2024-04-06 13:52:12.97118+00 1 +2ca3390f-d142-4fb8-93f5-4ff9d4541051 d892ff69e669ff9be048ecddcba48553d1f1c81216707a213028eb82947be66a 2024-04-06 13:52:13.016427+00 20231024233540_ \N \N 2024-04-06 13:52:12.995495+00 1 +cfb2b223-7e85-413e-9a5a-40df931b6070 4511c3f1e2ebd7df47a4dbdfcefe7ee7ed0dd2e0eb4ad31ddc3eda900ef98b95 2024-04-06 13:52:13.044639+00 20231025213429_ \N \N 2024-04-06 13:52:13.020487+00 1 +6cd7f4c1-e5a6-4617-a4a5-dabc56745bf6 b1a5463e7ee12eeee14daaac06347cd5adfb3f4d32cc399d9ab294d29b4ff57a 2024-04-06 13:52:13.619868+00 20231207223816_ \N \N 2024-04-06 13:52:13.487338+00 1 +cd7cbe5b-2aee-4496-bda5-a918f32d17d1 50e1710fe40d82ecf7e3b1930e7047f55ac9d01e4c59ef955d3b808b2921b44a 2024-04-06 13:52:13.422383+00 20231102204736_ \N \N 2024-04-06 13:52:13.048991+00 1 +b16f66f8-361e-4b3b-8d6a-9160d161f849 ae96487c5846ebca7011d9b32ed54819e9e00c8d5931877c8bd2d913779a08d0 2024-04-06 13:52:13.855807+00 20240307215818_ajust_physical_customer_order_name_physical_merchandise \N \N 2024-04-06 13:52:13.842156+00 1 +5ca754cd-ba67-44bf-8936-80c970bfb743 13e387555de8213a13cb51c4bfc968db4adbc1ca91f8883b1e71c563d5ff47f1 2024-04-06 13:52:13.64265+00 20231212223708_ \N \N 2024-04-06 13:52:13.622525+00 1 +f6c6c049-2a5b-4bc4-9a02-d7cd589778b2 3e7fc3877ff9f25ac3c3db60344da39889fecdb33d59ae9800fce6340df6ddc2 2024-04-06 13:52:13.791199+00 20240306003738_add_rntc_field_in_carrier_company_table \N \N 2024-04-06 13:52:13.771194+00 1 +3847e840-2586-4f06-92a0-7f754862dabc cea223ee81c3c8c8203f035ac121303caca6a8709969a7dc906d00ba99b61968 2024-04-06 13:52:13.659786+00 20240103223054_ \N \N 2024-04-06 13:52:13.646674+00 1 +d167db32-9e6d-41df-9280-93785263599f 512345d7b210fcc03a1ba80fa7d8e2c968173909e89fb514055c090b91017dc9 2024-04-06 13:52:13.677612+00 20240123214447_ \N \N 2024-04-06 13:52:13.662456+00 1 +c8082c19-7d68-44b8-9e1f-206e84d71be2 0e6c4b57a15f54b6c944aca0c19ad58fee9eb3ade2debb51453ff6ba532e0761 2024-04-06 13:52:13.702903+00 20240123232954_ \N \N 2024-04-06 13:52:13.681731+00 1 +ef330ce8-fbe9-4c80-aab5-bf5b652450e2 31c71430881ced0eed19c974c519eef6ab9e8dedbc511c869af2aa8960a8de47 2024-04-06 13:52:13.804732+00 20240306202547_change_field_rntrc_expiration_for_antt_in_vehicle_table \N \N 2024-04-06 13:52:13.795188+00 1 +0902ad20-fb16-45f2-b456-44dec60c93fc a60bc65baede98c063337f076a4d583d39b406653df414a4a78eb19955acd3cf 2024-04-06 13:52:13.870599+00 20240307224431_ \N \N 2024-04-06 13:52:13.859952+00 1 +60bced6e-4b54-44b4-a5e7-ce551ef59a95 5bdb5270d77daddd84cc974ece77213d3b64f98367c1d3ac80d5d98447329839 2024-04-06 13:52:13.815712+00 20240306205703_add_field_registration_and_is_ipva_paid_in_vehicle \N \N 2024-04-06 13:52:13.807234+00 1 +e8ce51eb-fb65-4eed-ae65-b745f52c20a4 dd5a2e2ac68423fbbd10290809eca4768c9217e596bed8fac3e9338b84fb8d37 2024-04-06 13:52:13.838042+00 20240307215512_ \N \N 2024-04-06 13:52:13.818551+00 1 +f2020582-0abc-4c4a-a6e1-b6b2d1d628ec 42756acc2997db4b8b29e90b5dc4400874d6aebd0bf4fa7fd1c0bddba512fb93 2024-04-06 13:52:13.888307+00 20240309010946_ \N \N 2024-04-06 13:52:13.87333+00 1 +d68571a8-aced-48e2-8bc6-cff0d818b9a0 f7f59f7bc3668f0d235bac5e6b5d76fe06fa14cb5ab36d402b0e419509784561 2024-04-06 13:52:14.098032+00 20240314203951_ \N \N 2024-04-06 13:52:14.045754+00 1 +ccd1da8e-a370-47c1-b1f8-eb975e57d21f 0cf76e44c3474d633ce5e9b56ad7811bb5bd725ad5b186f4a28aeba43006db52 2024-04-06 13:52:14.022541+00 20240309233038_ \N \N 2024-04-06 13:52:13.908785+00 1 +fa89cbce-fd10-4992-b084-c2e087d4d9b6 5c2023e3b7147bbb15ac8fce81b883d9a2a1924b5b0a85d6844ca420b9f25938 2024-04-06 13:52:14.041759+00 20240312203959_ \N \N 2024-04-06 13:52:14.026354+00 1 +98e8777f-034d-4699-a189-9119605444d2 d47d95bcc01e8a19299da996e13b27486cbb7440132df3c5bf133af2010f0423 2024-04-06 13:52:14.162124+00 20240317181959_ \N \N 2024-04-06 13:52:14.15005+00 1 +139d3df5-afb7-408b-9e91-32f8ecd5cc53 a290351ffc28d69e35c5c2db54af498fbc7d42e7bfa39f5ee65a3fa60cc468fd 2024-04-06 13:52:14.146317+00 20240317150314_ \N \N 2024-04-06 13:52:14.101748+00 1 +22b7ac84-d46a-4788-b987-1cf8111a27f0 4e1d8b23d929bee18b10a2ceb7b7244b85c8a40c070dab54769bdbfe3a8ab065 2024-04-06 13:52:14.186785+00 20240317183039_ \N \N 2024-04-06 13:52:14.166083+00 1 +a46f7ded-3fab-4f9d-a168-ea05203bb543 dff0a82a2ff2832debaa745a67ac0b2b7a815e711e08d29b242e1690b52d070a 2024-04-06 13:52:14.264106+00 20240320210539_ \N \N 2024-04-06 13:52:14.189357+00 1 +7b62022d-fda5-4e48-bd3d-870cd74a9a7d f84aeb97c662a768ba25a4ae2ecf11a5e94d245af5637118d48c81e456d66546 2024-04-06 13:52:14.28068+00 20240320211615_ \N \N 2024-04-06 13:52:14.267897+00 1 +752e7219-d57f-4782-b5da-ca8cb5539342 7f89276b06ab582101d24d20da3b8d2373fb9e75d4d6fa8951328e1c7a0c961c 2024-04-06 13:52:14.399714+00 20240322230238_ \N \N 2024-04-06 13:52:14.283863+00 1 +0880b2b6-fbc9-4395-a24d-d23f8cf91615 65a324cfcb6798443980343aba66d07f5dbbd89923f1f5328fcbc472162940a0 2024-04-06 13:52:14.428769+00 20240328213005_ \N \N 2024-04-06 13:52:14.402157+00 1 +c4f8cb69-25c3-45a0-936b-0e1fa3041659 40fe5f3ea588b176a4f5ff14a618d0755358a485753e9eee2146fab9a65133a7 2024-04-06 13:52:14.440571+00 20240401215129_ \N \N 2024-04-06 13:52:14.431315+00 1 +cd7957f8-1d69-42dd-8644-26b6a35ea57f 1778ca6485dcbe411ae1764d2836095f4cc2938a0cf7e34e4361e358fca6bde4 2024-04-06 13:52:14.461796+00 20240405223110_ \N \N 2024-04-06 13:52:14.443135+00 1 +6abce501-8470-4039-87ff-947df176bd55 91df33b423381710351db6da2e86d85e2ddbedaaea17358b7fdbfa66b0a73e91 2024-04-06 13:52:14.484653+00 20240406132931_ \N \N 2024-04-06 13:52:14.46564+00 1 +c23c39f7-fcad-45f8-b7e2-4f3583ec9e2d 7985528159c7e73d724599a92d92061fc6d4d9dbab211c2aed528c7ad6679dbf 2024-04-06 13:52:14.495939+00 20240406135042_ \N \N 2024-04-06 13:52:14.487204+00 1 +280f2a5c-70e0-4bf7-8038-da1b40e0263d f5b3711b14236779cdddf6e337f92643f1bba6956948e10a44b1f43b96dd3937 2024-04-06 15:32:48.743248+00 20240406153248_ \N \N 2024-04-06 15:32:48.72288+00 1 +38a13786-6462-4520-9196-d2482518bd7c 0d682df77e7a36a7988d2961ff25d34b37974a0578336a0657e559e0ae756314 2024-04-23 22:41:32.974907+00 20240423224132_add_status_in_order_processing_entity \N \N 2024-04-23 22:41:32.91874+00 1 +\. -- --- Name: physical_customer_quote physical_customer_quote_senderId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: carrier_companies; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_customer_quote - ADD CONSTRAINT "physical_customer_quote_senderId_fkey" FOREIGN KEY ("senderId") REFERENCES public.sender(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.carrier_companies (id, created_at, updated_at, created_by, updated_by, legal_person_id, rntrc) FROM stdin; +470a163e-653a-4ede-81f5-793523d012c1 2024-04-06 15:38:54.437 2024-04-07 19:16:13.352 123 123 1fe38c07-ef31-49c1-8ebd-f14cacf0383d 1452781914545 +\. -- --- Name: physical_customer_quote physical_customer_quote_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: ciots_for_legal_clients; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_customer_quote - ADD CONSTRAINT physical_customer_quote_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.ciots_for_legal_clients (id, ciot, emission_date, legal_contract_id, created_at, updated_at, created_by, updated_by) FROM stdin; +\. -- --- Name: physical_customers physical_customers_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: company_vehicles; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_customers - ADD CONSTRAINT physical_customers_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.company_vehicles (id, created_at, updated_at, created_by, vehicle_id, updated_by, company_id, "orderProcessingLegalClientId") FROM stdin; +6dbc6ae0-c120-4dc0-bc88-ec57eb35b90f 2024-04-06 18:53:39.459 2024-04-06 18:53:39.459 123 54db2725-2297-497f-a0a0-848c57e14315 123 470a163e-653a-4ede-81f5-793523d012c1 \N +\. -- --- Name: physical_customers physical_customers_natural_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: completed_orders; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_customers - ADD CONSTRAINT physical_customers_natural_person_id_fkey FOREIGN KEY (natural_person_id) REFERENCES public.natural_people(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.completed_orders (id, order_processing_number, vehicle_id, total_distance, total_spend_liters, total_spending_money, start_at, end_at, updated_at, created_at, created_by, updated_by) FROM stdin; +\. -- --- Name: physical_customers physical_customers_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: contract_outsourced_drivers; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_customers - ADD CONSTRAINT physical_customers_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.contract_outsourced_drivers (id, type, situation, start_at, end_at, created_at, updated_at, created_by, cpf, updated_by, outsourced_driver_id, contract_number) FROM stdin; +f1671112-7b1a-4963-8d55-13d0c72f00b9 Temporario ABERTO 1970-01-20 20:02:06.004 1970-01-20 20:02:06.004 2024-04-21 19:02:02.078 2024-04-21 19:02:02.078 123 14521452361 123 a64a956b-0a49-46e1-9e55-6dcee8647aa2 11012101 +55b00d8c-5977-49d4-9a93-b6b455aaaac2 Temporario Temporada 1970-01-20 20:02:06.004 1970-01-20 20:02:06.005 2024-04-21 19:22:49.821 2024-04-21 19:22:49.821 123 14521452361 123 a64a956b-0a49-46e1-9e55-6dcee8647aa2 10201000 +e2181f42-2145-4229-9f60-c45e2dd39b6b Temporario Finalizado 1970-01-20 20:02:06.004 1970-01-20 20:02:06.005 2024-04-21 19:22:49.822 2024-04-21 19:22:49.822 123 14521452361 123 a64a956b-0a49-46e1-9e55-6dcee8647aa2 21204110 +\. -- --- Name: physical_orders physical_orders_carrier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: freight_expenses; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_orders - ADD CONSTRAINT physical_orders_carrier_id_fkey FOREIGN KEY (carrier_id) REFERENCES public.carrier_companies(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.freight_expenses (id, expense_name, value, legal_client_order_id, physical_customer_id) FROM stdin; +be85ba9d-52c2-4735-aa43-31774f7aab3c GASOLINA 452.4 \N 49dc129e-c222-488d-9e11-6961ef36d528 +\. -- --- Name: physical_orders physical_orders_completedOrdersId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: icms; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_orders - ADD CONSTRAINT "physical_orders_completedOrdersId_fkey" FOREIGN KEY ("completedOrdersId") REFERENCES public.completed_orders(id) ON UPDATE CASCADE ON DELETE SET NULL; +COPY public.icms (id, state_orgin, recipient_state, aliquot, effective_date, created_at, updated_at, created_by, updated_by) FROM stdin; +f2da4c2f-be79-400d-9450-623119958e98 SP SP 14 1970-01-20 20:08:00.459 2024-04-25 21:28:01.51 2024-04-25 21:28:01.51 123 123 +\. -- --- Name: physical_orders physical_orders_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: legal_Contracts; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_orders - ADD CONSTRAINT physical_orders_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public."legal_Contracts" (id, legal_client_id, carrier_company_id, contract_number, created_at, created_by, delivery_conditions, effective_date, observations, updated_at, updated_by) FROM stdin; +d9655225-b9ec-44c6-983d-d798f4d66aaf 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC11002010 2024-04-29 21:01:30.609 123 sdasd 1970-01-01 04:52:25.145 dsadsad 2024-04-29 21:01:30.609 123 +714eec05-ecdc-4774-9876-1e894da57889 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC40000110 2024-04-29 22:31:44.39 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:44.39 123 +7c547329-f7fe-4464-804a-ff7978bbfae3 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC00122511 2024-04-29 22:31:44.969 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:44.969 123 +f0922a91-fae8-4536-866d-9a9138dd3153 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC05021742 2024-04-29 22:31:45.429 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:45.429 123 +ba8129fe-f77b-4eec-b4d1-cc5a2bc92222 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC02441202 2024-04-29 22:31:45.63 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:45.63 123 +ba2891c2-91e5-4dba-b401-2df5b28915ac 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC02100252 2024-04-29 22:31:46.12 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.12 123 +e52ea003-6861-4e65-8d6c-ff3c6397e3b1 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC00000380 2024-04-29 22:31:46.251 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.251 123 +b4736032-4bac-4d8f-bfa8-4fb9f516f12b 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC20511001 2024-04-29 22:31:46.468 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.468 123 +8baa2319-bca2-4118-a780-ee9621b810e4 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC20200200 2024-04-29 22:31:46.681 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.681 123 +c5b6a5e9-3fb3-4dea-8ed9-52ff5fa6e0a8 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC11007112 2024-04-29 22:31:46.829 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.829 123 +84f1b3b0-4f96-4f11-8ef3-dc03e4ac2a5b 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC06004003 2024-04-29 22:31:46.969 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:46.969 123 +c4f4d320-766b-48b1-86cb-c443596283f2 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC02180520 2024-04-29 22:31:47.131 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.131 123 +b12d0feb-959d-469a-a036-26cc2bd8aa66 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC02111003 2024-04-29 22:31:47.45 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.45 123 +59e1d7e2-71c5-4062-ada3-a04824e5cb26 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC12302011 2024-04-29 22:31:47.599 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.599 123 +d315bed4-fd82-45bc-9b3e-c0d9489f3ce9 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC03110110 2024-04-29 22:31:47.739 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.739 123 +90fc930c-a806-461d-9ffc-dc4c9e95bf55 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC00001330 2024-04-29 22:31:47.9 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:47.9 123 +5d29908c-348c-4862-9a8e-7d7fdf45dae5 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC01102144 2024-04-29 22:31:48.04 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:31:48.04 123 +b1268bb0-1340-4025-88b7-11ac1116dd8a 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC00424000 2024-04-29 22:32:52.24 123 11446 1970-01-02 17:04:01.456 445246456 2024-04-29 22:32:52.24 123 +40e1dd30-a701-405e-8905-39f339f1575e 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC21400200 2024-04-29 22:31:47.32 123 11446 1970-01-02 17:04:01.456 AAAA 2024-04-29 22:35:10.504 123 +47679f92-d415-4497-a83f-312a45d0cc73 37bedfee-082f-4d06-8798-62842276a59f 470a163e-653a-4ede-81f5-793523d012c1 CLC63702103 2024-04-29 22:31:45.801 123 11446 1970-01-02 17:04:01.456 BBBBBB 2024-04-29 22:35:10.504 123 +\. -- --- Name: physical_orders physical_orders_order_processing_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: legal_client_cte; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_orders - ADD CONSTRAINT physical_orders_order_processing_id_fkey FOREIGN KEY (order_processing_id) REFERENCES public.order_procesing(id) ON UPDATE CASCADE ON DELETE SET NULL; +COPY public.legal_client_cte (id, order_id, access_key, type_cte, observations, cte_number) FROM stdin; +\. -- --- Name: physical_orders physical_orders_physical_customer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: legal_client_quote; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_orders - ADD CONSTRAINT physical_orders_physical_customer_id_fkey FOREIGN KEY (physical_customer_id) REFERENCES public.physical_customers(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.legal_client_quote (id, cod_quote, recipient_id, sender_id, who_pays, postal_cod_origin, postal_cod_destiny, type_merchandise, amount, description, mass, volume, nf_value, created_at, updated_at, created_by, updated_by) FROM stdin; +2bc444bc-4165-469f-8027-3b6f306d14c5 QT74550300 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:27.364 2024-04-27 15:19:27.364 123 123 +be08488b-9657-45a5-a943-948f34ae7b7e QT00160011 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:31.208 2024-04-27 15:19:31.208 123 123 +81d48c7f-96c0-47e0-bbb0-beb0c5270c0c QT05222000 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:41.417 2024-04-27 15:19:41.417 123 123 +9fc1fbfd-0119-4e38-b582-e6bcbfa734d1 QT03350061 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:42.833 2024-04-27 15:19:42.833 123 123 +40baeeb1-80e7-43ca-8ab3-02b350044bb9 QT00000313 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:43.253 2024-04-27 15:19:43.253 123 123 +ecce88b7-b92a-4b15-93cf-6b087888f1ae QT72030260 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:43.473 2024-04-27 15:19:43.473 123 123 +ff0fedbe-b272-4b4b-bce1-5f3f0d876add QT01212011 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:43.643 2024-04-27 15:19:43.643 123 123 +8a3e6181-e687-4402-9842-3b6ec9ec08ff QT02101130 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:43.857 2024-04-27 15:19:43.857 123 123 +c841cdca-b00b-47b1-9787-1354bead5bb1 QT10204001 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.183 2024-04-27 15:19:44.183 123 123 +774af8b5-7727-4ffa-a65d-c3d91364ba0e QT46001310 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.334 2024-04-27 15:19:44.334 123 123 +bcc5b815-837e-4f1d-916b-a8a650a27ac1 QT20210101 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.473 2024-04-27 15:19:44.473 123 123 +1c22018f-1269-4755-b172-355a14ceb166 QT00031041 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.602 2024-04-27 15:19:44.602 123 123 +1a8ccea5-083c-47aa-94eb-806e08c5b575 QT11201001 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.867 2024-04-27 15:19:44.867 123 123 +fe35057a-fe14-48ec-b8ea-e1af5876e88b QT30103030 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:44.962 2024-04-27 15:19:44.962 123 123 +5e8f7f44-9cdc-42ca-b985-5ac46dee7f9d QT31226021 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.152 2024-04-27 15:19:45.152 123 123 +b176f7a1-e105-49ec-bd7d-4faaf416c0b1 QT21020012 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.301 2024-04-27 15:19:45.301 123 123 +e43ed624-9543-458b-bb5a-1d9cffc88f03 QT51052510 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.434 2024-04-27 15:19:45.434 123 123 +4d68b92c-6604-46ae-8ea2-a6070c9084c8 QT10000002 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.574 2024-04-27 15:19:45.574 123 123 +aa2e953c-7275-4d0c-b9ae-41556f60e4bc QT00000032 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.822 2024-04-27 15:19:45.822 123 123 +d224ee84-ba4f-430b-a8c0-6ac1a82f8412 QT30001211 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:45.963 2024-04-27 15:19:45.963 123 123 +f205797b-4538-4841-aa45-c889322ce341 QT32090152 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.112 2024-04-27 15:19:46.112 123 123 +ecddb122-b42b-4bb6-8fd1-f92d1bd599cb QT51301030 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.423 2024-04-27 15:19:46.423 123 123 +b918f148-a52c-4fbb-975a-e0ec09162600 QT13400210 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.563 2024-04-27 15:19:46.563 123 123 +f791e669-6e07-4b5c-b17a-cd949cc54523 QT10000011 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.702 2024-04-27 15:19:46.702 123 123 +6627d9d6-cf50-432b-93fc-9b45e0ffa3e7 QT00200112 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:46.863 2024-04-27 15:19:46.863 123 123 +4dfb76d9-ef51-454e-95a1-6adbc285497e QT93001010 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.002 2024-04-27 15:19:47.002 123 123 +f41f8b97-fc71-475e-b492-dad1b5491042 QT10100020 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.152 2024-04-27 15:19:47.152 123 123 +82a441f0-04aa-483f-938d-913a3719f588 QT00060100 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.313 2024-04-27 15:19:47.313 123 123 +6b5873e3-923b-4cef-8f1a-e21ffcacb353 QT03220010 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.465 2024-04-27 15:19:47.465 123 123 +da200013-becd-4966-a727-c6889547a733 QT24111030 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.622 2024-04-27 15:19:47.622 123 123 +4c2ee03f-d463-4f41-a9f4-4401c516e560 QT10120001 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.825 2024-04-27 15:19:47.825 123 123 +137fb510-bbe3-41e6-8a3a-fe7a2fdcfd06 QT01000150 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 477 2024-04-27 15:19:46.273 2024-04-27 16:49:38.005 123 123 +8f6df0d6-bf4a-47f8-a110-263c2490f360 QT60412301 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:47.929 2024-04-27 15:19:47.929 123 123 +3312cd1f-db8d-4bcf-a1cc-ad8556a55568 QT04000001 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:48.102 2024-04-27 15:19:48.102 123 123 +a85f16e0-a6a1-4cb4-b712-16b2a292c569 QT15011120 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:48.542 2024-04-27 15:19:48.542 123 123 +59e8661b-b56f-497f-ba4d-97fc53439494 QT01001601 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:48.692 2024-04-27 15:19:48.692 123 123 +7d8642bb-d02e-481c-98af-33ff81a2cf83 QT00400452 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:48.847 2024-04-27 15:19:48.847 123 123 +110e1e70-f3a2-42ba-8d1d-4ddd03885566 QT31005300 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.013 2024-04-27 15:19:49.013 123 123 +304c56fa-a0cb-4b8a-8844-c76b423d57ea QT30210011 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.182 2024-04-27 15:19:49.182 123 123 +c48a4700-159f-4135-aab4-3aa5eba29425 QT20012010 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.322 2024-04-27 15:19:49.322 123 123 +2a6d9849-56c2-4cb2-9b3a-fa84d7d1ed76 QT01301301 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.492 2024-04-27 15:19:49.492 123 123 +c23364ba-c80a-42a4-a37c-4b2272374de2 QT10100250 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.642 2024-04-27 15:19:49.642 123 123 +85c800e1-2dab-41de-b7fd-4777f04e9eaa QT12029113 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.856 2024-04-27 15:19:49.856 123 123 +39a20a2c-a4c5-4943-8e56-eeea05430f1b QT11643010 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:49.965 2024-04-27 15:19:49.965 123 123 +4e5309aa-1718-4a55-a71d-6ec3c5bc29e6 QT10001000 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:50.132 2024-04-27 15:19:50.132 123 123 +2d66c8a0-319a-441e-acf7-34159f391b11 QT10303100 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 1524.14 2024-04-27 15:19:50.462 2024-04-27 15:19:50.462 123 123 +14638bb4-1630-4237-8d95-1b33107999ea QT40000107 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 17458525 0714527 GRÃO 25 Caixa 25.4 141 155 2024-04-27 15:19:50.303 2024-04-27 16:49:38.005 123 123 +\. -- --- Name: physical_orders physical_orders_quote_table_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: legal_clients; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_orders - ADD CONSTRAINT physical_orders_quote_table_id_fkey FOREIGN KEY (quote_table_id) REFERENCES public.physical_customer_quote(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.legal_clients (id, branch, legal_person_id, created_by, updated_by) FROM stdin; +37bedfee-082f-4d06-8798-62842276a59f Tesd ecf45722-63cb-4322-9e53-f0fed1e370fb 123 123 +\. -- --- Name: physical_orders physical_orders_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: legal_orders; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.physical_orders - ADD CONSTRAINT physical_orders_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.legal_orders (id, "order", created_at, updated_at, created_by, updated_by, legal_contract_id, order_processing_id, completed_orders_id, quote_table_id, carrier_id) FROM stdin; +30ed1d70-b584-4ad4-9ab0-eab4ecd1c62c OLC01313110 2024-04-29 21:02:45.751 2024-04-29 21:02:45.751 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +cf7a660b-76a2-471f-921a-d78ba9ed283e OLC11300212 2024-04-29 21:02:46.452 2024-04-29 21:02:46.452 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +8b57dab0-ee2a-4482-a4d6-451eaa16a8a9 OLC50111205 2024-04-29 21:02:46.974 2024-04-29 21:02:46.974 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +ffd4ac5b-a5ea-409a-b200-45a0b72e63f2 OLC52002650 2024-04-29 21:02:47.364 2024-04-29 21:02:47.364 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +76ed8d68-c22f-41e8-9801-dbd1b89d8d0f OLC20105010 2024-04-29 21:02:47.619 2024-04-29 21:02:47.619 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +21b6cf11-7b18-40d3-b6a2-043edf54096e OLC10013000 2024-04-29 21:02:47.851 2024-04-29 21:02:47.851 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +97eb95e9-8706-49b7-b80d-33c9ad5a6f94 OLC21306344 2024-04-29 21:02:48.066 2024-04-29 21:02:48.066 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +bf495782-640b-4987-90ef-f025a13709c3 OLC23010362 2024-04-29 21:02:48.262 2024-04-29 21:02:48.262 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +59a344f4-26ac-4cbb-8261-1a61c265eaed OLC11106211 2024-04-29 21:02:48.412 2024-04-29 21:02:48.412 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +d1d2ba6b-ffd6-42f4-a61b-174e1de5c509 OLC12501001 2024-04-29 21:02:48.595 2024-04-29 21:02:48.595 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +7399160e-4e49-4f41-8d57-98b40099e144 OLC31100652 2024-04-29 21:02:48.78 2024-04-29 21:02:48.78 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +b3d246d2-cf18-4479-a753-c42c95f973d9 OLC10100110 2024-04-29 21:02:48.948 2024-04-29 21:02:48.948 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +5cb73d77-8ae8-4f5e-b972-5c8f297b59a2 OLC12220100 2024-04-29 21:02:49.125 2024-04-29 21:02:49.125 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +5a96785a-f212-4816-8884-bf7d7b645850 OLC00500003 2024-04-29 21:02:49.286 2024-04-29 21:02:49.286 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +42cc8db6-a1ea-4125-9351-5763f8b6478e OLC15010400 2024-04-29 21:02:49.464 2024-04-29 21:02:49.464 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +4487a139-023d-4dbf-acde-083ac62dd31d OLC21143423 2024-04-29 21:02:49.644 2024-04-29 21:02:49.644 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +817b65bc-6298-4a12-9501-bc34e7439938 OLC12082100 2024-04-29 21:02:49.804 2024-04-29 21:02:49.804 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +87d4957b-d5ba-4220-8aef-7af521b0d763 OLC00521183 2024-04-29 21:02:50.151 2024-04-29 21:02:50.151 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +c343243a-6fae-4259-93ba-dc69bf62cdbd OLC01400352 2024-04-29 21:02:50.324 2024-04-29 21:02:50.324 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +fafd5343-cc8d-40c1-8031-dc8bedc8df0e OLC11002000 2024-04-29 21:02:50.493 2024-04-29 21:02:50.493 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +aec58633-eba7-4aed-b829-6473d189db65 OLC12220004 2024-04-29 21:02:50.669 2024-04-29 21:02:50.669 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +2a5ef9e3-d7f5-4ff5-beaf-6c67011866ec OLC00000201 2024-04-29 21:02:50.831 2024-04-29 21:02:50.831 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +bb5564ed-768c-4cd5-ab42-b788a58f33d1 OLC03120010 2024-04-29 21:02:50.99 2024-04-29 21:02:50.99 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +7fb0d687-ff81-410b-a80c-f51ed9b8f699 OLC40003021 2024-04-29 21:02:51.166 2024-04-29 21:02:51.166 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +5cc440fc-fa76-40d7-938b-eeb6835943ee OLC23415304 2024-04-29 21:02:51.337 2024-04-29 21:02:51.337 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +b7ecb699-14a4-499f-b1e0-85b8d1917c49 OLC20011502 2024-04-29 21:02:51.47 2024-04-29 21:02:51.47 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +1e571494-d073-4049-ac89-3863eaed98e8 OLC22002100 2024-04-29 21:02:51.798 2024-04-29 21:02:51.797 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +583d8ff6-052a-4d45-907d-4c437d4679e1 OLC00105001 2024-04-29 21:02:51.969 2024-04-29 21:02:51.969 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +ab353878-f914-41a6-8cfb-67ffc2b5dd20 OLC22008211 2024-04-29 21:02:52.277 2024-04-29 21:02:52.277 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +89e5759e-d443-465e-9c17-01a8196c92cc OLC12320020 2024-04-29 21:02:52.459 2024-04-29 21:02:52.459 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +1b6c53f3-4ae9-459b-8e0e-e76a0a7cb8f7 OLC01500711 2024-04-29 21:02:52.62 2024-04-29 21:02:52.62 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +2e05e747-4165-4892-a768-077b1a98b0b1 OLC02006111 2024-04-29 21:02:52.77 2024-04-29 21:02:52.77 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +c48b3f7f-7b05-46a5-a13a-f0f337a0c269 OLC03200800 2024-04-29 21:02:52.932 2024-04-29 21:02:52.932 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +4116390f-f122-4cb3-917f-8fa6230f91f5 OLC02430023 2024-04-29 21:02:53.099 2024-04-29 21:02:53.099 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +17a096d5-5378-49e3-aaa6-b90dbc9bf2fa OLC41200010 2024-04-29 21:02:53.269 2024-04-29 21:02:53.269 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +fee2948b-af1e-496f-a7a2-268d0182dad7 OLC10102022 2024-04-29 21:02:53.596 2024-04-29 21:02:53.596 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +3a65e00c-87fa-441d-9e5b-b76d2dd5d725 OLC20305302 2024-04-29 21:02:53.768 2024-04-29 21:02:53.768 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +b49513aa-4adc-48a3-8a8e-962f17f2ed5a OLC14114011 2024-04-29 21:02:53.947 2024-04-29 21:02:53.947 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +17a7674e-a67c-4bfc-b5a3-defee336f790 OLC16401101 2024-04-29 21:02:54.259 2024-04-29 21:02:54.259 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +976d6b21-d91a-410c-91f4-2b4f77f8e0ae OLC12010111 2024-04-29 21:02:54.422 2024-04-29 21:02:54.422 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +789ef1b9-f466-45ac-a3c9-3032691e9fc8 OLC73400000 2024-04-29 21:02:54.584 2024-04-29 21:02:54.584 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +9b4438a7-3331-40bc-a009-8bf30257d9fe OLC00024111 2024-04-29 21:02:54.751 2024-04-29 21:02:54.751 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +0df52267-6594-463e-b70e-8aab17b66719 OLC21152003 2024-04-29 21:02:54.904 2024-04-29 21:02:54.904 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +d0ec612a-72bc-44bc-8cc0-b58c7112e905 OLC30655260 2024-04-29 21:02:55.085 2024-04-29 21:02:55.085 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +8bd0de97-d893-44f3-8e8f-e2b8d92b2bd9 OLC51030030 2024-04-29 21:02:55.246 2024-04-29 21:02:55.246 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +1ef0be39-a36a-4a4b-9974-8967949d1776 OLC13500003 2024-04-29 21:02:55.392 2024-04-29 21:02:55.392 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +fb63037e-1dcd-4a8f-b44c-c211dc818629 OLC10332001 2024-04-29 21:02:55.567 2024-04-29 21:02:55.567 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +e844580a-9513-4b10-9a04-8beae761fc77 OLC20001141 2024-04-29 21:02:55.732 2024-04-29 21:02:55.732 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +d558a4d1-3308-4912-8400-38c1c002f532 OLC10200063 2024-04-29 21:02:55.896 2024-04-29 21:02:55.896 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +b39a9b2e-6f27-44fe-83bc-676a2b6f6abe OLC73001103 2024-04-29 21:18:12.491 2024-04-29 21:18:12.491 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +0a13fba5-2876-40fe-8ad2-8f1519e765dc OLC02012111 2024-04-29 21:02:53.432 2024-04-29 21:32:18.247 123 123 d9655225-b9ec-44c6-983d-d798f4d66aaf \N \N 110e1e70-f3a2-42ba-8d1d-4ddd03885566 470a163e-653a-4ede-81f5-793523d012c1 +\. -- --- Name: recipient recipient_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: legal_people; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.recipient - ADD CONSTRAINT recipient_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.legal_people (id, fantasy_name, cnpj, state_registration, corporate_name, public_place, address_number, neighborhood, complement, city, uf, first_phone, second_phone, third_phone, email, created_at, updated_at) FROM stdin; +ecf45722-63cb-4322-9e53-f0fed1e370fb Sdsadas 14521412541245 14512541474 sdasdasd asdsadas 1254 fsdf ASDASDSAD sdas UF 12345645124 14521451251 \N SADASD@asdsad 2024-04-29 21:01:10.518 2024-04-29 21:01:10.518 +1fe38c07-ef31-49c1-8ebd-f14cacf0383d TLS 12345678910254 1452314781 TLS LTDA RUA 2 451 LAPA \N São Paulo RJ 12047845124 \N \N Mainteadsd@test 2024-04-07 19:16:13.352 2024-05-01 01:07:20.533 +ab36a21a-f786-4745-bd00-47e302ac36e3 sdasdasd 14521210147854 1474125214 asadsf nullsdasdas 98749 asdasdas \N dasdsa SP 145214785414 \N \N sdsad@fsfas 2024-05-01 01:10:05.89 2024-05-01 01:10:05.89 +9ab7c52f-c148-4db2-acf6-0c1c7542df75 sdasdas1d 14521211147854 1471125214 as1adsf nullsdasdas 98749 asdasdas \N dasdsa SP 147214785414 \N \N sdsad@fsfas 2024-05-01 01:10:34.517 2024-05-01 01:10:34.517 +6dcc0516-ebcd-4348-be65-30247dfb5804 sd2sdas1d 14521221147854 1471225214 a21adsf nullsdasdas 98749 asdasdas \N dasdsa SP 147214785414 \N \N sdsad@fsfas 2024-05-01 01:10:53.166 2024-05-01 01:10:53.166 +\. -- --- Name: recipient recipient_legal_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: maintenance; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.recipient - ADD CONSTRAINT recipient_legal_person_id_fkey FOREIGN KEY (legal_person_id) REFERENCES public.legal_people(id) ON UPDATE CASCADE ON DELETE SET NULL; +COPY public.maintenance (id, created_at, created_by, updated_at, updated_by, maintenance_company_id, finished_at, type_of_maintenance_id, vehicle_id) FROM stdin; +76bc24b2-049f-475c-b8d2-aea31214360c 2024-04-06 18:55:45.314 123 2024-04-06 18:55:45.314 123 4c8a6e47-0e0d-451f-950d-d8ea42a029e6 \N a2c78f83-b59b-4e52-bbf0-cbc8b048bed0 54db2725-2297-497f-a0a0-848c57e14315 +\. -- --- Name: recipient recipient_natural_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: maintenance_companies; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.recipient - ADD CONSTRAINT recipient_natural_person_id_fkey FOREIGN KEY (natural_person_id) REFERENCES public.natural_people(id) ON UPDATE CASCADE ON DELETE SET NULL; +COPY public.maintenance_companies (id, specialty_maintenance, created_at, created_by, updated_at, updated_by, legal_person_id) FROM stdin; +4c8a6e47-0e0d-451f-950d-d8ea42a029e6 Test 2024-04-06 13:59:17.305 123 2024-04-06 13:59:17.305 123 1fe38c07-ef31-49c1-8ebd-f14cacf0383d +4c16ec7c-1165-4f99-a894-1bca035d34c4 sdasad 2024-05-01 01:10:05.892 123 2024-05-01 01:10:05.892 123 ab36a21a-f786-4745-bd00-47e302ac36e3 +26fb2dc4-05db-45fc-bdec-6ff417a1b81b sdasad 2024-05-01 01:10:34.519 123 2024-05-01 01:10:34.519 123 9ab7c52f-c148-4db2-acf6-0c1c7542df75 +\. -- --- Name: recipient recipient_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: natural_people; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.recipient - ADD CONSTRAINT recipient_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.natural_people (id, name, date_birth, gender, cpf, rg, cep, public_place, address_number, neighborhood, complement, city, uf, first_phone, second_phone, third_phone, email, nationality) FROM stdin; +e39d4ab2-58e0-4b3c-8df1-41420bb0c233 John Kennedy 1970-01-20 19:41:44.726 MASC 14785436521 147152365 1478523 Asuia 205 Albany \N teresinha US 145247541254 \N \N john@test RUSSIAN +a612681f-15af-4dc5-bbc2-a45b9d30f379 John Kennedy 1970-01-20 19:41:44.726 MASC 14785236521 147852365 1478523 Asuia 205 Albany 123 teresinha US 145247541254 \N \N john@test RUSSIAN +46fac594-30d5-4d96-9e6a-aace32ed529b JÃO 1970-01-20 19:57:57.071 MASC 14141414141 1414141414 07142090 SRW TEST 144 TEST WSS \N GUA SP 14247845741 \N \N SDASd@sfs BRASIL +3b11a7c4-1c0c-4d29-b350-df48d08712c2 JÃO 1970-01-20 19:57:57.071 MASC 15151515151 1515151515 07142090 SRW TEST 487 TEST WSS \N GUA SP 14247845741 \N \N SDASd@sfs BRASIL +ea7cbad6-bfe3-4d10-b7b1-7457b954a91f TIO PAULO 1970-01-20 20:02:05.749 MASC 14521452361 1026587412 0741025 ddgsdg 2145 Sdadsa GRU SP 1478541254 \N \N Fsfs@ets Brasileiro +\. -- --- Name: sender sender_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: order_procesing; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.sender - ADD CONSTRAINT sender_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.order_procesing (id, order_processing_number, vehicle_id, total_distance, total_spend_liters, total_spending_money, start_at, end_at, updated_at, created_at, created_by, updated_by, status) FROM stdin; +1fc6f459-5fdf-4db8-a859-ed65a340da6d OP15012041 54db2725-2297-497f-a0a0-848c57e14315 25 5 20 1970-01-20 20:05:11.979 \N 2024-04-23 23:19:38.249 2024-04-23 23:19:38.249 123 123 CREATED +\. -- --- Name: sender sender_legal_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: outsourcedT_transport_company_driver; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.sender - ADD CONSTRAINT sender_legal_person_id_fkey FOREIGN KEY (legal_person_id) REFERENCES public.legal_people(id) ON UPDATE CASCADE ON DELETE SET NULL; +COPY public."outsourcedT_transport_company_driver" (id, cnh, cnh_expiration, course_mopp, created_at, updated_at, created_by, updated_by, natural_person_id, outsourced_transport_company_id, cnh_category) FROM stdin; +\. -- --- Name: sender sender_natural_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: outsourced_drivers; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.sender - ADD CONSTRAINT sender_natural_person_id_fkey FOREIGN KEY (natural_person_id) REFERENCES public.natural_people(id) ON UPDATE CASCADE ON DELETE SET NULL; +COPY public.outsourced_drivers (id, cnh, cnh_expiration, course_mopp, created_at, updated_at, created_by, outsourced_vehicle_id, updated_by, natural_person_id, cnh_category, company_vehicle_id) FROM stdin; +a64a956b-0a49-46e1-9e55-6dcee8647aa2 14147851254 1970-01-20 20:02:05.749 t 2024-04-21 19:00:24.692 2024-04-21 19:00:24.692 123 \N 123 ea7cbad6-bfe3-4d10-b7b1-7457b954a91f B 6dbc6ae0-c120-4dc0-bc88-ec57eb35b90f +\. -- --- Name: sender sender_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: outsourced_transport_vehicle; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.sender - ADD CONSTRAINT sender_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.outsourced_transport_vehicle (id, outsourced_company_id, vehicle_id, created_at, updated_at, created_by, updated_by) FROM stdin; +\. -- --- Name: types_of_maintenances types_of_maintenances_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: outsourced_vehicles; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.types_of_maintenances - ADD CONSTRAINT types_of_maintenances_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.outsourced_vehicles (id, created_at, updated_at, created_by, vehicle_id, order_processing_id, updated_by, "orderProcessingLegalClientId") FROM stdin; +\. -- --- Name: types_of_maintenances types_of_maintenances_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: own_drivers; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.types_of_maintenances - ADD CONSTRAINT types_of_maintenances_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.own_drivers (id, cnh, cnh_expiration, company_vehicle, course_mopp, created_at, updated_at, created_by, updated_by, natural_person_id, cnh_category) FROM stdin; +91e23780-a5a9-4a67-a85e-d7117f649e6b 14512478541 1970-01-20 19:41:44.726 t t 2024-04-07 16:35:40.439 2024-04-07 16:35:40.439 123 123 e39d4ab2-58e0-4b3c-8df1-41420bb0c233 A +7553ec92-f532-4e2c-9259-76cb1e4e1565 14524478141 1970-01-20 19:41:44.726 t t 2024-04-07 18:47:18.335 2024-04-07 18:47:18.335 123 123 a612681f-15af-4dc5-bbc2-a45b9d30f379 B +\. -- --- Name: vehicle_bodyworks vehicle_bodyworks_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: physical_customer_cte; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_bodyworks - ADD CONSTRAINT vehicle_bodyworks_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.physical_customer_cte (id, order_id, access_key, type_cte, observations, cte_number) FROM stdin; +\. -- --- Name: vehicle_bodyworks vehicle_bodyworks_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: physical_customer_quote; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_bodyworks - ADD CONSTRAINT vehicle_bodyworks_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.physical_customer_quote (id, cod_quote, recipient_id, "senderId", who_pays, postal_cod_origin, postal_cod_destiny, type_merchandise, amount, description, mass, volume, nf_value, created_at, updated_at, created_by, updated_by) FROM stdin; +1aa86854-2304-40c5-83fc-ef047f23a6c3 QT06004031 5e12366b-6bed-487a-bf7d-09dfeabe7799 b3034daa-e9a3-4864-bf99-c10a7514eca0 CIF 0741414 1415474 TEST 45 Arroz 4115 4500 10000 2024-04-18 22:00:21.773 2024-04-18 22:00:21.773 123 123 +\. -- --- Name: vehicle_brands vehicle_brands_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: physical_customers; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_brands - ADD CONSTRAINT vehicle_brands_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.physical_customers (id, branch, created_by, updated_by, natural_person_id, created_at, updated_at) FROM stdin; +682f2c0d-90ac-431a-b6b9-0d2f38be6411 \N 123 123 a612681f-15af-4dc5-bbc2-a45b9d30f379 2024-04-18 22:13:00.586 2024-04-18 22:13:00.586 +\. -- --- Name: vehicle_brands vehicle_brands_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: physical_orders; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_brands - ADD CONSTRAINT vehicle_brands_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.physical_orders (id, "order", updated_by, created_at, updated_at, created_by, physical_customer_id, "completedOrdersId", order_processing_id, quote_table_id, carrier_id) FROM stdin; +49dc129e-c222-488d-9e11-6961ef36d528 OR04001035 123 2024-04-18 22:13:32.569 2024-04-18 22:13:32.569 123 682f2c0d-90ac-431a-b6b9-0d2f38be6411 \N 1fc6f459-5fdf-4db8-a859-ed65a340da6d 1aa86854-2304-40c5-83fc-ef047f23a6c3 470a163e-653a-4ede-81f5-793523d012c1 +\. -- --- Name: vehicle_models vehicle_models_brand_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: recipient; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_models - ADD CONSTRAINT vehicle_models_brand_id_fkey FOREIGN KEY (brand_id) REFERENCES public.vehicle_brands(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.recipient (id, legal_person_id, natural_person_id, created_at, updated_at, created_by, updated_by) FROM stdin; +5e12366b-6bed-487a-bf7d-09dfeabe7799 \N 3b11a7c4-1c0c-4d29-b350-df48d08712c2 2024-04-18 21:54:08.486 2024-04-18 21:54:08.486 123 123 +\. -- --- Name: vehicle_models vehicle_models_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: sender; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_models - ADD CONSTRAINT vehicle_models_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.sender (id, legal_person_id, natural_person_id, created_at, updated_at, created_by, updated_by) FROM stdin; +b3034daa-e9a3-4864-bf99-c10a7514eca0 \N 46fac594-30d5-4d96-9e6a-aace32ed529b 2024-04-18 21:52:24.129 2024-04-18 21:52:24.129 123 123 +\. -- --- Name: vehicle_models vehicle_models_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: types_of_maintenances; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_models - ADD CONSTRAINT vehicle_models_type_id_fkey FOREIGN KEY (type_id) REFERENCES public.vehicle_types(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.types_of_maintenances (id, description, created_at, created_by, updated_at, updated_by, "typeMaintenance") FROM stdin; +a2c78f83-b59b-4e52-bbf0-cbc8b048bed0 Troca de Oléo 2024-04-06 15:36:10.324 123 2024-04-06 15:36:10.323 123 MANUTENÇÃO PREDITIVA +\. -- --- Name: vehicle_models vehicle_models_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_models - ADD CONSTRAINT vehicle_models_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.users (id, name, username, email, password, created_at, updated_at, role, avatar_url) FROM stdin; +123 test test test@test $2b$10$MlfwVUV79ZON9/EcD08PKef4RofumOuOsKEmz7niXqefMZx0A0u7m 2024-04-06 13:57:19.391 2024-04-06 13:57:19.391 ADMIN \N +\. -- --- Name: vehicle_types vehicle_types_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: vehicle_bodyworks; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_types - ADD CONSTRAINT vehicle_types_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.vehicle_bodyworks (id, name, axles, mass, volume, created_at, updated_at, created_by, updated_by) FROM stdin; +\. -- --- Name: vehicle_types vehicle_types_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: vehicle_brands; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicle_types - ADD CONSTRAINT vehicle_types_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.vehicle_brands (id, name, created_at, updated_at, created_by, updated_by) FROM stdin; +59ae26e5-f966-49b4-aea4-7708325de9fd FORD 2024-04-06 18:34:50.402 2024-04-06 18:34:50.402 123 123 +\. -- --- Name: vehicles vehicles_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: admin +-- Data for Name: vehicle_models; Type: TABLE DATA; Schema: public; Owner: admin -- -ALTER TABLE ONLY public.vehicles - ADD CONSTRAINT vehicles_model_id_fkey FOREIGN KEY (model_id) REFERENCES public.vehicle_models(id) ON UPDATE CASCADE ON DELETE RESTRICT; +COPY public.vehicle_models (id, name, weight, capacity_max, axles, created_at, updated_at, created_by, brand_id, type_id, capacity_per_axle, updated_by) FROM stdin; +f9d23e17-ae1f-48cc-b687-6d8be4e275d6 FORD K 45.4 500.5 4 2024-04-06 18:49:20.548 2024-04-06 18:49:20.548 123 59ae26e5-f966-49b4-aea4-7708325de9fd bbe91666-6a4b-4349-9fd9-695c69b96e05 4 123 +\. -- --- Name: SCHEMA public; Type: ACL; Schema: -; Owner: admin +-- Data for Name: vehicle_types; Type: TABLE DATA; Schema: public; Owner: admin -- -REVOKE USAGE ON SCHEMA public FROM PUBLIC; +COPY public.vehicle_types (id, name, bodywork, created_at, updated_at, created_by, updated_by) FROM stdin; +bbe91666-6a4b-4349-9fd9-695c69b96e05 SD f 2024-04-06 18:44:47.942 2024-04-06 18:44:47.942 123 123 +\. -- --- PostgreSQL database dump complete +-- Data for Name: vehicles; Type: TABLE DATA; Schema: public; Owner: admin -- +COPY public.vehicles (id, plate, year, color, renavam, model_id, antt, is_ipva_paid, registration) FROM stdin; +54db2725-2297-497f-a0a0-848c57e14315 cgs1414 2024 VERDE str145212 f9d23e17-ae1f-48cc-b687-6d8be4e275d6 TSD1245 t 1970-01-20 19:40:29.557 +\. diff --git a/prisma/dbml/schema.dbml b/prisma/dbml/schema.dbml index bca713ac..12e06547 100644 --- a/prisma/dbml/schema.dbml +++ b/prisma/dbml/schema.dbml @@ -164,7 +164,6 @@ Table outsourced_vehicles { vehicle_id String [unique, not null] order_processing_id String OutsourcedDriver outsourced_drivers - orderProcessingLegalClientId String } Table company_vehicles { @@ -180,7 +179,6 @@ Table company_vehicles { Vehicle vehicles [not null] vehicle_id String [unique, not null] OutsourcedDriver outsourced_drivers [not null] - orderProcessingLegalClientId String } Table outsourced_transport_vehicle { @@ -365,13 +363,19 @@ Table OutsourcedTransportCompanyContract { Table physical_customer_quote { id String [pk] cod_quote String [not null] + kind_service String [not null] + type_cte String [not null] + natute_service String [not null] + form_payment String [not null] recipient_id String [not null] Recipient recipient [not null] Sender sender [not null] senderId String [not null] who_pays String [not null] - postal_cod_origin String [not null] - postal_cod_destiny String [not null] + adress_origin_id String [not null] + AdressOrigin adresses [not null] + adress_destiny_id String [not null] + AdressDestiny adresses [not null] type_merchandise String [not null] amount Int [not null] description String [not null] @@ -385,10 +389,8 @@ Table physical_customer_quote { updated_by String [not null] UpdatedBy users [not null] PhysicalCustomerOrder physical_orders [not null] - - indexes { - (postal_cod_destiny, postal_cod_origin) [unique] - } + icms_id String [not null] + Icms icms [not null] } Table physical_orders { @@ -396,6 +398,9 @@ Table physical_orders { order String [unique, not null] updated_by String [not null] physical_customer_id String [not null] + total_shipping_cost Float [not null] + total_receivable Float [not null] + total_tax_payable Float [not null] PhysicalCustomer physical_customers [not null] created_at DateTime [default: `now()`, not null] updated_at DateTime [default: `now()`, not null] @@ -468,6 +473,8 @@ Table icms { created_by String [not null] updated_by String [not null] UpdatedBy users [not null] + PhysicalCustomerQuoteTable physical_customer_quote [not null] + LegalClientQuoteTable legal_client_quote [not null] indexes { (state_orgin, recipient_state) [unique] @@ -545,13 +552,19 @@ Table legal_Contracts { Table legal_client_quote { id String [pk] cod_quote String [not null] + kind_service String [not null] + type_cte String [not null] + nature_service String [not null] + form_payment String [not null] recipient_id String [not null] Recipient recipient [not null] Sender sender [not null] sender_id String [not null] who_pays String [not null] - postal_cod_origin String [not null] - postal_cod_destiny String [not null] + adress_origin_id String [not null] + AdressOrigin adresses [not null] + AdressDestiny adresses [not null] + adress_destiny_id String [not null] type_merchandise String [not null] amount Int [not null] description String [not null] @@ -565,6 +578,27 @@ Table legal_client_quote { created_by String [not null] UpdatedBy users [not null] updated_by String [not null] + icms_id String [not null] + Icms icms [not null] +} + +Table adresses { + id String [pk] + postal_cod String [not null] + street String [not null] + address_number String [not null] + neighborhood String [not null] + complement String + city String [not null] + uf String [not null] + LegalClientQuoteTableOrigin legal_client_quote [not null] + LegalClientQuoteTablesDestiny legal_client_quote [not null] + PhysicalCustomerQuoteTableOrigin physical_customer_quote [not null] + PhysicalCustomerQuoteTableDestiny physical_customer_quote [not null] + + indexes { + (postal_cod, address_number) [unique] + } } Table legal_orders { @@ -572,6 +606,9 @@ Table legal_orders { order String [unique, not null] created_at DateTime [default: `now()`, not null] updated_at DateTime [default: `now()`, not null] + total_shipping_cost Float [not null] + total_receivable Float [not null] + total_tax_payable Float [not null] CreatedBy users [not null] created_by String [not null] UpdatedBy users [not null] @@ -822,10 +859,16 @@ Ref: physical_customer_quote.recipient_id > recipient.id Ref: physical_customer_quote.senderId > sender.id +Ref: physical_customer_quote.adress_origin_id > adresses.id + +Ref: physical_customer_quote.adress_destiny_id > adresses.id + Ref: physical_customer_quote.created_by > users.id Ref: physical_customer_quote.updated_by > users.id +Ref: physical_customer_quote.icms_id > icms.id + Ref: physical_orders.physical_customer_id > physical_customers.id Ref: physical_orders.created_by > users.id @@ -882,10 +925,16 @@ Ref: legal_client_quote.recipient_id > recipient.id Ref: legal_client_quote.sender_id > sender.id +Ref: legal_client_quote.adress_origin_id > adresses.id + +Ref: legal_client_quote.adress_destiny_id > adresses.id + Ref: legal_client_quote.created_by > users.id Ref: legal_client_quote.updated_by > users.id +Ref: legal_client_quote.icms_id > icms.id + Ref: legal_orders.created_by > users.id Ref: legal_orders.updated_by > users.id diff --git a/prisma/migrations/20230609171326_init/migration.sql b/prisma/migrations/20230609171326_init/migration.sql deleted file mode 100644 index acefea3b..00000000 --- a/prisma/migrations/20230609171326_init/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ --- CreateTable -CREATE TABLE "User" ( - "id" TEXT NOT NULL, - "email" TEXT NOT NULL, - "name" TEXT NOT NULL, - - CONSTRAINT "User_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); diff --git a/prisma/migrations/20230820000102_/migration.sql b/prisma/migrations/20230820000102_/migration.sql deleted file mode 100644 index 05fbdab3..00000000 --- a/prisma/migrations/20230820000102_/migration.sql +++ /dev/null @@ -1,646 +0,0 @@ -/* - Warnings: - - - You are about to drop the `User` table. If the table is not empty, all the data it contains will be lost. - -*/ --- CreateEnum -CREATE TYPE "Role" AS ENUM ('USER', 'ADMIN', 'CLIENT'); - --- CreateEnum -CREATE TYPE "CNH" AS ENUM ('A', 'B', 'C', 'D', 'E', 'AB', 'AC', 'AD', 'AE'); - --- DropTable -DROP TABLE "User"; - --- CreateTable -CREATE TABLE "users" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "username" TEXT NOT NULL, - "email" TEXT NOT NULL, - "role" "Role" NOT NULL DEFAULT 'USER', - "password" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "users_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "vehicles" ( - "id" TEXT NOT NULL, - "plate" TEXT NOT NULL, - "year" TEXT NOT NULL, - "color" TEXT NOT NULL, - "renavam" TEXT NOT NULL, - "rntrc_expiration" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "model_id" TEXT NOT NULL, - - CONSTRAINT "vehicles_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "vehicle_models" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "weight" DOUBLE PRECISION NOT NULL, - "capacity_max" DOUBLE PRECISION NOT NULL, - "axles" INTEGER NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "brand_id" TEXT NOT NULL, - "type_id" TEXT NOT NULL, - - CONSTRAINT "vehicle_models_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "vehicle_brands" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - - CONSTRAINT "vehicle_brands_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "vehicle_types" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "bodywork" BOOLEAN NOT NULL DEFAULT false, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - - CONSTRAINT "vehicle_types_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "vehicle_bodyworks" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "axles" INTEGER NOT NULL, - "mass" DOUBLE PRECISION NOT NULL, - "volume" DOUBLE PRECISION NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - - CONSTRAINT "vehicle_bodyworks_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "vehicle_type_contain_bodyworks" ( - "id" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "type_id" TEXT NOT NULL, - "bodywork_id" TEXT NOT NULL, - - CONSTRAINT "vehicle_type_contain_bodyworks_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "outsourced_vehicles" ( - "id" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "vehicle_id" TEXT NOT NULL, - "order_processing_id" TEXT, - - CONSTRAINT "outsourced_vehicles_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "company_vehicles" ( - "id" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "vehicle_id" TEXT NOT NULL, - "order_processing_id" TEXT, - - CONSTRAINT "company_vehicles_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "outsourced_drivers" ( - "id" TEXT NOT NULL, - "cnh" TEXT NOT NULL, - "cnh_category" "CNH" NOT NULL, - "cnh_expiration" TIMESTAMP(3) NOT NULL, - "company_vehicle" BOOLEAN NOT NULL DEFAULT false, - "course_mopp" BOOLEAN NOT NULL DEFAULT false, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "cpf" TEXT NOT NULL, - "outsourced_vehicle_id" TEXT NOT NULL, - - CONSTRAINT "outsourced_drivers_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "contract_outsourced_drivers" ( - "id" TEXT NOT NULL, - "type" TEXT NOT NULL, - "situation" TEXT NOT NULL, - "start_at" TIMESTAMP(3) NOT NULL, - "end_at" TIMESTAMP(3), - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "cpf" TEXT NOT NULL, - - CONSTRAINT "contract_outsourced_drivers_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "own_drivers" ( - "id" TEXT NOT NULL, - "cnh" TEXT NOT NULL, - "cnh_category" "CNH" NOT NULL, - "cnh_expiration" TIMESTAMP(3) NOT NULL, - "company_vehicle" BOOLEAN NOT NULL DEFAULT false, - "course_mopp" BOOLEAN NOT NULL DEFAULT false, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "cpf" TEXT NOT NULL, - - CONSTRAINT "own_drivers_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "natural_people" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "date_birth" TIMESTAMP(3) NOT NULL, - "gender" TEXT NOT NULL, - "cpf" TEXT NOT NULL, - "rg" INTEGER NOT NULL, - "cep" INTEGER NOT NULL, - "public_place" TEXT NOT NULL, - "address_number" TEXT NOT NULL, - "neighborhood" TEXT NOT NULL, - "complement" TEXT NOT NULL, - "city" TEXT NOT NULL, - "uf" TEXT NOT NULL, - "first_phone" TEXT NOT NULL, - "second_phone" TEXT, - "third_phone" TEXT, - "email" TEXT NOT NULL, - "nationality" TEXT NOT NULL, - - CONSTRAINT "natural_people_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "legal_people" ( - "id" TEXT NOT NULL, - "fantasy_name" TEXT NOT NULL, - "cnpj" TEXT NOT NULL, - "state_registration" TEXT NOT NULL, - "corporate_name" TEXT NOT NULL, - "public_place" TEXT NOT NULL, - "address_number" TEXT NOT NULL, - "neighborhood" TEXT NOT NULL, - "complement" TEXT, - "city" TEXT NOT NULL, - "uf" TEXT NOT NULL, - "first_phone" TEXT NOT NULL, - "second_phone" TEXT, - "third_phone" TEXT, - "email" TEXT NOT NULL, - - CONSTRAINT "legal_people_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "carrier_companies" ( - "id" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "cnpj" TEXT NOT NULL, - - CONSTRAINT "carrier_companies_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "physical_customers" ( - "id" TEXT NOT NULL, - "branch" TEXT, - "cpf" TEXT NOT NULL, - "merchandiseId" TEXT, - - CONSTRAINT "physical_customers_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "corporate_clients" ( - "id" TEXT NOT NULL, - "branch" TEXT NOT NULL, - "cnpj" TEXT NOT NULL, - - CONSTRAINT "corporate_clients_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "physical_contractors" ( - "id" TEXT NOT NULL, - "branch" TEXT, - "cpf" TEXT NOT NULL, - - CONSTRAINT "physical_contractors_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "legal_contractors" ( - "id" TEXT NOT NULL, - "branch" TEXT NOT NULL, - "cnpj" TEXT NOT NULL, - - CONSTRAINT "legal_contractors_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "merchandise" ( - "id" TEXT NOT NULL, - "codMerchandise" TEXT NOT NULL, - "amount" INTEGER NOT NULL, - "description" TEXT NOT NULL, - "mass" DOUBLE PRECISION NOT NULL, - "volume" DOUBLE PRECISION NOT NULL, - "value" DOUBLE PRECISION NOT NULL, - "order_id" TEXT NOT NULL, - "contractor_cpf" TEXT, - "contractor_cnpj" TEXT, - "corporateClientId" TEXT, - - CONSTRAINT "merchandise_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "customer_orders" ( - "id" TEXT NOT NULL, - "order" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - - CONSTRAINT "customer_orders_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "routes" ( - "id" TEXT NOT NULL, - "cep" TEXT NOT NULL, - "public_place" TEXT NOT NULL, - "address_number" TEXT NOT NULL, - "neighborhood" TEXT NOT NULL, - "complement" TEXT, - "city" TEXT NOT NULL, - "uf" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "order_id" TEXT NOT NULL, - - CONSTRAINT "routes_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "invoices" ( - "id" TEXT NOT NULL, - "emission_date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "nature_invoice" TEXT NOT NULL, - "invoice_total" DOUBLE PRECISION NOT NULL, - "form_payment" TEXT NOT NULL, - "additional_data" TEXT NOT NULL, - "digital_signature" TEXT NOT NULL, - "invoice_taxes" DOUBLE PRECISION NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "cpf_physicalcustomer" TEXT, - "carrier_cnpj" TEXT NOT NULL, - "corporate_cnpj" TEXT, - "customerOrderId" TEXT NOT NULL, - - CONSTRAINT "invoices_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "ciots" ( - "id" TEXT NOT NULL, - "ciot" TEXT NOT NULL, - "emission_date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "cpf" TEXT, - "carrier_cnpj" TEXT NOT NULL, - "corporate_cnpj" TEXT, - "contractor_cnpj" TEXT, - "contractor_cpf" TEXT, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "ciots_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "order_processing" ( - "id" TEXT NOT NULL, - "total_distance" DOUBLE PRECISION NOT NULL, - "total_spend_liters" INTEGER NOT NULL, - "total_spending_money" DOUBLE PRECISION NOT NULL, - "start_at" TIMESTAMP(3) NOT NULL, - "end_at" TIMESTAMP(3) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "route_id" TEXT NOT NULL, - "plate" TEXT NOT NULL, - - CONSTRAINT "order_processing_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "types_of_maintenances" ( - "id" TEXT NOT NULL, - "description" TEXT NOT NULL, - "preventive" BOOLEAN NOT NULL, - "corrective" BOOLEAN NOT NULL, - - CONSTRAINT "types_of_maintenances_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "maintenance_companies" ( - "id" TEXT NOT NULL, - "specialty_maintenance" TEXT NOT NULL, - "cnpj" TEXT NOT NULL, - - CONSTRAINT "maintenance_companies_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "maintenance" ( - "id" TEXT NOT NULL, - "maintenance_company_cnpj" TEXT NOT NULL, - "plate" TEXT NOT NULL, - "maintenance_process_id" TEXT NOT NULL, - - CONSTRAINT "maintenance_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "users_username_key" ON "users"("username"); - --- CreateIndex -CREATE UNIQUE INDEX "users_email_key" ON "users"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "vehicles_plate_key" ON "vehicles"("plate"); - --- CreateIndex -CREATE UNIQUE INDEX "vehicle_brands_name_key" ON "vehicle_brands"("name"); - --- CreateIndex -CREATE UNIQUE INDEX "vehicle_type_contain_bodyworks_bodywork_id_type_id_key" ON "vehicle_type_contain_bodyworks"("bodywork_id", "type_id"); - --- CreateIndex -CREATE UNIQUE INDEX "company_vehicles_vehicle_id_key" ON "company_vehicles"("vehicle_id"); - --- CreateIndex -CREATE UNIQUE INDEX "outsourced_drivers_cnh_key" ON "outsourced_drivers"("cnh"); - --- CreateIndex -CREATE UNIQUE INDEX "outsourced_drivers_cpf_key" ON "outsourced_drivers"("cpf"); - --- CreateIndex -CREATE UNIQUE INDEX "outsourced_drivers_outsourced_vehicle_id_key" ON "outsourced_drivers"("outsourced_vehicle_id"); - --- CreateIndex -CREATE UNIQUE INDEX "contract_outsourced_drivers_cpf_key" ON "contract_outsourced_drivers"("cpf"); - --- CreateIndex -CREATE UNIQUE INDEX "own_drivers_cnh_key" ON "own_drivers"("cnh"); - --- CreateIndex -CREATE UNIQUE INDEX "natural_people_cpf_key" ON "natural_people"("cpf"); - --- CreateIndex -CREATE UNIQUE INDEX "natural_people_rg_key" ON "natural_people"("rg"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_people_cnpj_key" ON "legal_people"("cnpj"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_people_state_registration_key" ON "legal_people"("state_registration"); - --- CreateIndex -CREATE UNIQUE INDEX "carrier_companies_cnpj_key" ON "carrier_companies"("cnpj"); - --- CreateIndex -CREATE UNIQUE INDEX "physical_customers_cpf_key" ON "physical_customers"("cpf"); - --- CreateIndex -CREATE UNIQUE INDEX "corporate_clients_cnpj_key" ON "corporate_clients"("cnpj"); - --- CreateIndex -CREATE UNIQUE INDEX "physical_contractors_cpf_key" ON "physical_contractors"("cpf"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_contractors_cnpj_key" ON "legal_contractors"("cnpj"); - --- CreateIndex -CREATE UNIQUE INDEX "merchandise_codMerchandise_key" ON "merchandise"("codMerchandise"); - --- CreateIndex -CREATE UNIQUE INDEX "customer_orders_order_key" ON "customer_orders"("order"); - --- CreateIndex -CREATE UNIQUE INDEX "invoices_digital_signature_key" ON "invoices"("digital_signature"); - --- CreateIndex -CREATE UNIQUE INDEX "ciots_ciot_key" ON "ciots"("ciot"); - --- CreateIndex -CREATE UNIQUE INDEX "order_processing_plate_key" ON "order_processing"("plate"); - --- CreateIndex -CREATE UNIQUE INDEX "maintenance_companies_cnpj_key" ON "maintenance_companies"("cnpj"); - --- AddForeignKey -ALTER TABLE "vehicles" ADD CONSTRAINT "vehicles_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicles" ADD CONSTRAINT "vehicles_model_id_fkey" FOREIGN KEY ("model_id") REFERENCES "vehicle_models"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_brand_id_fkey" FOREIGN KEY ("brand_id") REFERENCES "vehicle_brands"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_type_id_fkey" FOREIGN KEY ("type_id") REFERENCES "vehicle_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_brands" ADD CONSTRAINT "vehicle_brands_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_types" ADD CONSTRAINT "vehicle_types_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_bodyworks" ADD CONSTRAINT "vehicle_bodyworks_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" ADD CONSTRAINT "vehicle_type_contain_bodyworks_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" ADD CONSTRAINT "vehicle_type_contain_bodyworks_type_id_fkey" FOREIGN KEY ("type_id") REFERENCES "vehicle_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" ADD CONSTRAINT "vehicle_type_contain_bodyworks_bodywork_id_fkey" FOREIGN KEY ("bodywork_id") REFERENCES "vehicle_bodyworks"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_processing"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_processing"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_cpf_fkey" FOREIGN KEY ("cpf") REFERENCES "natural_people"("cpf") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_outsourced_vehicle_id_fkey" FOREIGN KEY ("outsourced_vehicle_id") REFERENCES "outsourced_vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_cpf_fkey" FOREIGN KEY ("cpf") REFERENCES "outsourced_drivers"("cpf") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "own_drivers" ADD CONSTRAINT "own_drivers_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "own_drivers" ADD CONSTRAINT "own_drivers_cpf_fkey" FOREIGN KEY ("cpf") REFERENCES "natural_people"("cpf") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "carrier_companies" ADD CONSTRAINT "carrier_companies_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "carrier_companies" ADD CONSTRAINT "carrier_companies_cnpj_fkey" FOREIGN KEY ("cnpj") REFERENCES "legal_people"("cnpj") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_merchandiseId_fkey" FOREIGN KEY ("merchandiseId") REFERENCES "merchandise"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_cpf_fkey" FOREIGN KEY ("cpf") REFERENCES "natural_people"("cpf") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "corporate_clients" ADD CONSTRAINT "corporate_clients_cnpj_fkey" FOREIGN KEY ("cnpj") REFERENCES "legal_people"("cnpj") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_contractors" ADD CONSTRAINT "physical_contractors_cpf_fkey" FOREIGN KEY ("cpf") REFERENCES "physical_customers"("cpf") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_contractors" ADD CONSTRAINT "legal_contractors_cnpj_fkey" FOREIGN KEY ("cnpj") REFERENCES "corporate_clients"("cnpj") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "merchandise" ADD CONSTRAINT "merchandise_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "customer_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "merchandise" ADD CONSTRAINT "merchandise_contractor_cpf_fkey" FOREIGN KEY ("contractor_cpf") REFERENCES "physical_contractors"("cpf") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "merchandise" ADD CONSTRAINT "merchandise_contractor_cnpj_fkey" FOREIGN KEY ("contractor_cnpj") REFERENCES "legal_contractors"("cnpj") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "merchandise" ADD CONSTRAINT "merchandise_corporateClientId_fkey" FOREIGN KEY ("corporateClientId") REFERENCES "corporate_clients"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "customer_orders" ADD CONSTRAINT "customer_orders_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "routes" ADD CONSTRAINT "routes_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "routes" ADD CONSTRAINT "routes_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "customer_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices" ADD CONSTRAINT "invoices_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices" ADD CONSTRAINT "invoices_cpf_physicalcustomer_fkey" FOREIGN KEY ("cpf_physicalcustomer") REFERENCES "physical_customers"("cpf") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices" ADD CONSTRAINT "invoices_carrier_cnpj_fkey" FOREIGN KEY ("carrier_cnpj") REFERENCES "carrier_companies"("cnpj") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices" ADD CONSTRAINT "invoices_corporate_cnpj_fkey" FOREIGN KEY ("corporate_cnpj") REFERENCES "corporate_clients"("cnpj") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices" ADD CONSTRAINT "invoices_customerOrderId_fkey" FOREIGN KEY ("customerOrderId") REFERENCES "customer_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots" ADD CONSTRAINT "ciots_cpf_fkey" FOREIGN KEY ("cpf") REFERENCES "physical_customers"("cpf") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots" ADD CONSTRAINT "ciots_carrier_cnpj_fkey" FOREIGN KEY ("carrier_cnpj") REFERENCES "carrier_companies"("cnpj") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots" ADD CONSTRAINT "ciots_corporate_cnpj_fkey" FOREIGN KEY ("corporate_cnpj") REFERENCES "corporate_clients"("cnpj") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots" ADD CONSTRAINT "ciots_contractor_cnpj_fkey" FOREIGN KEY ("contractor_cnpj") REFERENCES "legal_contractors"("cnpj") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots" ADD CONSTRAINT "ciots_contractor_cpf_fkey" FOREIGN KEY ("contractor_cpf") REFERENCES "physical_contractors"("cpf") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing" ADD CONSTRAINT "order_processing_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing" ADD CONSTRAINT "order_processing_route_id_fkey" FOREIGN KEY ("route_id") REFERENCES "routes"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing" ADD CONSTRAINT "order_processing_plate_fkey" FOREIGN KEY ("plate") REFERENCES "vehicles"("plate") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_cnpj_fkey" FOREIGN KEY ("cnpj") REFERENCES "legal_people"("cnpj") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_maintenance_company_cnpj_fkey" FOREIGN KEY ("maintenance_company_cnpj") REFERENCES "maintenance_companies"("cnpj") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_plate_fkey" FOREIGN KEY ("plate") REFERENCES "vehicles"("plate") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_maintenance_process_id_fkey" FOREIGN KEY ("maintenance_process_id") REFERENCES "types_of_maintenances"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20230828010254_updated_relations_and_add_colum_updated_by_in_fields/migration.sql b/prisma/migrations/20230828010254_updated_relations_and_add_colum_updated_by_in_fields/migration.sql deleted file mode 100644 index ae658777..00000000 --- a/prisma/migrations/20230828010254_updated_relations_and_add_colum_updated_by_in_fields/migration.sql +++ /dev/null @@ -1,182 +0,0 @@ -/* - Warnings: - - - Added the required column `update_by` to the `carrier_companies` table without a default value. This is not possible if the table is not empty. - - Added the required column `created_by` to the `ciots` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `ciots` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `company_vehicles` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `contract_outsourced_drivers` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `customer_orders` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `invoices` table without a default value. This is not possible if the table is not empty. - - Added the required column `created_by` to the `maintenance` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `maintenance` table without a default value. This is not possible if the table is not empty. - - Added the required column `created_by` to the `maintenance_companies` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `maintenance_companies` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `order_processing` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `outsourced_drivers` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `outsourced_vehicles` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `own_drivers` table without a default value. This is not possible if the table is not empty. - - Added the required column `created_by` to the `physical_customers` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `physical_customers` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `routes` table without a default value. This is not possible if the table is not empty. - - Added the required column `created_by` to the `types_of_maintenances` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `types_of_maintenances` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `vehicle_bodyworks` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `vehicle_brands` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `vehicle_models` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `vehicle_type_contain_bodyworks` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `vehicle_types` table without a default value. This is not possible if the table is not empty. - - Added the required column `update_by` to the `vehicles` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "carrier_companies" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "ciots" ADD COLUMN "created_by" TEXT NOT NULL, -ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "company_vehicles" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "contract_outsourced_drivers" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "customer_orders" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "invoices" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "maintenance" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "created_by" TEXT NOT NULL, -ADD COLUMN "update_by" TEXT NOT NULL, -ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; - --- AlterTable -ALTER TABLE "maintenance_companies" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "created_by" TEXT NOT NULL, -ADD COLUMN "update_by" TEXT NOT NULL, -ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; - --- AlterTable -ALTER TABLE "order_processing" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "outsourced_drivers" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "outsourced_vehicles" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "own_drivers" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "physical_customers" ADD COLUMN "created_by" TEXT NOT NULL, -ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "routes" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "types_of_maintenances" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "created_by" TEXT NOT NULL, -ADD COLUMN "update_by" TEXT NOT NULL, -ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; - --- AlterTable -ALTER TABLE "vehicle_bodyworks" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicle_brands" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicle_models" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicle_type_contain_bodyworks" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicle_types" ADD COLUMN "update_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicles" ADD COLUMN "update_by" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "vehicles" ADD CONSTRAINT "vehicles_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_brands" ADD CONSTRAINT "vehicle_brands_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_types" ADD CONSTRAINT "vehicle_types_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_bodyworks" ADD CONSTRAINT "vehicle_bodyworks_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" ADD CONSTRAINT "vehicle_type_contain_bodyworks_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "own_drivers" ADD CONSTRAINT "own_drivers_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "carrier_companies" ADD CONSTRAINT "carrier_companies_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "customer_orders" ADD CONSTRAINT "customer_orders_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "routes" ADD CONSTRAINT "routes_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices" ADD CONSTRAINT "invoices_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots" ADD CONSTRAINT "ciots_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots" ADD CONSTRAINT "ciots_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing" ADD CONSTRAINT "order_processing_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "types_of_maintenances" ADD CONSTRAINT "types_of_maintenances_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "types_of_maintenances" ADD CONSTRAINT "types_of_maintenances_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_update_by_fkey" FOREIGN KEY ("update_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20230910004900_add_collum_capaciy_per_axle_in_vehicle_model/migration.sql b/prisma/migrations/20230910004900_add_collum_capaciy_per_axle_in_vehicle_model/migration.sql deleted file mode 100644 index 5e814124..00000000 --- a/prisma/migrations/20230910004900_add_collum_capaciy_per_axle_in_vehicle_model/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "vehicle_models" ADD COLUMN "capacity_per_axle" INTEGER; diff --git a/prisma/migrations/20230912201735_/migration.sql b/prisma/migrations/20230912201735_/migration.sql deleted file mode 100644 index 037bed2b..00000000 --- a/prisma/migrations/20230912201735_/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -/*ALTER TABLE "vehicle_models" ADD COLUMN "capacity_per_axle" INTEGER;*/ diff --git a/prisma/migrations/20231007214630_/migration.sql b/prisma/migrations/20231007214630_/migration.sql deleted file mode 100644 index 6f8bcd01..00000000 --- a/prisma/migrations/20231007214630_/migration.sql +++ /dev/null @@ -1,16 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `update_by` on the `vehicle_type_contain_bodyworks` table. All the data in the column will be lost. - - Added the required column `updated_by` to the `vehicle_type_contain_bodyworks` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" DROP CONSTRAINT "vehicle_type_contain_bodyworks_update_by_fkey"; - --- AlterTable -ALTER TABLE "vehicle_type_contain_bodyworks" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" ADD CONSTRAINT "vehicle_type_contain_bodyworks_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231008140047_/migration.sql b/prisma/migrations/20231008140047_/migration.sql deleted file mode 100644 index 80380064..00000000 --- a/prisma/migrations/20231008140047_/migration.sql +++ /dev/null @@ -1,244 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `update_by` on the `carrier_companies` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `ciots` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `company_vehicles` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `contract_outsourced_drivers` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `customer_orders` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `invoices` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `maintenance` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `maintenance_companies` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `order_processing` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `outsourced_drivers` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `outsourced_vehicles` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `own_drivers` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `physical_customers` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `routes` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `types_of_maintenances` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `vehicle_bodyworks` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `vehicle_brands` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `vehicle_models` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `vehicle_types` table. All the data in the column will be lost. - - You are about to drop the column `update_by` on the `vehicles` table. All the data in the column will be lost. - - Added the required column `updated_by` to the `carrier_companies` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `ciots` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `company_vehicles` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `contract_outsourced_drivers` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `customer_orders` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `invoices` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `maintenance` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `maintenance_companies` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `order_processing` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `outsourced_drivers` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `outsourced_vehicles` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `own_drivers` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `physical_customers` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `routes` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `types_of_maintenances` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `vehicle_bodyworks` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `vehicle_brands` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `vehicle_models` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `vehicle_types` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `vehicles` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "carrier_companies" DROP CONSTRAINT "carrier_companies_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "ciots" DROP CONSTRAINT "ciots_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "company_vehicles" DROP CONSTRAINT "company_vehicles_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "contract_outsourced_drivers" DROP CONSTRAINT "contract_outsourced_drivers_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "customer_orders" DROP CONSTRAINT "customer_orders_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "invoices" DROP CONSTRAINT "invoices_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "maintenance" DROP CONSTRAINT "maintenance_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "maintenance_companies" DROP CONSTRAINT "maintenance_companies_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing" DROP CONSTRAINT "order_processing_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "outsourced_drivers" DROP CONSTRAINT "outsourced_drivers_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "outsourced_vehicles" DROP CONSTRAINT "outsourced_vehicles_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "own_drivers" DROP CONSTRAINT "own_drivers_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "physical_customers" DROP CONSTRAINT "physical_customers_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "routes" DROP CONSTRAINT "routes_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "types_of_maintenances" DROP CONSTRAINT "types_of_maintenances_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "vehicle_bodyworks" DROP CONSTRAINT "vehicle_bodyworks_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "vehicle_brands" DROP CONSTRAINT "vehicle_brands_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "vehicle_models" DROP CONSTRAINT "vehicle_models_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "vehicle_types" DROP CONSTRAINT "vehicle_types_update_by_fkey"; - --- DropForeignKey -ALTER TABLE "vehicles" DROP CONSTRAINT "vehicles_update_by_fkey"; - --- AlterTable -ALTER TABLE "carrier_companies" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "ciots" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "company_vehicles" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "contract_outsourced_drivers" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "customer_orders" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "invoices" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "maintenance" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "maintenance_companies" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "order_processing" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "outsourced_drivers" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "outsourced_vehicles" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "own_drivers" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "physical_customers" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "routes" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "types_of_maintenances" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicle_bodyworks" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicle_brands" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicle_models" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicle_types" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "vehicles" DROP COLUMN "update_by", -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "vehicles" ADD CONSTRAINT "vehicles_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_brands" ADD CONSTRAINT "vehicle_brands_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_types" ADD CONSTRAINT "vehicle_types_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "vehicle_bodyworks" ADD CONSTRAINT "vehicle_bodyworks_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "own_drivers" ADD CONSTRAINT "own_drivers_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "carrier_companies" ADD CONSTRAINT "carrier_companies_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "customer_orders" ADD CONSTRAINT "customer_orders_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "routes" ADD CONSTRAINT "routes_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices" ADD CONSTRAINT "invoices_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots" ADD CONSTRAINT "ciots_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing" ADD CONSTRAINT "order_processing_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "types_of_maintenances" ADD CONSTRAINT "types_of_maintenances_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231012185010_/migration.sql b/prisma/migrations/20231012185010_/migration.sql deleted file mode 100644 index 45f0cd6b..00000000 --- a/prisma/migrations/20231012185010_/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[name]` on the table `vehicle_types` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "vehicle_types_name_key" ON "vehicle_types"("name"); diff --git a/prisma/migrations/20231017214516_/migration.sql b/prisma/migrations/20231017214516_/migration.sql deleted file mode 100644 index cb6f681e..00000000 --- a/prisma/migrations/20231017214516_/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `cpf` on the `own_drivers` table. All the data in the column will be lost. - - Added the required column `natural_person_id` to the `own_drivers` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "own_drivers" DROP CONSTRAINT "own_drivers_cpf_fkey"; - --- AlterTable -ALTER TABLE "natural_people" ALTER COLUMN "rg" SET DATA TYPE TEXT, -ALTER COLUMN "cep" SET DATA TYPE TEXT; - --- AlterTable -ALTER TABLE "own_drivers" DROP COLUMN "cpf", -ADD COLUMN "natural_person_id" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "own_drivers" ADD CONSTRAINT "own_drivers_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231018232059_/migration.sql b/prisma/migrations/20231018232059_/migration.sql deleted file mode 100644 index 5eb343fc..00000000 --- a/prisma/migrations/20231018232059_/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `created_at` on the `vehicles` table. All the data in the column will be lost. - - You are about to drop the column `created_by` on the `vehicles` table. All the data in the column will be lost. - - You are about to drop the column `updated_at` on the `vehicles` table. All the data in the column will be lost. - - You are about to drop the column `updated_by` on the `vehicles` table. All the data in the column will be lost. - -*/ --- DropForeignKey -ALTER TABLE "vehicles" DROP CONSTRAINT "vehicles_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "vehicles" DROP CONSTRAINT "vehicles_updated_by_fkey"; - --- AlterTable -ALTER TABLE "vehicles" DROP COLUMN "created_at", -DROP COLUMN "created_by", -DROP COLUMN "updated_at", -DROP COLUMN "updated_by"; diff --git a/prisma/migrations/20231022201723_/migration.sql b/prisma/migrations/20231022201723_/migration.sql deleted file mode 100644 index 4aad2373..00000000 --- a/prisma/migrations/20231022201723_/migration.sql +++ /dev/null @@ -1,40 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `cpf` on the `outsourced_drivers` table. All the data in the column will be lost. - - A unique constraint covering the columns `[outsourced_driver_id]` on the table `contract_outsourced_drivers` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[natural_person_id]` on the table `outsourced_drivers` will be added. If there are existing duplicate values, this will fail. - - Added the required column `outsourced_driver_id` to the `contract_outsourced_drivers` table without a default value. This is not possible if the table is not empty. - - Added the required column `natural_person_id` to the `outsourced_drivers` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "contract_outsourced_drivers" DROP CONSTRAINT "contract_outsourced_drivers_cpf_fkey"; - --- DropForeignKey -ALTER TABLE "outsourced_drivers" DROP CONSTRAINT "outsourced_drivers_cpf_fkey"; - --- DropIndex -DROP INDEX "contract_outsourced_drivers_cpf_key"; - --- DropIndex -DROP INDEX "outsourced_drivers_cpf_key"; - --- AlterTable -ALTER TABLE "contract_outsourced_drivers" ADD COLUMN "outsourced_driver_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "outsourced_drivers" DROP COLUMN "cpf", -ADD COLUMN "natural_person_id" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "contract_outsourced_drivers_outsourced_driver_id_key" ON "contract_outsourced_drivers"("outsourced_driver_id"); - --- CreateIndex -CREATE UNIQUE INDEX "outsourced_drivers_natural_person_id_key" ON "outsourced_drivers"("natural_person_id"); - --- AddForeignKey -ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_outsourced_driver_id_fkey" FOREIGN KEY ("outsourced_driver_id") REFERENCES "outsourced_drivers"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231024233540_/migration.sql b/prisma/migrations/20231024233540_/migration.sql deleted file mode 100644 index 1d43083f..00000000 --- a/prisma/migrations/20231024233540_/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - The primary key for the `contract_outsourced_drivers` table will be changed. If it partially fails, the table could be left without primary key constraint. - -*/ --- AlterTable -ALTER TABLE "contract_outsourced_drivers" DROP CONSTRAINT "contract_outsourced_drivers_pkey", -ADD CONSTRAINT "contract_outsourced_drivers_pkey" PRIMARY KEY ("id", "outsourced_driver_id"); diff --git a/prisma/migrations/20231025213429_/migration.sql b/prisma/migrations/20231025213429_/migration.sql deleted file mode 100644 index 14bc8f39..00000000 --- a/prisma/migrations/20231025213429_/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - The primary key for the `contract_outsourced_drivers` table will be changed. If it partially fails, the table could be left without primary key constraint. - -*/ --- DropIndex -DROP INDEX "contract_outsourced_drivers_outsourced_driver_id_key"; - --- AlterTable -ALTER TABLE "contract_outsourced_drivers" DROP CONSTRAINT "contract_outsourced_drivers_pkey", -ADD CONSTRAINT "contract_outsourced_drivers_pkey" PRIMARY KEY ("id"); diff --git a/prisma/migrations/20231102204736_/migration.sql b/prisma/migrations/20231102204736_/migration.sql deleted file mode 100644 index e215ae8d..00000000 --- a/prisma/migrations/20231102204736_/migration.sql +++ /dev/null @@ -1,474 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `cnpj` on the `carrier_companies` table. All the data in the column will be lost. - - You are about to drop the column `plate` on the `order_processing` table. All the data in the column will be lost. - - You are about to drop the column `cpf` on the `physical_customers` table. All the data in the column will be lost. - - You are about to drop the column `merchandiseId` on the `physical_customers` table. All the data in the column will be lost. - - You are about to drop the `ciots` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `corporate_clients` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `customer_orders` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `invoices` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `legal_contractors` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `merchandise` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `physical_contractors` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `routes` table. If the table is not empty, all the data it contains will be lost. - - A unique constraint covering the columns `[legal_person_id]` on the table `carrier_companies` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[vehicle_id]` on the table `order_processing` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[natural_person_id]` on the table `physical_customers` will be added. If there are existing duplicate values, this will fail. - - Added the required column `legal_person_id` to the `carrier_companies` table without a default value. This is not possible if the table is not empty. - - Added the required column `vehicle_id` to the `order_processing` table without a default value. This is not possible if the table is not empty. - - Added the required column `natural_person_id` to the `physical_customers` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "carrier_companies" DROP CONSTRAINT "carrier_companies_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "ciots" DROP CONSTRAINT "ciots_carrier_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "ciots" DROP CONSTRAINT "ciots_contractor_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "ciots" DROP CONSTRAINT "ciots_contractor_cpf_fkey"; - --- DropForeignKey -ALTER TABLE "ciots" DROP CONSTRAINT "ciots_corporate_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "ciots" DROP CONSTRAINT "ciots_cpf_fkey"; - --- DropForeignKey -ALTER TABLE "ciots" DROP CONSTRAINT "ciots_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "ciots" DROP CONSTRAINT "ciots_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "corporate_clients" DROP CONSTRAINT "corporate_clients_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "customer_orders" DROP CONSTRAINT "customer_orders_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "customer_orders" DROP CONSTRAINT "customer_orders_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "invoices" DROP CONSTRAINT "invoices_carrier_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "invoices" DROP CONSTRAINT "invoices_corporate_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "invoices" DROP CONSTRAINT "invoices_cpf_physicalcustomer_fkey"; - --- DropForeignKey -ALTER TABLE "invoices" DROP CONSTRAINT "invoices_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "invoices" DROP CONSTRAINT "invoices_customerOrderId_fkey"; - --- DropForeignKey -ALTER TABLE "invoices" DROP CONSTRAINT "invoices_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "legal_contractors" DROP CONSTRAINT "legal_contractors_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "merchandise" DROP CONSTRAINT "merchandise_contractor_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "merchandise" DROP CONSTRAINT "merchandise_contractor_cpf_fkey"; - --- DropForeignKey -ALTER TABLE "merchandise" DROP CONSTRAINT "merchandise_corporateClientId_fkey"; - --- DropForeignKey -ALTER TABLE "merchandise" DROP CONSTRAINT "merchandise_order_id_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing" DROP CONSTRAINT "order_processing_plate_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing" DROP CONSTRAINT "order_processing_route_id_fkey"; - --- DropForeignKey -ALTER TABLE "physical_contractors" DROP CONSTRAINT "physical_contractors_cpf_fkey"; - --- DropForeignKey -ALTER TABLE "physical_customers" DROP CONSTRAINT "physical_customers_cpf_fkey"; - --- DropForeignKey -ALTER TABLE "physical_customers" DROP CONSTRAINT "physical_customers_merchandiseId_fkey"; - --- DropForeignKey -ALTER TABLE "routes" DROP CONSTRAINT "routes_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "routes" DROP CONSTRAINT "routes_order_id_fkey"; - --- DropForeignKey -ALTER TABLE "routes" DROP CONSTRAINT "routes_updated_by_fkey"; - --- DropIndex -DROP INDEX "carrier_companies_cnpj_key"; - --- DropIndex -DROP INDEX "order_processing_plate_key"; - --- DropIndex -DROP INDEX "physical_customers_cpf_key"; - --- AlterTable -ALTER TABLE "carrier_companies" DROP COLUMN "cnpj", -ADD COLUMN "legal_person_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "order_processing" DROP COLUMN "plate", -ADD COLUMN "vehicle_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "physical_customers" DROP COLUMN "cpf", -DROP COLUMN "merchandiseId", -ADD COLUMN "natural_person_id" TEXT NOT NULL; - --- DropTable -DROP TABLE "ciots"; - --- DropTable -DROP TABLE "corporate_clients"; - --- DropTable -DROP TABLE "customer_orders"; - --- DropTable -DROP TABLE "invoices"; - --- DropTable -DROP TABLE "legal_contractors"; - --- DropTable -DROP TABLE "merchandise"; - --- DropTable -DROP TABLE "physical_contractors"; - --- DropTable -DROP TABLE "routes"; - --- CreateTable -CREATE TABLE "physical_Contracts" ( - "id" TEXT NOT NULL, - "physicalCustomerId" TEXT NOT NULL, - - CONSTRAINT "physical_Contracts_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "physical_merchandise" ( - "id" TEXT NOT NULL, - "codMerchandise" TEXT NOT NULL, - "amount" INTEGER NOT NULL, - "description" TEXT NOT NULL, - "mass" DOUBLE PRECISION NOT NULL, - "volume" DOUBLE PRECISION NOT NULL, - "value" DOUBLE PRECISION NOT NULL, - "physicalCustomerOrdermId" TEXT NOT NULL, - - CONSTRAINT "physical_merchandise_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "physical_orders" ( - "id" TEXT NOT NULL, - "order" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - "contractId" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - - CONSTRAINT "physical_orders_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "invoices_physical_client" ( - "id" TEXT NOT NULL, - "emission_date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "nature_invoice" TEXT NOT NULL, - "invoice_total" DOUBLE PRECISION NOT NULL, - "form_payment" TEXT NOT NULL, - "additional_data" TEXT NOT NULL, - "digital_signature" TEXT NOT NULL, - "invoice_taxes" DOUBLE PRECISION NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - "carrierCompanyId" TEXT NOT NULL, - "physicalCustomerOrderId" TEXT NOT NULL, - - CONSTRAINT "invoices_physical_client_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "ciots_for_physical_clients" ( - "id" TEXT NOT NULL, - "ciot" TEXT NOT NULL, - "emission_date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "carrier_id" TEXT NOT NULL, - "physycalContractId" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "ciots_for_physical_clients_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "legal_clients" ( - "id" TEXT NOT NULL, - "branch" TEXT NOT NULL, - "legal_person_id" TEXT NOT NULL, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "legal_clients_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "legal_Contracts" ( - "id" TEXT NOT NULL, - "legal_client_id" TEXT NOT NULL, - - CONSTRAINT "legal_Contracts_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "legal_merchandise" ( - "id" TEXT NOT NULL, - "codMerchandise" TEXT NOT NULL, - "amount" INTEGER NOT NULL, - "description" TEXT NOT NULL, - "mass" DOUBLE PRECISION NOT NULL, - "volume" DOUBLE PRECISION NOT NULL, - "value" DOUBLE PRECISION NOT NULL, - "legalClientOrderId" TEXT NOT NULL, - - CONSTRAINT "legal_merchandise_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "legal_orders" ( - "id" TEXT NOT NULL, - "order" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - "legal_contract_id" TEXT NOT NULL, - - CONSTRAINT "legal_orders_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "invoices_legal_client" ( - "id" TEXT NOT NULL, - "emission_date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "nature_invoice" TEXT NOT NULL, - "invoice_total" DOUBLE PRECISION NOT NULL, - "form_payment" TEXT NOT NULL, - "additional_data" TEXT NOT NULL, - "digital_signature" TEXT NOT NULL, - "invoice_taxes" DOUBLE PRECISION NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - "carrier_id" TEXT NOT NULL, - "legalClientrOrderId" TEXT NOT NULL, - - CONSTRAINT "invoices_legal_client_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "ciots_for_legal_clients" ( - "id" TEXT NOT NULL, - "ciot" TEXT NOT NULL, - "emission_date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "carrier_id" TEXT NOT NULL, - "legal_contract_id" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "ciots_for_legal_clients_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "lroutes" ( - "id" TEXT NOT NULL, - "cep" TEXT NOT NULL, - "public_place" TEXT NOT NULL, - "address_number" TEXT NOT NULL, - "neighborhood" TEXT NOT NULL, - "complement" TEXT, - "city" TEXT NOT NULL, - "uf" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "legalClientOrdermId" TEXT NOT NULL, - "physicalCustomerOrderId" TEXT, - - CONSTRAINT "lroutes_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "physical_Contracts_physicalCustomerId_key" ON "physical_Contracts"("physicalCustomerId"); - --- CreateIndex -CREATE UNIQUE INDEX "physical_merchandise_codMerchandise_key" ON "physical_merchandise"("codMerchandise"); - --- CreateIndex -CREATE UNIQUE INDEX "physical_orders_order_key" ON "physical_orders"("order"); - --- CreateIndex -CREATE UNIQUE INDEX "invoices_physical_client_digital_signature_key" ON "invoices_physical_client"("digital_signature"); - --- CreateIndex -CREATE UNIQUE INDEX "ciots_for_physical_clients_ciot_key" ON "ciots_for_physical_clients"("ciot"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_clients_legal_person_id_key" ON "legal_clients"("legal_person_id"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_Contracts_legal_client_id_key" ON "legal_Contracts"("legal_client_id"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_merchandise_codMerchandise_key" ON "legal_merchandise"("codMerchandise"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_orders_order_key" ON "legal_orders"("order"); - --- CreateIndex -CREATE UNIQUE INDEX "invoices_legal_client_digital_signature_key" ON "invoices_legal_client"("digital_signature"); - --- CreateIndex -CREATE UNIQUE INDEX "ciots_for_legal_clients_ciot_key" ON "ciots_for_legal_clients"("ciot"); - --- CreateIndex -CREATE UNIQUE INDEX "carrier_companies_legal_person_id_key" ON "carrier_companies"("legal_person_id"); - --- CreateIndex -CREATE UNIQUE INDEX "order_processing_vehicle_id_key" ON "order_processing"("vehicle_id"); - --- CreateIndex -CREATE UNIQUE INDEX "physical_customers_natural_person_id_key" ON "physical_customers"("natural_person_id"); - --- AddForeignKey -ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_Contracts" ADD CONSTRAINT "physical_Contracts_physicalCustomerId_fkey" FOREIGN KEY ("physicalCustomerId") REFERENCES "physical_customers"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_merchandise" ADD CONSTRAINT "physical_merchandise_physicalCustomerOrdermId_fkey" FOREIGN KEY ("physicalCustomerOrdermId") REFERENCES "physical_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_contractId_fkey" FOREIGN KEY ("contractId") REFERENCES "physical_Contracts"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices_physical_client" ADD CONSTRAINT "invoices_physical_client_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices_physical_client" ADD CONSTRAINT "invoices_physical_client_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices_physical_client" ADD CONSTRAINT "invoices_physical_client_carrierCompanyId_fkey" FOREIGN KEY ("carrierCompanyId") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices_physical_client" ADD CONSTRAINT "invoices_physical_client_physicalCustomerOrderId_fkey" FOREIGN KEY ("physicalCustomerOrderId") REFERENCES "physical_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots_for_physical_clients" ADD CONSTRAINT "ciots_for_physical_clients_carrier_id_fkey" FOREIGN KEY ("carrier_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots_for_physical_clients" ADD CONSTRAINT "ciots_for_physical_clients_physycalContractId_fkey" FOREIGN KEY ("physycalContractId") REFERENCES "physical_Contracts"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots_for_physical_clients" ADD CONSTRAINT "ciots_for_physical_clients_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots_for_physical_clients" ADD CONSTRAINT "ciots_for_physical_clients_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "carrier_companies" ADD CONSTRAINT "carrier_companies_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_clients" ADD CONSTRAINT "legal_clients_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_clients" ADD CONSTRAINT "legal_clients_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_clients" ADD CONSTRAINT "legal_clients_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_Contracts" ADD CONSTRAINT "legal_Contracts_legal_client_id_fkey" FOREIGN KEY ("legal_client_id") REFERENCES "legal_clients"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_merchandise" ADD CONSTRAINT "legal_merchandise_legalClientOrderId_fkey" FOREIGN KEY ("legalClientOrderId") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_legal_contract_id_fkey" FOREIGN KEY ("legal_contract_id") REFERENCES "legal_Contracts"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices_legal_client" ADD CONSTRAINT "invoices_legal_client_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices_legal_client" ADD CONSTRAINT "invoices_legal_client_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices_legal_client" ADD CONSTRAINT "invoices_legal_client_carrier_id_fkey" FOREIGN KEY ("carrier_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "invoices_legal_client" ADD CONSTRAINT "invoices_legal_client_legalClientrOrderId_fkey" FOREIGN KEY ("legalClientrOrderId") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots_for_legal_clients" ADD CONSTRAINT "ciots_for_legal_clients_carrier_id_fkey" FOREIGN KEY ("carrier_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots_for_legal_clients" ADD CONSTRAINT "ciots_for_legal_clients_legal_contract_id_fkey" FOREIGN KEY ("legal_contract_id") REFERENCES "legal_Contracts"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots_for_legal_clients" ADD CONSTRAINT "ciots_for_legal_clients_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ciots_for_legal_clients" ADD CONSTRAINT "ciots_for_legal_clients_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "lroutes" ADD CONSTRAINT "lroutes_legalClientOrdermId_fkey" FOREIGN KEY ("legalClientOrdermId") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "lroutes" ADD CONSTRAINT "lroutes_physicalCustomerOrderId_fkey" FOREIGN KEY ("physicalCustomerOrderId") REFERENCES "physical_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing" ADD CONSTRAINT "order_processing_route_id_fkey" FOREIGN KEY ("route_id") REFERENCES "lroutes"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing" ADD CONSTRAINT "order_processing_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231123223551_/migration.sql b/prisma/migrations/20231123223551_/migration.sql deleted file mode 100644 index d572d310..00000000 --- a/prisma/migrations/20231123223551_/migration.sql +++ /dev/null @@ -1,7 +0,0 @@ --- AlterTable -ALTER TABLE "legal_people" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; - --- AlterTable -ALTER TABLE "physical_customers" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; diff --git a/prisma/migrations/20231128233242_/migration.sql b/prisma/migrations/20231128233242_/migration.sql deleted file mode 100644 index cb70c613..00000000 --- a/prisma/migrations/20231128233242_/migration.sql +++ /dev/null @@ -1,37 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[contract_number]` on the table `legal_Contracts` will be added. If there are existing duplicate values, this will fail. - - Added the required column `carrier_company_id` to the `legal_Contracts` table without a default value. This is not possible if the table is not empty. - - Added the required column `contract_number` to the `legal_Contracts` table without a default value. This is not possible if the table is not empty. - - Added the required column `created_by` to the `legal_Contracts` table without a default value. This is not possible if the table is not empty. - - Added the required column `delivery_conditions` to the `legal_Contracts` table without a default value. This is not possible if the table is not empty. - - Added the required column `effective_date` to the `legal_Contracts` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `legal_Contracts` table without a default value. This is not possible if the table is not empty. - -*/ --- DropIndex -DROP INDEX "legal_Contracts_legal_client_id_key"; - --- AlterTable -ALTER TABLE "legal_Contracts" ADD COLUMN "carrier_company_id" TEXT NOT NULL, -ADD COLUMN "contract_number" TEXT NOT NULL, -ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "created_by" TEXT NOT NULL, -ADD COLUMN "delivery_conditions" VARCHAR(500) NOT NULL, -ADD COLUMN "effective_date" TIMESTAMP(3) NOT NULL, -ADD COLUMN "observations" VARCHAR(500), -ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "updated_by" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "legal_Contracts_contract_number_key" ON "legal_Contracts"("contract_number"); - --- AddForeignKey -ALTER TABLE "legal_Contracts" ADD CONSTRAINT "legal_Contracts_carrier_company_id_fkey" FOREIGN KEY ("carrier_company_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_Contracts" ADD CONSTRAINT "legal_Contracts_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_Contracts" ADD CONSTRAINT "legal_Contracts_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231204231759_/migration.sql b/prisma/migrations/20231204231759_/migration.sql deleted file mode 100644 index 852f0462..00000000 --- a/prisma/migrations/20231204231759_/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `carrier_id` on the `invoices_legal_client` table. All the data in the column will be lost. - -*/ --- DropForeignKey -ALTER TABLE "invoices_legal_client" DROP CONSTRAINT "invoices_legal_client_carrier_id_fkey"; - --- AlterTable -ALTER TABLE "invoices_legal_client" DROP COLUMN "carrier_id"; diff --git a/prisma/migrations/20231206210538_/migration.sql b/prisma/migrations/20231206210538_/migration.sql deleted file mode 100644 index 344ff6a1..00000000 --- a/prisma/migrations/20231206210538_/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- DropForeignKey -ALTER TABLE "ciots_for_legal_clients" DROP CONSTRAINT "ciots_for_legal_clients_carrier_id_fkey"; diff --git a/prisma/migrations/20231207223816_/migration.sql b/prisma/migrations/20231207223816_/migration.sql deleted file mode 100644 index e761ab20..00000000 --- a/prisma/migrations/20231207223816_/migration.sql +++ /dev/null @@ -1,131 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `carrier_id` on the `ciots_for_legal_clients` table. All the data in the column will be lost. - - A unique constraint covering the columns `[vehicle_id]` on the table `outsourced_vehicles` will be added. If there are existing duplicate values, this will fail. - - Added the required column `company_id` to the `company_vehicles` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "ciots_for_legal_clients" DROP COLUMN "carrier_id"; - --- AlterTable -ALTER TABLE "company_vehicles" ADD COLUMN "company_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "contract_outsourced_drivers" ADD COLUMN "outsourcedTransportCompanyDriverId" TEXT; - --- CreateTable -CREATE TABLE "outsourced_transport_vehicle" ( - "id" TEXT NOT NULL, - "outsourced_company_id" TEXT NOT NULL, - "vehicle_id" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "outsourced_transport_vehicle_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "outsourcedT_transport_company_driver" ( - "id" TEXT NOT NULL, - "cnh" TEXT NOT NULL, - "cnh_category" "CNH" NOT NULL, - "cnh_expiration" TIMESTAMP(3) NOT NULL, - "course_mopp" BOOLEAN NOT NULL DEFAULT false, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - "natural_person_id" TEXT NOT NULL, - "outsourced_transport_company_id" TEXT NOT NULL, - - CONSTRAINT "outsourcedT_transport_company_driver_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "OutsourcedTransportCompany" ( - "id" TEXT NOT NULL, - "legal_person_id" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "OutsourcedTransportCompany_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "OutsourcedTransportCompanyContract" ( - "id" TEXT NOT NULL, - "outsourced_transport_company_id" TEXT NOT NULL, - "carrier_company_id" TEXT NOT NULL, - "legal_client_order_id" TEXT NOT NULL, - - CONSTRAINT "OutsourcedTransportCompanyContract_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "outsourced_transport_vehicle_vehicle_id_key" ON "outsourced_transport_vehicle"("vehicle_id"); - --- CreateIndex -CREATE UNIQUE INDEX "outsourcedT_transport_company_driver_cnh_key" ON "outsourcedT_transport_company_driver"("cnh"); - --- CreateIndex -CREATE UNIQUE INDEX "outsourcedT_transport_company_driver_natural_person_id_key" ON "outsourcedT_transport_company_driver"("natural_person_id"); - --- CreateIndex -CREATE UNIQUE INDEX "OutsourcedTransportCompanyContract_legal_client_order_id_key" ON "OutsourcedTransportCompanyContract"("legal_client_order_id"); - --- CreateIndex -CREATE UNIQUE INDEX "outsourced_vehicles_vehicle_id_key" ON "outsourced_vehicles"("vehicle_id"); - --- AddForeignKey -ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_company_id_fkey" FOREIGN KEY ("company_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_transport_vehicle" ADD CONSTRAINT "outsourced_transport_vehicle_outsourced_company_id_fkey" FOREIGN KEY ("outsourced_company_id") REFERENCES "OutsourcedTransportCompany"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_transport_vehicle" ADD CONSTRAINT "outsourced_transport_vehicle_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_transport_vehicle" ADD CONSTRAINT "outsourced_transport_vehicle_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_transport_vehicle" ADD CONSTRAINT "outsourced_transport_vehicle_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourcedT_transport_company_driver" ADD CONSTRAINT "outsourcedT_transport_company_driver_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourcedT_transport_company_driver" ADD CONSTRAINT "outsourcedT_transport_company_driver_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourcedT_transport_company_driver" ADD CONSTRAINT "outsourcedT_transport_company_driver_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourcedT_transport_company_driver" ADD CONSTRAINT "outsourcedT_transport_company_driver_outsourced_transport__fkey" FOREIGN KEY ("outsourced_transport_company_id") REFERENCES "OutsourcedTransportCompany"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_outsourcedTransportCompanyDriv_fkey" FOREIGN KEY ("outsourcedTransportCompanyDriverId") REFERENCES "outsourcedT_transport_company_driver"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "OutsourcedTransportCompany" ADD CONSTRAINT "OutsourcedTransportCompany_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "OutsourcedTransportCompany" ADD CONSTRAINT "OutsourcedTransportCompany_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "OutsourcedTransportCompany" ADD CONSTRAINT "OutsourcedTransportCompany_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_outsourced_transport_co_fkey" FOREIGN KEY ("outsourced_transport_company_id") REFERENCES "OutsourcedTransportCompany"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_carrier_company_id_fkey" FOREIGN KEY ("carrier_company_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_legal_client_order_id_fkey" FOREIGN KEY ("legal_client_order_id") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231212223708_/migration.sql b/prisma/migrations/20231212223708_/migration.sql deleted file mode 100644 index 66a82413..00000000 --- a/prisma/migrations/20231212223708_/migration.sql +++ /dev/null @@ -1,29 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `outsourcedTransportCompanyDriverId` on the `contract_outsourced_drivers` table. All the data in the column will be lost. - - A unique constraint covering the columns `[legal_person_id]` on the table `OutsourcedTransportCompany` will be added. If there are existing duplicate values, this will fail. - - Added the required column `created_by` to the `OutsourcedTransportCompanyContract` table without a default value. This is not possible if the table is not empty. - - Added the required column `updated_by` to the `OutsourcedTransportCompanyContract` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "contract_outsourced_drivers" DROP CONSTRAINT "contract_outsourced_drivers_outsourcedTransportCompanyDriv_fkey"; - --- AlterTable -ALTER TABLE "OutsourcedTransportCompanyContract" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "created_by" TEXT NOT NULL, -ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "updated_by" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "contract_outsourced_drivers" DROP COLUMN "outsourcedTransportCompanyDriverId"; - --- CreateIndex -CREATE UNIQUE INDEX "OutsourcedTransportCompany_legal_person_id_key" ON "OutsourcedTransportCompany"("legal_person_id"); - --- AddForeignKey -ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240103223054_/migration.sql b/prisma/migrations/20240103223054_/migration.sql deleted file mode 100644 index 31d7320f..00000000 --- a/prisma/migrations/20240103223054_/migration.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* - Warnings: - - - Changed the type of `cnh_category` on the `outsourcedT_transport_company_driver` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - - Changed the type of `cnh_category` on the `outsourced_drivers` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - - Changed the type of `cnh_category` on the `own_drivers` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - - Changed the type of `role` on the `users` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - -*/ --- AlterTable -ALTER TABLE "outsourcedT_transport_company_driver" DROP COLUMN "cnh_category", -ADD COLUMN "cnh_category" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "outsourced_drivers" DROP COLUMN "cnh_category", -ADD COLUMN "cnh_category" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "own_drivers" DROP COLUMN "cnh_category", -ADD COLUMN "cnh_category" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "users" DROP COLUMN "role", -ADD COLUMN "role" TEXT NOT NULL; - --- DropEnum -DROP TYPE "CNH"; - --- DropEnum -DROP TYPE "Role"; diff --git a/prisma/migrations/20240123214447_/migration.sql b/prisma/migrations/20240123214447_/migration.sql deleted file mode 100644 index 77f741cf..00000000 --- a/prisma/migrations/20240123214447_/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[contract_number]` on the table `contract_outsourced_drivers` will be added. If there are existing duplicate values, this will fail. - - Added the required column `contract_number` to the `contract_outsourced_drivers` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "contract_outsourced_drivers" ADD COLUMN "contract_number" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "contract_outsourced_drivers_contract_number_key" ON "contract_outsourced_drivers"("contract_number"); diff --git a/prisma/migrations/20240123232954_/migration.sql b/prisma/migrations/20240123232954_/migration.sql deleted file mode 100644 index 351bf85d..00000000 --- a/prisma/migrations/20240123232954_/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[invoice_number]` on the table `invoices_legal_client` will be added. If there are existing duplicate values, this will fail. - - Added the required column `invoice_number` to the `invoices_legal_client` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "invoices_legal_client" ADD COLUMN "invoice_number" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "invoices_legal_client_invoice_number_key" ON "invoices_legal_client"("invoice_number"); diff --git a/prisma/migrations/20240207230346_/migration.sql b/prisma/migrations/20240207230346_/migration.sql deleted file mode 100644 index 3315cd9e..00000000 --- a/prisma/migrations/20240207230346_/migration.sql +++ /dev/null @@ -1,46 +0,0 @@ -/* - Warnings: - - - You are about to drop the `vehicle_type_contain_bodyworks` table. If the table is not empty, all the data it contains will be lost. - - A unique constraint covering the columns `[contract_number]` on the table `OutsourcedTransportCompanyContract` will be added. If there are existing duplicate values, this will fail. - - Added the required column `contract_number` to the `OutsourcedTransportCompanyContract` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" DROP CONSTRAINT "vehicle_type_contain_bodyworks_bodywork_id_fkey"; - --- DropForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" DROP CONSTRAINT "vehicle_type_contain_bodyworks_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" DROP CONSTRAINT "vehicle_type_contain_bodyworks_type_id_fkey"; - --- DropForeignKey -ALTER TABLE "vehicle_type_contain_bodyworks" DROP CONSTRAINT "vehicle_type_contain_bodyworks_updated_by_fkey"; - --- AlterTable -ALTER TABLE "OutsourcedTransportCompanyContract" ADD COLUMN "contract_number" TEXT NOT NULL; - --- DropTable -DROP TABLE "vehicle_type_contain_bodyworks"; - --- CreateTable -CREATE TABLE "_VehicleBodyworkToVehicleType" ( - "A" TEXT NOT NULL, - "B" TEXT NOT NULL -); - --- CreateIndex -CREATE UNIQUE INDEX "_VehicleBodyworkToVehicleType_AB_unique" ON "_VehicleBodyworkToVehicleType"("A", "B"); - --- CreateIndex -CREATE INDEX "_VehicleBodyworkToVehicleType_B_index" ON "_VehicleBodyworkToVehicleType"("B"); - --- CreateIndex -CREATE UNIQUE INDEX "OutsourcedTransportCompanyContract_contract_number_key" ON "OutsourcedTransportCompanyContract"("contract_number"); - --- AddForeignKey -ALTER TABLE "_VehicleBodyworkToVehicleType" ADD CONSTRAINT "_VehicleBodyworkToVehicleType_A_fkey" FOREIGN KEY ("A") REFERENCES "vehicle_bodyworks"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_VehicleBodyworkToVehicleType" ADD CONSTRAINT "_VehicleBodyworkToVehicleType_B_fkey" FOREIGN KEY ("B") REFERENCES "vehicle_types"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240213144500_/migration.sql b/prisma/migrations/20240213144500_/migration.sql deleted file mode 100644 index a385ee3c..00000000 --- a/prisma/migrations/20240213144500_/migration.sql +++ /dev/null @@ -1,23 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `company_vehicle` on the `outsourced_drivers` table. All the data in the column will be lost. - - A unique constraint covering the columns `[company_vehicle_id]` on the table `outsourced_drivers` will be added. If there are existing duplicate values, this will fail. - -*/ --- DropForeignKey -ALTER TABLE "outsourced_drivers" DROP CONSTRAINT "outsourced_drivers_outsourced_vehicle_id_fkey"; - --- AlterTable -ALTER TABLE "outsourced_drivers" DROP COLUMN "company_vehicle", -ADD COLUMN "company_vehicle_id" TEXT, -ALTER COLUMN "outsourced_vehicle_id" DROP NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "outsourced_drivers_company_vehicle_id_key" ON "outsourced_drivers"("company_vehicle_id"); - --- AddForeignKey -ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_outsourced_vehicle_id_fkey" FOREIGN KEY ("outsourced_vehicle_id") REFERENCES "outsourced_vehicles"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_company_vehicle_id_fkey" FOREIGN KEY ("company_vehicle_id") REFERENCES "company_vehicles"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240306003738_add_rntc_field_in_carrier_company_table/migration.sql b/prisma/migrations/20240306003738_add_rntc_field_in_carrier_company_table/migration.sql deleted file mode 100644 index 064b34f5..00000000 --- a/prisma/migrations/20240306003738_add_rntc_field_in_carrier_company_table/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[rntrc]` on the table `carrier_companies` will be added. If there are existing duplicate values, this will fail. - - Added the required column `rntrc` to the `carrier_companies` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "carrier_companies" ADD COLUMN "rntrc" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "carrier_companies_rntrc_key" ON "carrier_companies"("rntrc"); diff --git a/prisma/migrations/20240306202547_change_field_rntrc_expiration_for_antt_in_vehicle_table/migration.sql b/prisma/migrations/20240306202547_change_field_rntrc_expiration_for_antt_in_vehicle_table/migration.sql deleted file mode 100644 index 3b26b44f..00000000 --- a/prisma/migrations/20240306202547_change_field_rntrc_expiration_for_antt_in_vehicle_table/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `rntrc_expiration` on the `vehicles` table. All the data in the column will be lost. - - Added the required column `antt` to the `vehicles` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "vehicles" DROP COLUMN "rntrc_expiration", -ADD COLUMN "antt" TEXT NOT NULL; diff --git a/prisma/migrations/20240306205703_add_field_registration_and_is_ipva_paid_in_vehicle/migration.sql b/prisma/migrations/20240306205703_add_field_registration_and_is_ipva_paid_in_vehicle/migration.sql deleted file mode 100644 index 2785af8a..00000000 --- a/prisma/migrations/20240306205703_add_field_registration_and_is_ipva_paid_in_vehicle/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - Added the required column `is_ipva_paid` to the `vehicles` table without a default value. This is not possible if the table is not empty. - - Added the required column `registration` to the `vehicles` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "vehicles" ADD COLUMN "is_ipva_paid" BOOLEAN NOT NULL, -ADD COLUMN "registration" TIMESTAMP(3) NOT NULL; diff --git a/prisma/migrations/20240307215512_/migration.sql b/prisma/migrations/20240307215512_/migration.sql deleted file mode 100644 index 6c23c81c..00000000 --- a/prisma/migrations/20240307215512_/migration.sql +++ /dev/null @@ -1,34 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `contractId` on the `physical_orders` table. All the data in the column will be lost. - - You are about to drop the `ciots_for_physical_clients` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `physical_Contracts` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE "ciots_for_physical_clients" DROP CONSTRAINT "ciots_for_physical_clients_carrier_id_fkey"; - --- DropForeignKey -ALTER TABLE "ciots_for_physical_clients" DROP CONSTRAINT "ciots_for_physical_clients_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "ciots_for_physical_clients" DROP CONSTRAINT "ciots_for_physical_clients_physycalContractId_fkey"; - --- DropForeignKey -ALTER TABLE "ciots_for_physical_clients" DROP CONSTRAINT "ciots_for_physical_clients_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "physical_Contracts" DROP CONSTRAINT "physical_Contracts_physicalCustomerId_fkey"; - --- DropForeignKey -ALTER TABLE "physical_orders" DROP CONSTRAINT "physical_orders_contractId_fkey"; - --- AlterTable -ALTER TABLE "physical_orders" DROP COLUMN "contractId"; - --- DropTable -DROP TABLE "ciots_for_physical_clients"; - --- DropTable -DROP TABLE "physical_Contracts"; diff --git a/prisma/migrations/20240307215818_ajust_physical_customer_order_name_physical_merchandise/migration.sql b/prisma/migrations/20240307215818_ajust_physical_customer_order_name_physical_merchandise/migration.sql deleted file mode 100644 index 679d5780..00000000 --- a/prisma/migrations/20240307215818_ajust_physical_customer_order_name_physical_merchandise/migration.sql +++ /dev/null @@ -1,16 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `physicalCustomerOrdermId` on the `physical_merchandise` table. All the data in the column will be lost. - - Added the required column `physicalCustomerOrderId` to the `physical_merchandise` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "physical_merchandise" DROP CONSTRAINT "physical_merchandise_physicalCustomerOrdermId_fkey"; - --- AlterTable -ALTER TABLE "physical_merchandise" DROP COLUMN "physicalCustomerOrdermId", -ADD COLUMN "physicalCustomerOrderId" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "physical_merchandise" ADD CONSTRAINT "physical_merchandise_physicalCustomerOrderId_fkey" FOREIGN KEY ("physicalCustomerOrderId") REFERENCES "physical_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240307224431_/migration.sql b/prisma/migrations/20240307224431_/migration.sql deleted file mode 100644 index 72382236..00000000 --- a/prisma/migrations/20240307224431_/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - Added the required column `physical_customer_id` to the `physical_orders` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "physical_orders" ADD COLUMN "physical_customer_id" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_physical_customer_id_fkey" FOREIGN KEY ("physical_customer_id") REFERENCES "physical_customers"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240309010946_/migration.sql b/prisma/migrations/20240309010946_/migration.sql deleted file mode 100644 index cac36b89..00000000 --- a/prisma/migrations/20240309010946_/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[invoice_number]` on the table `invoices_physical_client` will be added. If there are existing duplicate values, this will fail. - - Added the required column `invoice_number` to the `invoices_physical_client` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "invoices_physical_client" ADD COLUMN "invoice_number" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "invoices_physical_client_invoice_number_key" ON "invoices_physical_client"("invoice_number"); diff --git a/prisma/migrations/20240309023509_alter_user_add_avatar_url/migration.sql b/prisma/migrations/20240309023509_alter_user_add_avatar_url/migration.sql deleted file mode 100644 index 9a15dfb4..00000000 --- a/prisma/migrations/20240309023509_alter_user_add_avatar_url/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "users" ADD COLUMN "avatar_url" TEXT; diff --git a/prisma/migrations/20240309233038_/migration.sql b/prisma/migrations/20240309233038_/migration.sql deleted file mode 100644 index 218cab34..00000000 --- a/prisma/migrations/20240309233038_/migration.sql +++ /dev/null @@ -1,160 +0,0 @@ -/* - Warnings: - - - You are about to drop the `lroutes` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `order_processing` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE "company_vehicles" DROP CONSTRAINT "company_vehicles_order_processing_id_fkey"; - --- DropForeignKey -ALTER TABLE "lroutes" DROP CONSTRAINT "lroutes_legalClientOrdermId_fkey"; - --- DropForeignKey -ALTER TABLE "lroutes" DROP CONSTRAINT "lroutes_physicalCustomerOrderId_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing" DROP CONSTRAINT "order_processing_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing" DROP CONSTRAINT "order_processing_route_id_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing" DROP CONSTRAINT "order_processing_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing" DROP CONSTRAINT "order_processing_vehicle_id_fkey"; - --- DropForeignKey -ALTER TABLE "outsourced_vehicles" DROP CONSTRAINT "outsourced_vehicles_order_processing_id_fkey"; - --- AlterTable -ALTER TABLE "company_vehicles" ADD COLUMN "orderProcessingLegalClientId" TEXT; - --- AlterTable -ALTER TABLE "outsourced_vehicles" ADD COLUMN "orderProcessingLegalClientId" TEXT; - --- DropTable -DROP TABLE "lroutes"; - --- DropTable -DROP TABLE "order_processing"; - --- CreateTable -CREATE TABLE "routes_physical_customer" ( - "id" TEXT NOT NULL, - "cep" TEXT NOT NULL, - "public_place" TEXT NOT NULL, - "address_number" TEXT NOT NULL, - "neighborhood" TEXT NOT NULL, - "complement" TEXT, - "city" TEXT NOT NULL, - "uf" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "physicalCustomerOrderId" TEXT NOT NULL, - - CONSTRAINT "routes_physical_customer_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "order_processing_physical_customer" ( - "id" TEXT NOT NULL, - "total_distance" DOUBLE PRECISION NOT NULL, - "total_spend_liters" INTEGER NOT NULL, - "total_spending_money" DOUBLE PRECISION NOT NULL, - "start_at" TIMESTAMP(3) NOT NULL, - "end_at" TIMESTAMP(3) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - "route_id" TEXT NOT NULL, - "vehicle_id" TEXT NOT NULL, - - CONSTRAINT "order_processing_physical_customer_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "routes_legal_client" ( - "id" TEXT NOT NULL, - "cep" TEXT NOT NULL, - "public_place" TEXT NOT NULL, - "address_number" TEXT NOT NULL, - "neighborhood" TEXT NOT NULL, - "complement" TEXT, - "city" TEXT NOT NULL, - "uf" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "legal_client_order_id" TEXT NOT NULL, - - CONSTRAINT "routes_legal_client_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "order_processing_legal_client" ( - "id" TEXT NOT NULL, - "total_distance" DOUBLE PRECISION NOT NULL, - "total_spend_liters" INTEGER NOT NULL, - "total_spending_money" DOUBLE PRECISION NOT NULL, - "start_at" TIMESTAMP(3) NOT NULL, - "end_at" TIMESTAMP(3) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - "route_id" TEXT NOT NULL, - "vehicle_id" TEXT NOT NULL, - - CONSTRAINT "order_processing_legal_client_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "order_processing_physical_customer_vehicle_id_key" ON "order_processing_physical_customer"("vehicle_id"); - --- CreateIndex -CREATE UNIQUE INDEX "order_processing_legal_client_vehicle_id_key" ON "order_processing_legal_client"("vehicle_id"); - --- AddForeignKey -ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_processing_physical_customer"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_orderProcessingLegalClientId_fkey" FOREIGN KEY ("orderProcessingLegalClientId") REFERENCES "order_processing_legal_client"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_processing_physical_customer"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_orderProcessingLegalClientId_fkey" FOREIGN KEY ("orderProcessingLegalClientId") REFERENCES "order_processing_legal_client"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "routes_physical_customer" ADD CONSTRAINT "routes_physical_customer_physicalCustomerOrderId_fkey" FOREIGN KEY ("physicalCustomerOrderId") REFERENCES "physical_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_physical_customer" ADD CONSTRAINT "order_processing_physical_customer_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_physical_customer" ADD CONSTRAINT "order_processing_physical_customer_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_physical_customer" ADD CONSTRAINT "order_processing_physical_customer_route_id_fkey" FOREIGN KEY ("route_id") REFERENCES "routes_physical_customer"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_physical_customer" ADD CONSTRAINT "order_processing_physical_customer_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "routes_legal_client" ADD CONSTRAINT "routes_legal_client_legal_client_order_id_fkey" FOREIGN KEY ("legal_client_order_id") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_legal_client" ADD CONSTRAINT "order_processing_legal_client_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_legal_client" ADD CONSTRAINT "order_processing_legal_client_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_legal_client" ADD CONSTRAINT "order_processing_legal_client_route_id_fkey" FOREIGN KEY ("route_id") REFERENCES "routes_legal_client"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_legal_client" ADD CONSTRAINT "order_processing_legal_client_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240312203959_/migration.sql b/prisma/migrations/20240312203959_/migration.sql deleted file mode 100644 index 4e6f31e3..00000000 --- a/prisma/migrations/20240312203959_/migration.sql +++ /dev/null @@ -1,60 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `route_id` on the `order_processing_legal_client` table. All the data in the column will be lost. - - You are about to drop the column `route_id` on the `order_processing_physical_customer` table. All the data in the column will be lost. - - You are about to drop the column `legal_client_order_id` on the `routes_legal_client` table. All the data in the column will be lost. - - You are about to drop the column `physicalCustomerOrderId` on the `routes_physical_customer` table. All the data in the column will be lost. - - Added the required column `order_id` to the `order_processing_legal_client` table without a default value. This is not possible if the table is not empty. - - Added the required column `order_id` to the `order_processing_physical_customer` table without a default value. This is not possible if the table is not empty. - - Added the required column `order_processing_id` to the `routes_legal_client` table without a default value. This is not possible if the table is not empty. - - Added the required column `order_processing_id` to the `routes_physical_customer` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "order_processing_legal_client" DROP CONSTRAINT "order_processing_legal_client_route_id_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing_physical_customer" DROP CONSTRAINT "order_processing_physical_customer_route_id_fkey"; - --- DropForeignKey -ALTER TABLE "routes_legal_client" DROP CONSTRAINT "routes_legal_client_legal_client_order_id_fkey"; - --- DropForeignKey -ALTER TABLE "routes_physical_customer" DROP CONSTRAINT "routes_physical_customer_physicalCustomerOrderId_fkey"; - --- DropIndex -DROP INDEX "order_processing_legal_client_vehicle_id_key"; - --- DropIndex -DROP INDEX "order_processing_physical_customer_vehicle_id_key"; - --- AlterTable -ALTER TABLE "order_processing_legal_client" DROP COLUMN "route_id", -ADD COLUMN "order_id" TEXT NOT NULL, -ALTER COLUMN "end_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "order_processing_physical_customer" DROP COLUMN "route_id", -ADD COLUMN "order_id" TEXT NOT NULL, -ALTER COLUMN "end_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "routes_legal_client" DROP COLUMN "legal_client_order_id", -ADD COLUMN "order_processing_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "routes_physical_customer" DROP COLUMN "physicalCustomerOrderId", -ADD COLUMN "order_processing_id" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "routes_physical_customer" ADD CONSTRAINT "routes_physical_customer_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_processing_physical_customer"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_physical_customer" ADD CONSTRAINT "order_processing_physical_customer_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "physical_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "routes_legal_client" ADD CONSTRAINT "routes_legal_client_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_processing_legal_client"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_processing_legal_client" ADD CONSTRAINT "order_processing_legal_client_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240314203951_/migration.sql b/prisma/migrations/20240314203951_/migration.sql deleted file mode 100644 index 0b137f50..00000000 --- a/prisma/migrations/20240314203951_/migration.sql +++ /dev/null @@ -1,65 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `legalClientrOrderId` on the `invoices_legal_client` table. All the data in the column will be lost. - - You are about to drop the column `carrierCompanyId` on the `invoices_physical_client` table. All the data in the column will be lost. - - You are about to drop the column `physicalCustomerOrderId` on the `invoices_physical_client` table. All the data in the column will be lost. - - A unique constraint covering the columns `[legalClientOrderId]` on the table `legal_merchandise` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[invoice_id]` on the table `legal_merchandise` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[order_id]` on the table `order_processing_physical_customer` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[physicalCustomerOrderId]` on the table `physical_merchandise` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[invoice_id]` on the table `physical_merchandise` will be added. If there are existing duplicate values, this will fail. - - Added the required column `physical_customer_id` to the `invoices_physical_client` table without a default value. This is not possible if the table is not empty. - - Added the required column `invoice_id` to the `legal_merchandise` table without a default value. This is not possible if the table is not empty. - - Added the required column `invoice_id` to the `physical_merchandise` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "invoices_legal_client" DROP CONSTRAINT "invoices_legal_client_legalClientrOrderId_fkey"; - --- DropForeignKey -ALTER TABLE "invoices_physical_client" DROP CONSTRAINT "invoices_physical_client_carrierCompanyId_fkey"; - --- DropForeignKey -ALTER TABLE "invoices_physical_client" DROP CONSTRAINT "invoices_physical_client_physicalCustomerOrderId_fkey"; - --- AlterTable -ALTER TABLE "invoices_legal_client" DROP COLUMN "legalClientrOrderId"; - --- AlterTable -ALTER TABLE "invoices_physical_client" DROP COLUMN "carrierCompanyId", -DROP COLUMN "physicalCustomerOrderId", -ADD COLUMN "physical_customer_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "legal_merchandise" ADD COLUMN "invoice_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "physical_merchandise" ADD COLUMN "invoice_id" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "legal_merchandise_legalClientOrderId_key" ON "legal_merchandise"("legalClientOrderId"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_merchandise_invoice_id_key" ON "legal_merchandise"("invoice_id"); - --- CreateIndex -CREATE UNIQUE INDEX "order_processing_physical_customer_order_id_key" ON "order_processing_physical_customer"("order_id"); - --- CreateIndex -CREATE UNIQUE INDEX "physical_merchandise_physicalCustomerOrderId_key" ON "physical_merchandise"("physicalCustomerOrderId"); - --- CreateIndex -CREATE UNIQUE INDEX "physical_merchandise_invoice_id_key" ON "physical_merchandise"("invoice_id"); - --- RenameForeignKey -ALTER TABLE "order_processing_physical_customer" RENAME CONSTRAINT "order_processing_physical_customer_order_id_fkey" TO "fk_order"; - --- AddForeignKey -ALTER TABLE "invoices_physical_client" ADD CONSTRAINT "invoices_physical_client_physical_customer_id_fkey" FOREIGN KEY ("physical_customer_id") REFERENCES "physical_customers"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_merchandise" ADD CONSTRAINT "physical_merchandise_invoice_id_fkey" FOREIGN KEY ("invoice_id") REFERENCES "invoices_physical_client"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_merchandise" ADD CONSTRAINT "legal_merchandise_invoice_id_fkey" FOREIGN KEY ("invoice_id") REFERENCES "invoices_legal_client"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240317150314_/migration.sql b/prisma/migrations/20240317150314_/migration.sql deleted file mode 100644 index 3de4a424..00000000 --- a/prisma/migrations/20240317150314_/migration.sql +++ /dev/null @@ -1,67 +0,0 @@ -/* - Warnings: - - - Added the required column `recipient_id` to the `legal_orders` table without a default value. This is not possible if the table is not empty. - - Added the required column `recipient_id` to the `physical_orders` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "legal_orders" ADD COLUMN "recipient_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "physical_orders" ADD COLUMN "recipient_id" TEXT NOT NULL; - --- CreateTable -CREATE TABLE "recipient" ( - "id" TEXT NOT NULL, - "legal_person_id" TEXT, - "natural_person_id" TEXT, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "recipient_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "icms" ( - "id" TEXT NOT NULL, - "state_orgin" TEXT NOT NULL, - "recipient_state" TEXT NOT NULL, - "aliquot" DOUBLE PRECISION NOT NULL, - "effective_date" TIMESTAMP(3) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "icms_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "icms_state_orgin_recipient_state_key" ON "icms"("state_orgin", "recipient_state"); - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_recipient_id_fkey" FOREIGN KEY ("recipient_id") REFERENCES "recipient"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "recipient" ADD CONSTRAINT "recipient_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "recipient" ADD CONSTRAINT "recipient_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "recipient" ADD CONSTRAINT "recipient_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "recipient" ADD CONSTRAINT "recipient_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "icms" ADD CONSTRAINT "icms_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "icms" ADD CONSTRAINT "icms_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_recipient_id_fkey" FOREIGN KEY ("recipient_id") REFERENCES "recipient"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240317181959_/migration.sql b/prisma/migrations/20240317181959_/migration.sql deleted file mode 100644 index 4534ee72..00000000 --- a/prisma/migrations/20240317181959_/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "natural_people" ALTER COLUMN "complement" DROP NOT NULL; diff --git a/prisma/migrations/20240317183039_/migration.sql b/prisma/migrations/20240317183039_/migration.sql deleted file mode 100644 index 7e6e5fc3..00000000 --- a/prisma/migrations/20240317183039_/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[legal_person_id]` on the table `recipient` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[natural_person_id]` on the table `recipient` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "recipient_legal_person_id_key" ON "recipient"("legal_person_id"); - --- CreateIndex -CREATE UNIQUE INDEX "recipient_natural_person_id_key" ON "recipient"("natural_person_id"); diff --git a/prisma/migrations/20240320210539_/migration.sql b/prisma/migrations/20240320210539_/migration.sql deleted file mode 100644 index c68401de..00000000 --- a/prisma/migrations/20240320210539_/migration.sql +++ /dev/null @@ -1,148 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `order_processing_id` on the `company_vehicles` table. All the data in the column will be lost. - - You are about to drop the `order_processing_legal_client` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `order_processing_physical_customer` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `routes_legal_client` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `routes_physical_customer` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE "company_vehicles" DROP CONSTRAINT "company_vehicles_orderProcessingLegalClientId_fkey"; - --- DropForeignKey -ALTER TABLE "company_vehicles" DROP CONSTRAINT "company_vehicles_order_processing_id_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing_legal_client" DROP CONSTRAINT "order_processing_legal_client_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing_legal_client" DROP CONSTRAINT "order_processing_legal_client_order_id_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing_legal_client" DROP CONSTRAINT "order_processing_legal_client_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing_legal_client" DROP CONSTRAINT "order_processing_legal_client_vehicle_id_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing_physical_customer" DROP CONSTRAINT "fk_order"; - --- DropForeignKey -ALTER TABLE "order_processing_physical_customer" DROP CONSTRAINT "order_processing_physical_customer_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing_physical_customer" DROP CONSTRAINT "order_processing_physical_customer_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "order_processing_physical_customer" DROP CONSTRAINT "order_processing_physical_customer_vehicle_id_fkey"; - --- DropForeignKey -ALTER TABLE "outsourced_vehicles" DROP CONSTRAINT "outsourced_vehicles_orderProcessingLegalClientId_fkey"; - --- DropForeignKey -ALTER TABLE "outsourced_vehicles" DROP CONSTRAINT "outsourced_vehicles_order_processing_id_fkey"; - --- DropForeignKey -ALTER TABLE "routes_legal_client" DROP CONSTRAINT "routes_legal_client_order_processing_id_fkey"; - --- DropForeignKey -ALTER TABLE "routes_physical_customer" DROP CONSTRAINT "routes_physical_customer_order_processing_id_fkey"; - --- AlterTable -ALTER TABLE "company_vehicles" DROP COLUMN "order_processing_id"; - --- AlterTable -ALTER TABLE "legal_orders" ADD COLUMN "completedOrdersId" TEXT, -ADD COLUMN "order_processing_id" TEXT; - --- AlterTable -ALTER TABLE "physical_orders" ADD COLUMN "completedOrdersId" TEXT, -ADD COLUMN "order_processing_id" TEXT; - --- DropTable -DROP TABLE "order_processing_legal_client"; - --- DropTable -DROP TABLE "order_processing_physical_customer"; - --- DropTable -DROP TABLE "routes_legal_client"; - --- DropTable -DROP TABLE "routes_physical_customer"; - --- CreateTable -CREATE TABLE "ManifestLegalClinet" ( - "id" TEXT NOT NULL, - "order_id" TEXT NOT NULL, - - CONSTRAINT "ManifestLegalClinet_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "order_procesing" ( - "id" TEXT NOT NULL, - "order_processing_number" TEXT NOT NULL, - "vehicle_id" TEXT NOT NULL, - "total_distance" DOUBLE PRECISION NOT NULL, - "total_spend_liters" DOUBLE PRECISION NOT NULL, - "total_spending_money" DOUBLE PRECISION NOT NULL, - "start_at" TIMESTAMP(3) NOT NULL, - "end_at" TIMESTAMP(3) NOT NULL, - "updated_at" TIMESTAMP(3) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "order_procesing_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "completed_orders" ( - "id" TEXT NOT NULL, - "order_processing_number" TEXT NOT NULL, - "vehicle_id" TEXT NOT NULL, - "total_distance" DOUBLE PRECISION NOT NULL, - "total_spend_liters" DOUBLE PRECISION NOT NULL, - "total_spending_money" DOUBLE PRECISION NOT NULL, - "start_at" TIMESTAMP(3) NOT NULL, - "end_at" TIMESTAMP(3) NOT NULL, - "updated_at" TIMESTAMP(3) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "completed_orders_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "order_procesing_order_processing_number_key" ON "order_procesing"("order_processing_number"); - --- CreateIndex -CREATE UNIQUE INDEX "order_procesing_vehicle_id_key" ON "order_procesing"("vehicle_id"); - --- CreateIndex -CREATE UNIQUE INDEX "completed_orders_vehicle_id_key" ON "completed_orders"("vehicle_id"); - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_procesing"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_completedOrdersId_fkey" FOREIGN KEY ("completedOrdersId") REFERENCES "completed_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ManifestLegalClinet" ADD CONSTRAINT "ManifestLegalClinet_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_procesing"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_completedOrdersId_fkey" FOREIGN KEY ("completedOrdersId") REFERENCES "completed_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "order_procesing" ADD CONSTRAINT "order_procesing_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "completed_orders" ADD CONSTRAINT "completed_orders_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240320211615_/migration.sql b/prisma/migrations/20240320211615_/migration.sql deleted file mode 100644 index 8513bc59..00000000 --- a/prisma/migrations/20240320211615_/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "order_procesing" ALTER COLUMN "end_at" DROP NOT NULL; diff --git a/prisma/migrations/20240322230238_/migration.sql b/prisma/migrations/20240322230238_/migration.sql deleted file mode 100644 index 205740a7..00000000 --- a/prisma/migrations/20240322230238_/migration.sql +++ /dev/null @@ -1,227 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `completedOrdersId` on the `legal_orders` table. All the data in the column will be lost. - - You are about to drop the column `recipient_id` on the `legal_orders` table. All the data in the column will be lost. - - You are about to drop the column `recipient_id` on the `physical_orders` table. All the data in the column will be lost. - - You are about to drop the `ManifestLegalClinet` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `invoices_legal_client` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `invoices_physical_client` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `legal_merchandise` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `physical_merchandise` table. If the table is not empty, all the data it contains will be lost. - - Added the required column `quote_table_id` to the `legal_orders` table without a default value. This is not possible if the table is not empty. - - Added the required column `quote_table_id` to the `physical_orders` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "ManifestLegalClinet" DROP CONSTRAINT "ManifestLegalClinet_order_id_fkey"; - --- DropForeignKey -ALTER TABLE "invoices_legal_client" DROP CONSTRAINT "invoices_legal_client_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "invoices_legal_client" DROP CONSTRAINT "invoices_legal_client_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "invoices_physical_client" DROP CONSTRAINT "invoices_physical_client_created_by_fkey"; - --- DropForeignKey -ALTER TABLE "invoices_physical_client" DROP CONSTRAINT "invoices_physical_client_physical_customer_id_fkey"; - --- DropForeignKey -ALTER TABLE "invoices_physical_client" DROP CONSTRAINT "invoices_physical_client_updated_by_fkey"; - --- DropForeignKey -ALTER TABLE "legal_merchandise" DROP CONSTRAINT "legal_merchandise_invoice_id_fkey"; - --- DropForeignKey -ALTER TABLE "legal_merchandise" DROP CONSTRAINT "legal_merchandise_legalClientOrderId_fkey"; - --- DropForeignKey -ALTER TABLE "legal_orders" DROP CONSTRAINT "legal_orders_completedOrdersId_fkey"; - --- DropForeignKey -ALTER TABLE "legal_orders" DROP CONSTRAINT "legal_orders_recipient_id_fkey"; - --- DropForeignKey -ALTER TABLE "physical_merchandise" DROP CONSTRAINT "physical_merchandise_invoice_id_fkey"; - --- DropForeignKey -ALTER TABLE "physical_merchandise" DROP CONSTRAINT "physical_merchandise_physicalCustomerOrderId_fkey"; - --- DropForeignKey -ALTER TABLE "physical_orders" DROP CONSTRAINT "physical_orders_recipient_id_fkey"; - --- AlterTable -ALTER TABLE "legal_orders" DROP COLUMN "completedOrdersId", -DROP COLUMN "recipient_id", -ADD COLUMN "completed_orders_id" TEXT, -ADD COLUMN "quote_table_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "physical_orders" DROP COLUMN "recipient_id", -ADD COLUMN "quote_table_id" TEXT NOT NULL; - --- DropTable -DROP TABLE "ManifestLegalClinet"; - --- DropTable -DROP TABLE "invoices_legal_client"; - --- DropTable -DROP TABLE "invoices_physical_client"; - --- DropTable -DROP TABLE "legal_merchandise"; - --- DropTable -DROP TABLE "physical_merchandise"; - --- CreateTable -CREATE TABLE "physical_customer_quote" ( - "id" TEXT NOT NULL, - "cod_quote" TEXT NOT NULL, - "recipient_id" TEXT NOT NULL, - "senderId" TEXT NOT NULL, - "who_pays" TEXT NOT NULL, - "postal_cod_origin" TEXT NOT NULL, - "postal_cod_destiny" TEXT NOT NULL, - "type_merchandise" TEXT NOT NULL, - "amount" INTEGER NOT NULL, - "description" TEXT NOT NULL, - "mass" DOUBLE PRECISION NOT NULL, - "volume" DOUBLE PRECISION NOT NULL, - "nf_value" DOUBLE PRECISION NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "physical_customer_quote_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "physical_customer_cte" ( - "id" TEXT NOT NULL, - "order_id" TEXT NOT NULL, - "access_key" TEXT NOT NULL, - "type_cte" TEXT NOT NULL, - "observations" TEXT NOT NULL, - "cte_number" TEXT NOT NULL, - - CONSTRAINT "physical_customer_cte_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "sender" ( - "id" TEXT NOT NULL, - "legal_person_id" TEXT, - "natural_person_id" TEXT, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "sender_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "legal_client_cte" ( - "id" TEXT NOT NULL, - "order_id" TEXT NOT NULL, - "access_key" TEXT NOT NULL, - "type_cte" TEXT NOT NULL, - "observations" TEXT NOT NULL, - "cte_number" TEXT NOT NULL, - - CONSTRAINT "legal_client_cte_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "legal_client_quote" ( - "id" TEXT NOT NULL, - "cod_quote" TEXT NOT NULL, - "recipient_id" TEXT NOT NULL, - "sender_id" TEXT NOT NULL, - "who_pays" TEXT NOT NULL, - "postal_cod_origin" TEXT NOT NULL, - "postal_cod_destiny" TEXT NOT NULL, - "type_merchandise" TEXT NOT NULL, - "amount" INTEGER NOT NULL, - "description" TEXT NOT NULL, - "mass" DOUBLE PRECISION NOT NULL, - "volume" DOUBLE PRECISION NOT NULL, - "nf_value" DOUBLE PRECISION NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - - CONSTRAINT "legal_client_quote_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "physical_customer_quote_postal_cod_destiny_postal_cod_origi_key" ON "physical_customer_quote"("postal_cod_destiny", "postal_cod_origin"); - --- CreateIndex -CREATE UNIQUE INDEX "physical_customer_cte_order_id_key" ON "physical_customer_cte"("order_id"); - --- CreateIndex -CREATE UNIQUE INDEX "sender_legal_person_id_key" ON "sender"("legal_person_id"); - --- CreateIndex -CREATE UNIQUE INDEX "sender_natural_person_id_key" ON "sender"("natural_person_id"); - --- CreateIndex -CREATE UNIQUE INDEX "legal_client_cte_order_id_key" ON "legal_client_cte"("order_id"); - --- AddForeignKey -ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_recipient_id_fkey" FOREIGN KEY ("recipient_id") REFERENCES "recipient"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_senderId_fkey" FOREIGN KEY ("senderId") REFERENCES "sender"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_quote_table_id_fkey" FOREIGN KEY ("quote_table_id") REFERENCES "physical_customer_quote"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "physical_customer_cte" ADD CONSTRAINT "physical_customer_cte_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "physical_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "sender" ADD CONSTRAINT "sender_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "sender" ADD CONSTRAINT "sender_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "sender" ADD CONSTRAINT "sender_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "sender" ADD CONSTRAINT "sender_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_client_cte" ADD CONSTRAINT "legal_client_cte_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_recipient_id_fkey" FOREIGN KEY ("recipient_id") REFERENCES "recipient"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_sender_id_fkey" FOREIGN KEY ("sender_id") REFERENCES "sender"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_quote_table_id_fkey" FOREIGN KEY ("quote_table_id") REFERENCES "legal_client_quote"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_completed_orders_id_fkey" FOREIGN KEY ("completed_orders_id") REFERENCES "completed_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240328213005_/migration.sql b/prisma/migrations/20240328213005_/migration.sql deleted file mode 100644 index 1df29989..00000000 --- a/prisma/migrations/20240328213005_/migration.sql +++ /dev/null @@ -1,16 +0,0 @@ --- CreateTable -CREATE TABLE "freight_expenses" ( - "id" TEXT NOT NULL, - "expense_name" TEXT NOT NULL, - "value" DOUBLE PRECISION NOT NULL, - "legal_client_order_id" TEXT, - "physical_customer_id" TEXT, - - CONSTRAINT "freight_expenses_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "freight_expenses" ADD CONSTRAINT "legal_client_order_fk" FOREIGN KEY ("legal_client_order_id") REFERENCES "legal_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "freight_expenses" ADD CONSTRAINT "freight_expenses_physical_customer_id_fkey" FOREIGN KEY ("physical_customer_id") REFERENCES "physical_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240401215129_/migration.sql b/prisma/migrations/20240401215129_/migration.sql deleted file mode 100644 index d2f86894..00000000 --- a/prisma/migrations/20240401215129_/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ -/* - Warnings: - - - Added the required column `carrier_id` to the `legal_orders` table without a default value. This is not possible if the table is not empty. - - Added the required column `carrier_id` to the `physical_orders` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "legal_orders" ADD COLUMN "carrier_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "physical_orders" ADD COLUMN "carrier_id" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_carrier_id_fkey" FOREIGN KEY ("carrier_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_carrier_id_fkey" FOREIGN KEY ("carrier_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240405223110_/migration.sql b/prisma/migrations/20240405223110_/migration.sql deleted file mode 100644 index 96869a58..00000000 --- a/prisma/migrations/20240405223110_/migration.sql +++ /dev/null @@ -1,16 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `corrective` on the `types_of_maintenances` table. All the data in the column will be lost. - - You are about to drop the column `preventive` on the `types_of_maintenances` table. All the data in the column will be lost. - - A unique constraint covering the columns `[description,typeMaintenance]` on the table `types_of_maintenances` will be added. If there are existing duplicate values, this will fail. - - Added the required column `typeMaintenance` to the `types_of_maintenances` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "types_of_maintenances" DROP COLUMN "corrective", -DROP COLUMN "preventive", -ADD COLUMN "typeMaintenance" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "types_of_maintenances_description_typeMaintenance_key" ON "types_of_maintenances"("description", "typeMaintenance"); diff --git a/prisma/migrations/20240406132931_/migration.sql b/prisma/migrations/20240406132931_/migration.sql deleted file mode 100644 index 22e08323..00000000 --- a/prisma/migrations/20240406132931_/migration.sql +++ /dev/null @@ -1,36 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `maintenance_company_cnpj` on the `maintenance` table. All the data in the column will be lost. - - You are about to drop the column `cnpj` on the `maintenance_companies` table. All the data in the column will be lost. - - A unique constraint covering the columns `[legal_person_id]` on the table `maintenance_companies` will be added. If there are existing duplicate values, this will fail. - - Added the required column `maintenance_company_id` to the `maintenance` table without a default value. This is not possible if the table is not empty. - - Added the required column `legal_person_id` to the `maintenance_companies` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "maintenance" DROP CONSTRAINT "maintenance_maintenance_company_cnpj_fkey"; - --- DropForeignKey -ALTER TABLE "maintenance_companies" DROP CONSTRAINT "maintenance_companies_cnpj_fkey"; - --- DropIndex -DROP INDEX "maintenance_companies_cnpj_key"; - --- AlterTable -ALTER TABLE "maintenance" DROP COLUMN "maintenance_company_cnpj", -ADD COLUMN "maintenance_company_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "maintenance_companies" DROP COLUMN "cnpj", -ADD COLUMN "legal_person_id" TEXT NOT NULL, -ALTER COLUMN "specialty_maintenance" DROP NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "maintenance_companies_legal_person_id_key" ON "maintenance_companies"("legal_person_id"); - --- AddForeignKey -ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("cnpj") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_maintenance_company_id_fkey" FOREIGN KEY ("maintenance_company_id") REFERENCES "maintenance_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240406135042_/migration.sql b/prisma/migrations/20240406135042_/migration.sql deleted file mode 100644 index cefaf871..00000000 --- a/prisma/migrations/20240406135042_/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- DropForeignKey -ALTER TABLE "maintenance_companies" DROP CONSTRAINT "maintenance_companies_legal_person_id_fkey"; - --- AddForeignKey -ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240406153248_/migration.sql b/prisma/migrations/20240406153248_/migration.sql deleted file mode 100644 index 79a4d492..00000000 --- a/prisma/migrations/20240406153248_/migration.sql +++ /dev/null @@ -1,27 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `maintenance_process_id` on the `maintenance` table. All the data in the column will be lost. - - You are about to drop the column `plate` on the `maintenance` table. All the data in the column will be lost. - - Added the required column `type_of_maintenance_id` to the `maintenance` table without a default value. This is not possible if the table is not empty. - - Added the required column `vehicle_id` to the `maintenance` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "maintenance" DROP CONSTRAINT "maintenance_maintenance_process_id_fkey"; - --- DropForeignKey -ALTER TABLE "maintenance" DROP CONSTRAINT "maintenance_plate_fkey"; - --- AlterTable -ALTER TABLE "maintenance" DROP COLUMN "maintenance_process_id", -DROP COLUMN "plate", -ADD COLUMN "finished_at" TIMESTAMP(3), -ADD COLUMN "type_of_maintenance_id" TEXT NOT NULL, -ADD COLUMN "vehicle_id" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_type_of_maintenance_id_fkey" FOREIGN KEY ("type_of_maintenance_id") REFERENCES "types_of_maintenances"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240423224132_add_status_in_order_processing_entity/migration.sql b/prisma/migrations/20240423224132_add_status_in_order_processing_entity/migration.sql deleted file mode 100644 index c3cf48d6..00000000 --- a/prisma/migrations/20240423224132_add_status_in_order_processing_entity/migration.sql +++ /dev/null @@ -1,26 +0,0 @@ --- AlterTable -ALTER TABLE "order_procesing" ADD COLUMN "status" TEXT NOT NULL DEFAULT 'created'; - --- CreateTable -CREATE TABLE "Incident" ( - "id" TEXT NOT NULL, - "description" TEXT NOT NULL, - "date_incident" TIMESTAMP(3) NOT NULL, - "order_process_id" TEXT NOT NULL, - "date_resolved" TIMESTAMP(3), - "created_by" TEXT NOT NULL, - "updated_by" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Incident_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "Incident" ADD CONSTRAINT "Incident_order_process_id_fkey" FOREIGN KEY ("order_process_id") REFERENCES "order_procesing"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Incident" ADD CONSTRAINT "Incident_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Incident" ADD CONSTRAINT "Incident_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240502203157_/migration.sql b/prisma/migrations/20240502203157_/migration.sql new file mode 100644 index 00000000..bfc42b46 --- /dev/null +++ b/prisma/migrations/20240502203157_/migration.sql @@ -0,0 +1,1075 @@ +-- CreateTable +CREATE TABLE "users" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "username" TEXT NOT NULL, + "email" TEXT NOT NULL, + "role" TEXT NOT NULL, + "avatar_url" TEXT, + "password" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "users_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "vehicles" ( + "id" TEXT NOT NULL, + "plate" TEXT NOT NULL, + "year" TEXT NOT NULL, + "color" TEXT NOT NULL, + "renavam" TEXT NOT NULL, + "antt" TEXT NOT NULL, + "registration" TIMESTAMP(3) NOT NULL, + "is_ipva_paid" BOOLEAN NOT NULL, + "model_id" TEXT NOT NULL, + + CONSTRAINT "vehicles_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "vehicle_models" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "weight" DOUBLE PRECISION NOT NULL, + "capacity_max" DOUBLE PRECISION NOT NULL, + "axles" INTEGER NOT NULL, + "capacity_per_axle" INTEGER, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "brand_id" TEXT NOT NULL, + "type_id" TEXT NOT NULL, + + CONSTRAINT "vehicle_models_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "vehicle_brands" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "vehicle_brands_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "vehicle_types" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "bodywork" BOOLEAN NOT NULL DEFAULT false, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "vehicle_types_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "vehicle_bodyworks" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "axles" INTEGER NOT NULL, + "mass" DOUBLE PRECISION NOT NULL, + "volume" DOUBLE PRECISION NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "vehicle_bodyworks_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "outsourced_vehicles" ( + "id" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "vehicle_id" TEXT NOT NULL, + "order_processing_id" TEXT, + "orderProcessingLegalClientId" TEXT, + + CONSTRAINT "outsourced_vehicles_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "company_vehicles" ( + "id" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "company_id" TEXT NOT NULL, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "vehicle_id" TEXT NOT NULL, + "orderProcessingLegalClientId" TEXT, + + CONSTRAINT "company_vehicles_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "outsourced_transport_vehicle" ( + "id" TEXT NOT NULL, + "outsourced_company_id" TEXT NOT NULL, + "vehicle_id" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "outsourced_transport_vehicle_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "outsourced_drivers" ( + "id" TEXT NOT NULL, + "cnh" TEXT NOT NULL, + "cnh_category" TEXT NOT NULL, + "cnh_expiration" TIMESTAMP(3) NOT NULL, + "course_mopp" BOOLEAN NOT NULL DEFAULT false, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "natural_person_id" TEXT NOT NULL, + "outsourced_vehicle_id" TEXT, + "company_vehicle_id" TEXT, + + CONSTRAINT "outsourced_drivers_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "outsourcedT_transport_company_driver" ( + "id" TEXT NOT NULL, + "cnh" TEXT NOT NULL, + "cnh_category" TEXT NOT NULL, + "cnh_expiration" TIMESTAMP(3) NOT NULL, + "course_mopp" BOOLEAN NOT NULL DEFAULT false, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "natural_person_id" TEXT NOT NULL, + "outsourced_transport_company_id" TEXT NOT NULL, + + CONSTRAINT "outsourcedT_transport_company_driver_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "contract_outsourced_drivers" ( + "id" TEXT NOT NULL, + "contract_number" TEXT NOT NULL, + "type" TEXT NOT NULL, + "situation" TEXT NOT NULL, + "start_at" TIMESTAMP(3) NOT NULL, + "end_at" TIMESTAMP(3), + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "cpf" TEXT NOT NULL, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "outsourced_driver_id" TEXT NOT NULL, + + CONSTRAINT "contract_outsourced_drivers_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "own_drivers" ( + "id" TEXT NOT NULL, + "cnh" TEXT NOT NULL, + "cnh_category" TEXT NOT NULL, + "cnh_expiration" TIMESTAMP(3) NOT NULL, + "company_vehicle" BOOLEAN NOT NULL DEFAULT false, + "course_mopp" BOOLEAN NOT NULL DEFAULT false, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "natural_person_id" TEXT NOT NULL, + + CONSTRAINT "own_drivers_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "natural_people" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "date_birth" TIMESTAMP(3) NOT NULL, + "gender" TEXT NOT NULL, + "cpf" TEXT NOT NULL, + "rg" TEXT NOT NULL, + "cep" TEXT NOT NULL, + "public_place" TEXT NOT NULL, + "address_number" TEXT NOT NULL, + "neighborhood" TEXT NOT NULL, + "complement" TEXT, + "city" TEXT NOT NULL, + "uf" TEXT NOT NULL, + "first_phone" TEXT NOT NULL, + "second_phone" TEXT, + "third_phone" TEXT, + "email" TEXT NOT NULL, + "nationality" TEXT NOT NULL, + + CONSTRAINT "natural_people_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "physical_customers" ( + "id" TEXT NOT NULL, + "branch" TEXT, + "natural_person_id" TEXT NOT NULL, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "physical_customers_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "carrier_companies" ( + "id" TEXT NOT NULL, + "legal_person_id" TEXT NOT NULL, + "rntrc" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "carrier_companies_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "OutsourcedTransportCompany" ( + "id" TEXT NOT NULL, + "legal_person_id" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "OutsourcedTransportCompany_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "OutsourcedTransportCompanyContract" ( + "id" TEXT NOT NULL, + "contract_number" TEXT NOT NULL, + "outsourced_transport_company_id" TEXT NOT NULL, + "carrier_company_id" TEXT NOT NULL, + "legal_client_order_id" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "OutsourcedTransportCompanyContract_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "physical_customer_quote" ( + "id" TEXT NOT NULL, + "cod_quote" TEXT NOT NULL, + "recipient_id" TEXT NOT NULL, + "senderId" TEXT NOT NULL, + "who_pays" TEXT NOT NULL, + "postal_cod_origin" TEXT NOT NULL, + "postal_cod_destiny" TEXT NOT NULL, + "type_merchandise" TEXT NOT NULL, + "amount" INTEGER NOT NULL, + "description" TEXT NOT NULL, + "mass" DOUBLE PRECISION NOT NULL, + "volume" DOUBLE PRECISION NOT NULL, + "nf_value" DOUBLE PRECISION NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "physical_customer_quote_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "physical_orders" ( + "id" TEXT NOT NULL, + "order" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "physical_customer_id" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "carrier_id" TEXT NOT NULL, + "order_processing_id" TEXT, + "completedOrdersId" TEXT, + "quote_table_id" TEXT NOT NULL, + + CONSTRAINT "physical_orders_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "physical_customer_cte" ( + "id" TEXT NOT NULL, + "order_id" TEXT NOT NULL, + "access_key" TEXT NOT NULL, + "type_cte" TEXT NOT NULL, + "observations" TEXT NOT NULL, + "cte_number" TEXT NOT NULL, + + CONSTRAINT "physical_customer_cte_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "sender" ( + "id" TEXT NOT NULL, + "legal_person_id" TEXT, + "natural_person_id" TEXT, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "sender_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "recipient" ( + "id" TEXT NOT NULL, + "legal_person_id" TEXT, + "natural_person_id" TEXT, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "recipient_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "icms" ( + "id" TEXT NOT NULL, + "state_orgin" TEXT NOT NULL, + "recipient_state" TEXT NOT NULL, + "aliquot" DOUBLE PRECISION NOT NULL, + "effective_date" TIMESTAMP(3) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "icms_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "legal_people" ( + "id" TEXT NOT NULL, + "fantasy_name" TEXT NOT NULL, + "cnpj" TEXT NOT NULL, + "state_registration" TEXT NOT NULL, + "corporate_name" TEXT NOT NULL, + "public_place" TEXT NOT NULL, + "address_number" TEXT NOT NULL, + "neighborhood" TEXT NOT NULL, + "complement" TEXT, + "city" TEXT NOT NULL, + "uf" TEXT NOT NULL, + "first_phone" TEXT NOT NULL, + "second_phone" TEXT, + "third_phone" TEXT, + "email" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "legal_people_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "legal_clients" ( + "id" TEXT NOT NULL, + "branch" TEXT NOT NULL, + "legal_person_id" TEXT NOT NULL, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "legal_clients_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "legal_client_cte" ( + "id" TEXT NOT NULL, + "order_id" TEXT NOT NULL, + "access_key" TEXT NOT NULL, + "type_cte" TEXT NOT NULL, + "observations" TEXT NOT NULL, + "cte_number" TEXT NOT NULL, + + CONSTRAINT "legal_client_cte_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "legal_Contracts" ( + "id" TEXT NOT NULL, + "contract_number" TEXT NOT NULL, + "legal_client_id" TEXT NOT NULL, + "carrier_company_id" TEXT NOT NULL, + "observations" VARCHAR(500), + "delivery_conditions" VARCHAR(500) NOT NULL, + "effective_date" TIMESTAMP(3) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "legal_Contracts_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "legal_client_quote" ( + "id" TEXT NOT NULL, + "cod_quote" TEXT NOT NULL, + "recipient_id" TEXT NOT NULL, + "sender_id" TEXT NOT NULL, + "who_pays" TEXT NOT NULL, + "postal_cod_origin" TEXT NOT NULL, + "postal_cod_destiny" TEXT NOT NULL, + "type_merchandise" TEXT NOT NULL, + "amount" INTEGER NOT NULL, + "description" TEXT NOT NULL, + "mass" DOUBLE PRECISION NOT NULL, + "volume" DOUBLE PRECISION NOT NULL, + "nf_value" DOUBLE PRECISION NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "legal_client_quote_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "legal_orders" ( + "id" TEXT NOT NULL, + "order" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "legal_contract_id" TEXT NOT NULL, + "quote_table_id" TEXT NOT NULL, + "order_processing_id" TEXT, + "carrier_id" TEXT NOT NULL, + "completed_orders_id" TEXT, + + CONSTRAINT "legal_orders_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ciots_for_legal_clients" ( + "id" TEXT NOT NULL, + "ciot" TEXT NOT NULL, + "emission_date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "legal_contract_id" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "ciots_for_legal_clients_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "order_procesing" ( + "id" TEXT NOT NULL, + "order_processing_number" TEXT NOT NULL, + "vehicle_id" TEXT NOT NULL, + "total_distance" DOUBLE PRECISION NOT NULL, + "total_spend_liters" DOUBLE PRECISION NOT NULL, + "total_spending_money" DOUBLE PRECISION NOT NULL, + "status" TEXT NOT NULL DEFAULT 'created', + "start_at" TIMESTAMP(3) NOT NULL, + "end_at" TIMESTAMP(3), + "updated_at" TIMESTAMP(3) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "order_procesing_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Incident" ( + "id" TEXT NOT NULL, + "description" TEXT NOT NULL, + "date_incident" TIMESTAMP(3) NOT NULL, + "order_process_id" TEXT NOT NULL, + "date_resolved" TIMESTAMP(3), + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Incident_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "completed_orders" ( + "id" TEXT NOT NULL, + "order_processing_number" TEXT NOT NULL, + "vehicle_id" TEXT NOT NULL, + "total_distance" DOUBLE PRECISION NOT NULL, + "total_spend_liters" DOUBLE PRECISION NOT NULL, + "total_spending_money" DOUBLE PRECISION NOT NULL, + "start_at" TIMESTAMP(3) NOT NULL, + "end_at" TIMESTAMP(3) NOT NULL, + "updated_at" TIMESTAMP(3) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "completed_orders_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "freight_expenses" ( + "id" TEXT NOT NULL, + "expense_name" TEXT NOT NULL, + "value" DOUBLE PRECISION NOT NULL, + "legal_client_order_id" TEXT, + "physical_customer_id" TEXT, + + CONSTRAINT "freight_expenses_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "types_of_maintenances" ( + "id" TEXT NOT NULL, + "description" TEXT NOT NULL, + "typeMaintenance" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "types_of_maintenances_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "maintenance_companies" ( + "id" TEXT NOT NULL, + "specialty_maintenance" TEXT, + "legal_person_id" TEXT NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "maintenance_companies_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "maintenance" ( + "id" TEXT NOT NULL, + "maintenance_company_id" TEXT NOT NULL, + "vehicle_id" TEXT NOT NULL, + "type_of_maintenance_id" TEXT NOT NULL, + "finished_at" TIMESTAMP(3), + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "maintenance_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "_VehicleBodyworkToVehicleType" ( + "A" TEXT NOT NULL, + "B" TEXT NOT NULL +); + +-- CreateIndex +CREATE UNIQUE INDEX "users_username_key" ON "users"("username"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_email_key" ON "users"("email"); + +-- CreateIndex +CREATE UNIQUE INDEX "vehicles_plate_key" ON "vehicles"("plate"); + +-- CreateIndex +CREATE UNIQUE INDEX "vehicle_brands_name_key" ON "vehicle_brands"("name"); + +-- CreateIndex +CREATE UNIQUE INDEX "vehicle_types_name_key" ON "vehicle_types"("name"); + +-- CreateIndex +CREATE UNIQUE INDEX "outsourced_vehicles_vehicle_id_key" ON "outsourced_vehicles"("vehicle_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "company_vehicles_vehicle_id_key" ON "company_vehicles"("vehicle_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "outsourced_transport_vehicle_vehicle_id_key" ON "outsourced_transport_vehicle"("vehicle_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "outsourced_drivers_cnh_key" ON "outsourced_drivers"("cnh"); + +-- CreateIndex +CREATE UNIQUE INDEX "outsourced_drivers_natural_person_id_key" ON "outsourced_drivers"("natural_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "outsourced_drivers_outsourced_vehicle_id_key" ON "outsourced_drivers"("outsourced_vehicle_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "outsourced_drivers_company_vehicle_id_key" ON "outsourced_drivers"("company_vehicle_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "outsourcedT_transport_company_driver_cnh_key" ON "outsourcedT_transport_company_driver"("cnh"); + +-- CreateIndex +CREATE UNIQUE INDEX "outsourcedT_transport_company_driver_natural_person_id_key" ON "outsourcedT_transport_company_driver"("natural_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "contract_outsourced_drivers_contract_number_key" ON "contract_outsourced_drivers"("contract_number"); + +-- CreateIndex +CREATE UNIQUE INDEX "own_drivers_cnh_key" ON "own_drivers"("cnh"); + +-- CreateIndex +CREATE UNIQUE INDEX "natural_people_cpf_key" ON "natural_people"("cpf"); + +-- CreateIndex +CREATE UNIQUE INDEX "natural_people_rg_key" ON "natural_people"("rg"); + +-- CreateIndex +CREATE UNIQUE INDEX "physical_customers_natural_person_id_key" ON "physical_customers"("natural_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "carrier_companies_legal_person_id_key" ON "carrier_companies"("legal_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "carrier_companies_rntrc_key" ON "carrier_companies"("rntrc"); + +-- CreateIndex +CREATE UNIQUE INDEX "OutsourcedTransportCompany_legal_person_id_key" ON "OutsourcedTransportCompany"("legal_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "OutsourcedTransportCompanyContract_contract_number_key" ON "OutsourcedTransportCompanyContract"("contract_number"); + +-- CreateIndex +CREATE UNIQUE INDEX "OutsourcedTransportCompanyContract_legal_client_order_id_key" ON "OutsourcedTransportCompanyContract"("legal_client_order_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "physical_customer_quote_postal_cod_destiny_postal_cod_origi_key" ON "physical_customer_quote"("postal_cod_destiny", "postal_cod_origin"); + +-- CreateIndex +CREATE UNIQUE INDEX "physical_orders_order_key" ON "physical_orders"("order"); + +-- CreateIndex +CREATE UNIQUE INDEX "physical_customer_cte_order_id_key" ON "physical_customer_cte"("order_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "sender_legal_person_id_key" ON "sender"("legal_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "sender_natural_person_id_key" ON "sender"("natural_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "recipient_legal_person_id_key" ON "recipient"("legal_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "recipient_natural_person_id_key" ON "recipient"("natural_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "icms_state_orgin_recipient_state_key" ON "icms"("state_orgin", "recipient_state"); + +-- CreateIndex +CREATE UNIQUE INDEX "legal_people_cnpj_key" ON "legal_people"("cnpj"); + +-- CreateIndex +CREATE UNIQUE INDEX "legal_people_state_registration_key" ON "legal_people"("state_registration"); + +-- CreateIndex +CREATE UNIQUE INDEX "legal_clients_legal_person_id_key" ON "legal_clients"("legal_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "legal_client_cte_order_id_key" ON "legal_client_cte"("order_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "legal_Contracts_contract_number_key" ON "legal_Contracts"("contract_number"); + +-- CreateIndex +CREATE UNIQUE INDEX "legal_orders_order_key" ON "legal_orders"("order"); + +-- CreateIndex +CREATE UNIQUE INDEX "ciots_for_legal_clients_ciot_key" ON "ciots_for_legal_clients"("ciot"); + +-- CreateIndex +CREATE UNIQUE INDEX "order_procesing_order_processing_number_key" ON "order_procesing"("order_processing_number"); + +-- CreateIndex +CREATE UNIQUE INDEX "order_procesing_vehicle_id_key" ON "order_procesing"("vehicle_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "completed_orders_vehicle_id_key" ON "completed_orders"("vehicle_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "types_of_maintenances_description_typeMaintenance_key" ON "types_of_maintenances"("description", "typeMaintenance"); + +-- CreateIndex +CREATE UNIQUE INDEX "maintenance_companies_legal_person_id_key" ON "maintenance_companies"("legal_person_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "_VehicleBodyworkToVehicleType_AB_unique" ON "_VehicleBodyworkToVehicleType"("A", "B"); + +-- CreateIndex +CREATE INDEX "_VehicleBodyworkToVehicleType_B_index" ON "_VehicleBodyworkToVehicleType"("B"); + +-- AddForeignKey +ALTER TABLE "vehicles" ADD CONSTRAINT "vehicles_model_id_fkey" FOREIGN KEY ("model_id") REFERENCES "vehicle_models"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_brand_id_fkey" FOREIGN KEY ("brand_id") REFERENCES "vehicle_brands"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_models" ADD CONSTRAINT "vehicle_models_type_id_fkey" FOREIGN KEY ("type_id") REFERENCES "vehicle_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_brands" ADD CONSTRAINT "vehicle_brands_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_brands" ADD CONSTRAINT "vehicle_brands_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_types" ADD CONSTRAINT "vehicle_types_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_types" ADD CONSTRAINT "vehicle_types_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_bodyworks" ADD CONSTRAINT "vehicle_bodyworks_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "vehicle_bodyworks" ADD CONSTRAINT "vehicle_bodyworks_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_vehicles" ADD CONSTRAINT "outsourced_vehicles_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_company_id_fkey" FOREIGN KEY ("company_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "company_vehicles" ADD CONSTRAINT "company_vehicles_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_transport_vehicle" ADD CONSTRAINT "outsourced_transport_vehicle_outsourced_company_id_fkey" FOREIGN KEY ("outsourced_company_id") REFERENCES "OutsourcedTransportCompany"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_transport_vehicle" ADD CONSTRAINT "outsourced_transport_vehicle_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_transport_vehicle" ADD CONSTRAINT "outsourced_transport_vehicle_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_transport_vehicle" ADD CONSTRAINT "outsourced_transport_vehicle_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_outsourced_vehicle_id_fkey" FOREIGN KEY ("outsourced_vehicle_id") REFERENCES "outsourced_vehicles"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourced_drivers" ADD CONSTRAINT "outsourced_drivers_company_vehicle_id_fkey" FOREIGN KEY ("company_vehicle_id") REFERENCES "company_vehicles"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourcedT_transport_company_driver" ADD CONSTRAINT "outsourcedT_transport_company_driver_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourcedT_transport_company_driver" ADD CONSTRAINT "outsourcedT_transport_company_driver_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourcedT_transport_company_driver" ADD CONSTRAINT "outsourcedT_transport_company_driver_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "outsourcedT_transport_company_driver" ADD CONSTRAINT "outsourcedT_transport_company_driver_outsourced_transport__fkey" FOREIGN KEY ("outsourced_transport_company_id") REFERENCES "OutsourcedTransportCompany"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "contract_outsourced_drivers" ADD CONSTRAINT "contract_outsourced_drivers_outsourced_driver_id_fkey" FOREIGN KEY ("outsourced_driver_id") REFERENCES "outsourced_drivers"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "own_drivers" ADD CONSTRAINT "own_drivers_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "own_drivers" ADD CONSTRAINT "own_drivers_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "own_drivers" ADD CONSTRAINT "own_drivers_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customers" ADD CONSTRAINT "physical_customers_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "carrier_companies" ADD CONSTRAINT "carrier_companies_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "carrier_companies" ADD CONSTRAINT "carrier_companies_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "carrier_companies" ADD CONSTRAINT "carrier_companies_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "OutsourcedTransportCompany" ADD CONSTRAINT "OutsourcedTransportCompany_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "OutsourcedTransportCompany" ADD CONSTRAINT "OutsourcedTransportCompany_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "OutsourcedTransportCompany" ADD CONSTRAINT "OutsourcedTransportCompany_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_outsourced_transport_co_fkey" FOREIGN KEY ("outsourced_transport_company_id") REFERENCES "OutsourcedTransportCompany"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_carrier_company_id_fkey" FOREIGN KEY ("carrier_company_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_legal_client_order_id_fkey" FOREIGN KEY ("legal_client_order_id") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "OutsourcedTransportCompanyContract" ADD CONSTRAINT "OutsourcedTransportCompanyContract_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_recipient_id_fkey" FOREIGN KEY ("recipient_id") REFERENCES "recipient"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_senderId_fkey" FOREIGN KEY ("senderId") REFERENCES "sender"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_physical_customer_id_fkey" FOREIGN KEY ("physical_customer_id") REFERENCES "physical_customers"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_carrier_id_fkey" FOREIGN KEY ("carrier_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_procesing"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_completedOrdersId_fkey" FOREIGN KEY ("completedOrdersId") REFERENCES "completed_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_orders" ADD CONSTRAINT "physical_orders_quote_table_id_fkey" FOREIGN KEY ("quote_table_id") REFERENCES "physical_customer_quote"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customer_cte" ADD CONSTRAINT "physical_customer_cte_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "physical_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "sender" ADD CONSTRAINT "sender_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "sender" ADD CONSTRAINT "sender_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "sender" ADD CONSTRAINT "sender_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "sender" ADD CONSTRAINT "sender_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "recipient" ADD CONSTRAINT "recipient_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "recipient" ADD CONSTRAINT "recipient_natural_person_id_fkey" FOREIGN KEY ("natural_person_id") REFERENCES "natural_people"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "recipient" ADD CONSTRAINT "recipient_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "recipient" ADD CONSTRAINT "recipient_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "icms" ADD CONSTRAINT "icms_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "icms" ADD CONSTRAINT "icms_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_clients" ADD CONSTRAINT "legal_clients_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_clients" ADD CONSTRAINT "legal_clients_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_clients" ADD CONSTRAINT "legal_clients_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_client_cte" ADD CONSTRAINT "legal_client_cte_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "legal_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_Contracts" ADD CONSTRAINT "legal_Contracts_legal_client_id_fkey" FOREIGN KEY ("legal_client_id") REFERENCES "legal_clients"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_Contracts" ADD CONSTRAINT "legal_Contracts_carrier_company_id_fkey" FOREIGN KEY ("carrier_company_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_Contracts" ADD CONSTRAINT "legal_Contracts_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_Contracts" ADD CONSTRAINT "legal_Contracts_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_recipient_id_fkey" FOREIGN KEY ("recipient_id") REFERENCES "recipient"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_sender_id_fkey" FOREIGN KEY ("sender_id") REFERENCES "sender"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_legal_contract_id_fkey" FOREIGN KEY ("legal_contract_id") REFERENCES "legal_Contracts"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_quote_table_id_fkey" FOREIGN KEY ("quote_table_id") REFERENCES "legal_client_quote"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_order_processing_id_fkey" FOREIGN KEY ("order_processing_id") REFERENCES "order_procesing"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_carrier_id_fkey" FOREIGN KEY ("carrier_id") REFERENCES "carrier_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_orders" ADD CONSTRAINT "legal_orders_completed_orders_id_fkey" FOREIGN KEY ("completed_orders_id") REFERENCES "completed_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ciots_for_legal_clients" ADD CONSTRAINT "ciots_for_legal_clients_legal_contract_id_fkey" FOREIGN KEY ("legal_contract_id") REFERENCES "legal_Contracts"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ciots_for_legal_clients" ADD CONSTRAINT "ciots_for_legal_clients_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ciots_for_legal_clients" ADD CONSTRAINT "ciots_for_legal_clients_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "order_procesing" ADD CONSTRAINT "order_procesing_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Incident" ADD CONSTRAINT "Incident_order_process_id_fkey" FOREIGN KEY ("order_process_id") REFERENCES "order_procesing"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Incident" ADD CONSTRAINT "Incident_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Incident" ADD CONSTRAINT "Incident_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "completed_orders" ADD CONSTRAINT "completed_orders_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "freight_expenses" ADD CONSTRAINT "legal_client_order_fk" FOREIGN KEY ("legal_client_order_id") REFERENCES "legal_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "freight_expenses" ADD CONSTRAINT "freight_expenses_physical_customer_id_fkey" FOREIGN KEY ("physical_customer_id") REFERENCES "physical_orders"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "types_of_maintenances" ADD CONSTRAINT "types_of_maintenances_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "types_of_maintenances" ADD CONSTRAINT "types_of_maintenances_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_legal_person_id_fkey" FOREIGN KEY ("legal_person_id") REFERENCES "legal_people"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "maintenance_companies" ADD CONSTRAINT "maintenance_companies_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_maintenance_company_id_fkey" FOREIGN KEY ("maintenance_company_id") REFERENCES "maintenance_companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_vehicle_id_fkey" FOREIGN KEY ("vehicle_id") REFERENCES "vehicles"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_type_of_maintenance_id_fkey" FOREIGN KEY ("type_of_maintenance_id") REFERENCES "types_of_maintenances"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "_VehicleBodyworkToVehicleType" ADD CONSTRAINT "_VehicleBodyworkToVehicleType_A_fkey" FOREIGN KEY ("A") REFERENCES "vehicle_bodyworks"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "_VehicleBodyworkToVehicleType" ADD CONSTRAINT "_VehicleBodyworkToVehicleType_B_fkey" FOREIGN KEY ("B") REFERENCES "vehicle_types"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240505191636_add_table_adress_for_using_in_quote_tables/migration.sql b/prisma/migrations/20240505191636_add_table_adress_for_using_in_quote_tables/migration.sql new file mode 100644 index 00000000..69ae366d --- /dev/null +++ b/prisma/migrations/20240505191636_add_table_adress_for_using_in_quote_tables/migration.sql @@ -0,0 +1,56 @@ +/* + Warnings: + + - You are about to drop the column `postal_cod_destiny` on the `legal_client_quote` table. All the data in the column will be lost. + - You are about to drop the column `postal_cod_origin` on the `legal_client_quote` table. All the data in the column will be lost. + - You are about to drop the column `postal_cod_destiny` on the `physical_customer_quote` table. All the data in the column will be lost. + - You are about to drop the column `postal_cod_origin` on the `physical_customer_quote` table. All the data in the column will be lost. + - Added the required column `adress_destiny_id` to the `legal_client_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `adress_origin_id` to the `legal_client_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `adress_destiny_id` to the `physical_customer_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `adress_origin_id` to the `physical_customer_quote` table without a default value. This is not possible if the table is not empty. + +*/ +-- DropIndex +DROP INDEX "physical_customer_quote_postal_cod_destiny_postal_cod_origi_key"; + +-- AlterTable +ALTER TABLE "legal_client_quote" DROP COLUMN "postal_cod_destiny", +DROP COLUMN "postal_cod_origin", +ADD COLUMN "adress_destiny_id" TEXT NOT NULL, +ADD COLUMN "adress_origin_id" TEXT NOT NULL; + +-- AlterTable +ALTER TABLE "physical_customer_quote" DROP COLUMN "postal_cod_destiny", +DROP COLUMN "postal_cod_origin", +ADD COLUMN "adress_destiny_id" TEXT NOT NULL, +ADD COLUMN "adress_origin_id" TEXT NOT NULL; + +-- CreateTable +CREATE TABLE "adresses" ( + "id" TEXT NOT NULL, + "postal_cod" TEXT NOT NULL, + "street" TEXT NOT NULL, + "address_number" TEXT NOT NULL, + "neighborhood" TEXT NOT NULL, + "complement" TEXT, + "city" TEXT NOT NULL, + "uf" TEXT NOT NULL, + + CONSTRAINT "adresses_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "adresses_postal_cod_key" ON "adresses"("postal_cod"); + +-- AddForeignKey +ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_adress_origin_id_fkey" FOREIGN KEY ("adress_origin_id") REFERENCES "adresses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_adress_destiny_id_fkey" FOREIGN KEY ("adress_destiny_id") REFERENCES "adresses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_adress_origin_id_fkey" FOREIGN KEY ("adress_origin_id") REFERENCES "adresses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_adress_destiny_id_fkey" FOREIGN KEY ("adress_destiny_id") REFERENCES "adresses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240509223512_/migration.sql b/prisma/migrations/20240509223512_/migration.sql new file mode 100644 index 00000000..67fc6b93 --- /dev/null +++ b/prisma/migrations/20240509223512_/migration.sql @@ -0,0 +1,32 @@ +/* + Warnings: + + - You are about to drop the column `orderProcessingLegalClientId` on the `company_vehicles` table. All the data in the column will be lost. + - You are about to drop the column `orderProcessingLegalClientId` on the `outsourced_vehicles` table. All the data in the column will be lost. + - Added the required column `form_payment` to the `legal_client_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `kind_service` to the `legal_client_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `nature_service` to the `legal_client_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `type_cte` to the `legal_client_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `form_payment` to the `physical_customer_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `kind_service` to the `physical_customer_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `natute_service` to the `physical_customer_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `type_cte` to the `physical_customer_quote` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "company_vehicles" DROP COLUMN "orderProcessingLegalClientId"; + +-- AlterTable +ALTER TABLE "legal_client_quote" ADD COLUMN "form_payment" TEXT NOT NULL, +ADD COLUMN "kind_service" TEXT NOT NULL, +ADD COLUMN "nature_service" TEXT NOT NULL, +ADD COLUMN "type_cte" TEXT NOT NULL; + +-- AlterTable +ALTER TABLE "outsourced_vehicles" DROP COLUMN "orderProcessingLegalClientId"; + +-- AlterTable +ALTER TABLE "physical_customer_quote" ADD COLUMN "form_payment" TEXT NOT NULL, +ADD COLUMN "kind_service" TEXT NOT NULL, +ADD COLUMN "natute_service" TEXT NOT NULL, +ADD COLUMN "type_cte" TEXT NOT NULL; diff --git a/prisma/migrations/20240513230541_/migration.sql b/prisma/migrations/20240513230541_/migration.sql new file mode 100644 index 00000000..6160131a --- /dev/null +++ b/prisma/migrations/20240513230541_/migration.sql @@ -0,0 +1,41 @@ +/* + Warnings: + + - A unique constraint covering the columns `[postal_cod,address_number]` on the table `adresses` will be added. If there are existing duplicate values, this will fail. + - Added the required column `icms_id` to the `legal_client_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `total_receivable` to the `legal_orders` table without a default value. This is not possible if the table is not empty. + - Added the required column `total_shipping_cost` to the `legal_orders` table without a default value. This is not possible if the table is not empty. + - Added the required column `total_tax_payable` to the `legal_orders` table without a default value. This is not possible if the table is not empty. + - Added the required column `icms_id` to the `physical_customer_quote` table without a default value. This is not possible if the table is not empty. + - Added the required column `total_receivable` to the `physical_orders` table without a default value. This is not possible if the table is not empty. + - Added the required column `total_shipping_cost` to the `physical_orders` table without a default value. This is not possible if the table is not empty. + - Added the required column `total_tax_payable` to the `physical_orders` table without a default value. This is not possible if the table is not empty. + +*/ +-- DropIndex +DROP INDEX "adresses_postal_cod_key"; + +-- AlterTable +ALTER TABLE "legal_client_quote" ADD COLUMN "icms_id" TEXT NOT NULL; + +-- AlterTable +ALTER TABLE "legal_orders" ADD COLUMN "total_receivable" DOUBLE PRECISION NOT NULL, +ADD COLUMN "total_shipping_cost" DOUBLE PRECISION NOT NULL, +ADD COLUMN "total_tax_payable" DOUBLE PRECISION NOT NULL; + +-- AlterTable +ALTER TABLE "physical_customer_quote" ADD COLUMN "icms_id" TEXT NOT NULL; + +-- AlterTable +ALTER TABLE "physical_orders" ADD COLUMN "total_receivable" DOUBLE PRECISION NOT NULL, +ADD COLUMN "total_shipping_cost" DOUBLE PRECISION NOT NULL, +ADD COLUMN "total_tax_payable" DOUBLE PRECISION NOT NULL; + +-- CreateIndex +CREATE UNIQUE INDEX "adresses_postal_cod_address_number_key" ON "adresses"("postal_cod", "address_number"); + +-- AddForeignKey +ALTER TABLE "physical_customer_quote" ADD CONSTRAINT "physical_customer_quote_icms_id_fkey" FOREIGN KEY ("icms_id") REFERENCES "icms"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "legal_client_quote" ADD CONSTRAINT "legal_client_quote_icms_id_fkey" FOREIGN KEY ("icms_id") REFERENCES "icms"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 1a146276..7a75742a 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -201,15 +201,14 @@ model OutsourcedVehicle { created_at DateTime @default(now()) updated_at DateTime @default(now()) - CreatedBy User? @relation("created_by", fields: [created_by], references: [id]) - created_by String - UpdatedBy User? @relation("updated_by", fields: [updated_by], references: [id]) - updated_by String - Vehicle Vehicle @relation(fields: [vehicle_id], references: [id]) - vehicle_id String @unique - order_processing_id String? - OutsourcedDriver OutsourcedDriver? - orderProcessingLegalClientId String? + CreatedBy User? @relation("created_by", fields: [created_by], references: [id]) + created_by String + UpdatedBy User? @relation("updated_by", fields: [updated_by], references: [id]) + updated_by String + Vehicle Vehicle @relation(fields: [vehicle_id], references: [id]) + vehicle_id String @unique + order_processing_id String? + OutsourcedDriver OutsourcedDriver? @@map("outsourced_vehicles") } @@ -227,8 +226,7 @@ model CompanyVehicle { Vehicle Vehicle @relation(fields: [vehicle_id], references: [id]) vehicle_id String @unique - OutsourcedDriver OutsourcedDriver[] - orderProcessingLegalClientId String? + OutsourcedDriver OutsourcedDriver[] @@map("company_vehicles") } @@ -436,15 +434,22 @@ model OutsourcedTransportCompanyContract { } model PhysicalCustomerQuoteTable { - id String @id @default(uuid()) - cod_quote String - recipient_id String + id String @id @default(uuid()) + cod_quote String + kind_service String + type_cte String + natute_service String + form_payment String + recipient_id String + Recipient Recipient @relation(fields: [recipient_id], references: [id]) Sender Sender @relation(fields: [senderId], references: [id]) senderId String who_pays String - postal_cod_origin String - postal_cod_destiny String + adress_origin_id String + AdressOrigin Adresses @relation("adress_origin_quote_physical", fields: [adress_origin_id], references: [id]) + adress_destiny_id String + AdressDestiny Adresses @relation("adress_destiny_quote_physical", fields: [adress_destiny_id], references: [id]) type_merchandise String amount Int description String @@ -458,8 +463,9 @@ model PhysicalCustomerQuoteTable { updated_by String UpdatedBy User @relation("updated_by", fields: [updated_by], references: [id]) PhysicalCustomerOrder PhysicalCustomerOrder[] + icms_id String + Icms Icms @relation(fields: [icms_id], references: [id]) - @@unique([postal_cod_destiny, postal_cod_origin]) @@map("physical_customer_quote") } @@ -468,6 +474,9 @@ model PhysicalCustomerOrder { order String @unique updated_by String physical_customer_id String + total_shipping_cost Float + total_receivable Float + total_tax_payable Float PhysicalCustomer PhysicalCustomer @relation(fields: [physical_customer_id], references: [id]) created_at DateTime @default(now()) updated_at DateTime @default(now()) @@ -494,8 +503,9 @@ model PhysicalCustomerCte { PhysicalCustomerOrder PhysicalCustomerOrder @relation(fields: [order_id], references: [id]) access_key String type_cte String - observations String - cte_number String + + observations String + cte_number String @@map("physical_customer_cte") } @@ -537,17 +547,19 @@ model Recipient { } model Icms { - id String @id @default(uuid()) - state_orgin String - recipient_state String - aliquot Float - effective_date DateTime - created_at DateTime @default(now()) - updated_at DateTime @default(now()) - CreatedBy User @relation("created_by", fields: [created_by], references: [id]) - created_by String - updated_by String - UpdatedBy User @relation("updated_by", fields: [updated_by], references: [id]) + id String @id @default(uuid()) + state_orgin String + recipient_state String + aliquot Float + effective_date DateTime + created_at DateTime @default(now()) + updated_at DateTime @default(now()) + CreatedBy User @relation("created_by", fields: [created_by], references: [id]) + created_by String + updated_by String + UpdatedBy User @relation("updated_by", fields: [updated_by], references: [id]) + PhysicalCustomerQuoteTable PhysicalCustomerQuoteTable[] + LegalClientQuoteTable LegalClientQuoteTable[] @@unique([state_orgin, recipient_state]) @@map("icms") @@ -630,37 +642,68 @@ model LegalContract { } model LegalClientQuoteTable { - id String @id @default(uuid()) - cod_quote String - recipient_id String - Recipient Recipient @relation(fields: [recipient_id], references: [id]) - Sender Sender @relation(fields: [sender_id], references: [id]) - sender_id String - who_pays String - postal_cod_origin String - postal_cod_destiny String - type_merchandise String - amount Int - description String - mass Float - volume Float - nf_value Float - LegalClientOrder LegalClientOrder[] - created_at DateTime @default(now()) - updated_at DateTime @default(now()) - CreatedBy User @relation("created_by", fields: [created_by], references: [id]) - created_by String - UpdatedBy User @relation("updated_by", fields: [updated_by], references: [id]) - updated_by String + id String @id @default(uuid()) + cod_quote String + kind_service String + type_cte String + nature_service String + form_payment String + recipient_id String + Recipient Recipient @relation(fields: [recipient_id], references: [id]) + Sender Sender @relation(fields: [sender_id], references: [id]) + sender_id String + who_pays String + adress_origin_id String + AdressOrigin Adresses @relation("origin_adress_quote_legal", fields: [adress_origin_id], references: [id]) + AdressDestiny Adresses @relation("destiny_adress_quote_legal", fields: [adress_destiny_id], references: [id]) + + adress_destiny_id String + type_merchandise String + amount Int + description String + mass Float + volume Float + nf_value Float + LegalClientOrder LegalClientOrder[] + created_at DateTime @default(now()) + updated_at DateTime @default(now()) + CreatedBy User @relation("created_by", fields: [created_by], references: [id]) + created_by String + UpdatedBy User @relation("updated_by", fields: [updated_by], references: [id]) + updated_by String + + icms_id String + Icms Icms @relation(fields: [icms_id], references: [id]) @@map("legal_client_quote") } +model Adresses { + id String @id @default(uuid()) + postal_cod String + street String + address_number String + neighborhood String + complement String? + city String + uf String + LegalClientQuoteTableOrigin LegalClientQuoteTable[] @relation("origin_adress_quote_legal") + LegalClientQuoteTablesDestiny LegalClientQuoteTable[] @relation("destiny_adress_quote_legal") + PhysicalCustomerQuoteTableOrigin PhysicalCustomerQuoteTable[] @relation("adress_destiny_quote_physical") + PhysicalCustomerQuoteTableDestiny PhysicalCustomerQuoteTable[] @relation("adress_origin_quote_physical") + + @@unique([postal_cod, address_number]) + @@map("adresses") +} + model LegalClientOrder { id String @id @default(uuid()) order String @unique created_at DateTime @default(now()) updated_at DateTime @default(now()) + total_shipping_cost Float + total_receivable Float + total_tax_payable Float CreatedBy User @relation("created_by", fields: [created_by], references: [id]) created_by String UpdatedBy User @relation("updated_by", fields: [updated_by], references: [id]) @@ -707,7 +750,7 @@ model OrderProcessing { total_distance Float total_spend_liters Float total_spending_money Float - status String @default("created") + status String @default("created") start_at DateTime end_at DateTime? updated_at DateTime diff --git a/src/app/dtos/LegalClientOrderDto/CreateLegalClientOrderDto.ts b/src/app/dtos/LegalClientOrderDto/CreateLegalClientOrderDto.ts index 1a1ccc7a..de391931 100644 --- a/src/app/dtos/LegalClientOrderDto/CreateLegalClientOrderDto.ts +++ b/src/app/dtos/LegalClientOrderDto/CreateLegalClientOrderDto.ts @@ -1,15 +1,17 @@ -import { type ILegalClientOrder } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; +import { + type IExpense, + type ILegalClientOrder, +} from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; export abstract class CreateLegalClientOrderDTO implements ILegalClientOrder { carrier_id: string; - quote_table_id: string; - order: string; - + total_shipping_cost?: number; + total_receivable?: number; + total_tax_payable?: number; legal_contract_id: string; - created_by: string; - updated_by: string; + expenses?: IExpense[]; } diff --git a/src/app/dtos/LegalClientOrderDto/UpdateLegalClientOrderDto.ts b/src/app/dtos/LegalClientOrderDto/UpdateLegalClientOrderDto.ts index 69f18f70..a211e508 100644 --- a/src/app/dtos/LegalClientOrderDto/UpdateLegalClientOrderDto.ts +++ b/src/app/dtos/LegalClientOrderDto/UpdateLegalClientOrderDto.ts @@ -1,6 +1,12 @@ +import { type IExpense } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; + export abstract class UpdateLegalClientOrderDTO { legal_contract_id?: string; + total_shipping_cost?: number; + total_receivable?: number; + total_tax_payable?: number; quote_table_id?: string; carrier_id?: string; updated_by?: string; + expenses?: IExpense[]; } diff --git a/src/app/dtos/LegalClientOrderDto/UpdateManyLegalClientOrderDto.ts b/src/app/dtos/LegalClientOrderDto/UpdateManyLegalClientOrderDto.ts index 547ee676..fadfd57b 100644 --- a/src/app/dtos/LegalClientOrderDto/UpdateManyLegalClientOrderDto.ts +++ b/src/app/dtos/LegalClientOrderDto/UpdateManyLegalClientOrderDto.ts @@ -1,6 +1,12 @@ +import { type IExpense } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; + export abstract class UpdateManyLegalClientOrderDTO { id: string; legal_contract_id?: string; + total_shipping_cost?: number; + total_receivable?: number; + total_tax_payable?: number; quote_table_id?: string; carrier_id?: string; + expenses?: IExpense[]; } diff --git a/src/app/dtos/LegalClientQuoteTableDto/CreateLegalClientQuoteTableDto.ts b/src/app/dtos/LegalClientQuoteTableDto/CreateLegalClientQuoteTableDto.ts index 8478faaf..f3e2d887 100644 --- a/src/app/dtos/LegalClientQuoteTableDto/CreateLegalClientQuoteTableDto.ts +++ b/src/app/dtos/LegalClientQuoteTableDto/CreateLegalClientQuoteTableDto.ts @@ -1,3 +1,4 @@ +import { type AdressesType } from 'domain/entities/QuoteTables/AdressesType'; import { type ILegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable'; export abstract class CreateLegalClientQuoteTableDTO @@ -5,11 +6,15 @@ export abstract class CreateLegalClientQuoteTableDTO { id?: string; codQuote: string; + kindService: string; + typeCte: string; + natureService: string; + formPayment: string; recipientId: string; senderId: string; who_pays: string; - postalCodOrigin: string; - postalCodDestiny: string; + adressDestiny: AdressesType; + adressOrigin: AdressesType; typeMerchandise: string; amount: number; description: string; @@ -18,4 +23,5 @@ export abstract class CreateLegalClientQuoteTableDTO nf_value: number; created_by: string; updated_by: string; + icms_id?: string; } diff --git a/src/app/dtos/LegalClientQuoteTableDto/UpdateLegalClientQuoteTableDto.ts b/src/app/dtos/LegalClientQuoteTableDto/UpdateLegalClientQuoteTableDto.ts index 4a794bf4..47274626 100644 --- a/src/app/dtos/LegalClientQuoteTableDto/UpdateLegalClientQuoteTableDto.ts +++ b/src/app/dtos/LegalClientQuoteTableDto/UpdateLegalClientQuoteTableDto.ts @@ -1,14 +1,19 @@ +import { type AdressesType } from 'domain/entities/QuoteTables/AdressesType'; import { type ILegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable'; export abstract class UpdateLegalClientQuoteTableDTO implements Partial { id?: string; + kindService?: string; + typeCte?: string; + natureService?: string; + formPayment?: string; recipientId?: string; senderId?: string; who_pays?: string; - postalCodOrigin?: string; - postalCodDestiny?: string; + adressDestiny?: AdressesType; + adressOrigin?: AdressesType; typeMerchandise?: string; amount?: number; description?: string; @@ -16,4 +21,5 @@ export abstract class UpdateLegalClientQuoteTableDTO volume?: number; nf_value?: number; updated_by: string; + icms_id?: string; } diff --git a/src/app/dtos/LegalClientQuoteTableDto/UpdateManyLegalClientQuoteTableDto.ts b/src/app/dtos/LegalClientQuoteTableDto/UpdateManyLegalClientQuoteTableDto.ts index ed77c0bd..05683f5c 100644 --- a/src/app/dtos/LegalClientQuoteTableDto/UpdateManyLegalClientQuoteTableDto.ts +++ b/src/app/dtos/LegalClientQuoteTableDto/UpdateManyLegalClientQuoteTableDto.ts @@ -1,3 +1,4 @@ +import { type AdressesType } from 'domain/entities/QuoteTables/AdressesType'; import { type ILegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable'; export abstract class UpdateManyLegalClientQuoteTableDTO @@ -5,14 +6,19 @@ export abstract class UpdateManyLegalClientQuoteTableDTO { id: string; recipientId?: string; + kindService?: string; + typeCte?: string; + natureService?: string; + formPayment?: string; senderId?: string; who_pays?: string; - postalCodOrigin?: string; - postalCodDestiny?: string; + adressDestiny?: AdressesType; + adressOrigin?: AdressesType; typeMerchandise?: string; amount?: number; description?: string; mass?: number; volume?: number; nf_value?: number; + icms_id?: string; } diff --git a/src/app/dtos/PhysicalCustomerOrderDto/CreatePhysicalCustomerOrderDto.ts b/src/app/dtos/PhysicalCustomerOrderDto/CreatePhysicalCustomerOrderDto.ts index 230f9f04..f1311bdb 100644 --- a/src/app/dtos/PhysicalCustomerOrderDto/CreatePhysicalCustomerOrderDto.ts +++ b/src/app/dtos/PhysicalCustomerOrderDto/CreatePhysicalCustomerOrderDto.ts @@ -1,3 +1,4 @@ +import { type IExpense } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; import { type IPhysicalCustomerOrder } from 'domain/entities/PhysicalClientEntities/physicalCustomerOrder/PhysicalCustomerOrder'; export abstract class CreatePhysicalCustomerOrderDTO @@ -7,7 +8,10 @@ export abstract class CreatePhysicalCustomerOrderDTO quote_table_id: string; physicalCustomerId: string; carrier_id: string; + total_shipping_cost?: number; + total_receivable?: number; + total_tax_payable?: number; created_by: string; - + expenses?: IExpense[]; updated_by: string; } diff --git a/src/app/dtos/PhysicalCustomerOrderDto/UpdateManyPhysicalCustomerOrderDto.ts b/src/app/dtos/PhysicalCustomerOrderDto/UpdateManyPhysicalCustomerOrderDto.ts index 1c475490..23f939cb 100644 --- a/src/app/dtos/PhysicalCustomerOrderDto/UpdateManyPhysicalCustomerOrderDto.ts +++ b/src/app/dtos/PhysicalCustomerOrderDto/UpdateManyPhysicalCustomerOrderDto.ts @@ -1,6 +1,12 @@ +import { type IExpense } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; + export abstract class UpdateManyPhysicalCustomerOrderDTO { id: string; physicalCustomerId?: string; + total_shipping_cost?: number; + total_receivable?: number; + total_tax_payable?: number; quote_table_id?: string; carrier_id?: string; + expenses?: IExpense[]; } diff --git a/src/app/dtos/PhysicalCustomerOrderDto/UpdatePhysicalCustomerOrderDto.ts b/src/app/dtos/PhysicalCustomerOrderDto/UpdatePhysicalCustomerOrderDto.ts index d442df69..dbb213a7 100644 --- a/src/app/dtos/PhysicalCustomerOrderDto/UpdatePhysicalCustomerOrderDto.ts +++ b/src/app/dtos/PhysicalCustomerOrderDto/UpdatePhysicalCustomerOrderDto.ts @@ -1,6 +1,12 @@ +import { type IExpense } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; + export abstract class UpdatePhysicalCustomerOrderDTO { physicalCustomerId?: string; quote_table_id?: string; + total_shipping_cost?: number; + total_receivable?: number; + total_tax_payable?: number; updated_by?: string; carrier_id?: string; + expenses?: IExpense[]; } diff --git a/src/app/dtos/PhysicalCustomerQuoteTableDto/CreatePhysicalCustomerQuoteTableDto.ts b/src/app/dtos/PhysicalCustomerQuoteTableDto/CreatePhysicalCustomerQuoteTableDto.ts index fdf33442..ca478e4b 100644 --- a/src/app/dtos/PhysicalCustomerQuoteTableDto/CreatePhysicalCustomerQuoteTableDto.ts +++ b/src/app/dtos/PhysicalCustomerQuoteTableDto/CreatePhysicalCustomerQuoteTableDto.ts @@ -1,15 +1,19 @@ +import { type AdressesType } from 'domain/entities/QuoteTables/AdressesType'; import { type IPhysicalCustomerQuoteTable } from 'domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable'; export abstract class CreatePhysicalCustomerQuoteTableDTO implements IPhysicalCustomerQuoteTable { - id?: string; + kindService: string; + typeCte: string; + natureService: string; + formPayment: string; codQuote: string; recipientId: string; senderId: string; who_pays: string; - postalCodOrigin: string; - postalCodDestiny: string; + adressDestiny: AdressesType; + adressOrigin: AdressesType; typeMerchandise: string; amount: number; description: string; @@ -18,4 +22,5 @@ export abstract class CreatePhysicalCustomerQuoteTableDTO nf_value: number; created_by: string; updated_by: string; + icms_id?: string; } diff --git a/src/app/dtos/PhysicalCustomerQuoteTableDto/UpdatePhysicalCustomerQuoteTableDto.ts b/src/app/dtos/PhysicalCustomerQuoteTableDto/UpdatePhysicalCustomerQuoteTableDto.ts index 533683e0..272a59b8 100644 --- a/src/app/dtos/PhysicalCustomerQuoteTableDto/UpdatePhysicalCustomerQuoteTableDto.ts +++ b/src/app/dtos/PhysicalCustomerQuoteTableDto/UpdatePhysicalCustomerQuoteTableDto.ts @@ -1,14 +1,18 @@ +import { type AdressesType } from 'domain/entities/QuoteTables/AdressesType'; import { type IPhysicalCustomerQuoteTable } from 'domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable'; export abstract class UpdatePhysicalCustomerQuoteTableDTO implements Partial { - id?: string; recipientId?: string; + kindService?: string; + typeCte?: string; + natureService?: string; + formPayment?: string; senderId?: string; who_pays?: string; - postalCodOrigin?: string; - postalCodDestiny?: string; + adressDestiny?: AdressesType; + adressOrigin?: AdressesType; typeMerchandise?: string; amount?: number; description?: string; @@ -16,4 +20,5 @@ export abstract class UpdatePhysicalCustomerQuoteTableDTO volume?: number; nf_value?: number; updated_by: string; + icms_id?: string; } diff --git a/src/app/useCases/CtePdf/CtePdfUseCase.ts b/src/app/useCases/CtePdf/CtePdfUseCase.ts index 534eb405..32d46e40 100644 --- a/src/app/useCases/CtePdf/CtePdfUseCase.ts +++ b/src/app/useCases/CtePdf/CtePdfUseCase.ts @@ -2,7 +2,8 @@ import { HttpStatus, Injectable } from '@nestjs/common'; import { GraphQLError } from 'graphql'; -import { type CtePdf } from 'domain/entities/Cte Entities/CtePdfEntity/CtePdf'; +import { type CteLegalClientPdf } from 'domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient'; +import { type CtePhyscialCustomerPdf } from 'domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer'; import { CtePdfRepository } from 'domain/repositories/CtePdfRepository'; import { GenerateCtePdfService } from 'infra/services/generatePdf/GenerateCtePdf'; @@ -13,25 +14,53 @@ export class ctePdfUseCase { private ctePdfRepository: CtePdfRepository, private uploader: GenerateCtePdfService, ) {} - async getCteUrlLegalClient(orderId: string) { + async getCteUrlLegalClient(cteId: string) { const ctePdf = - await this.ctePdfRepository.getDataForGenerateCtePdfLegalClient(orderId); + await this.ctePdfRepository.getDataForGenerateCtePdfLegalClient(cteId); this.validateCtePdfData(ctePdf); return await this.uploader.generatePdf(ctePdf); } - async getCteUrlPhysicalCustomer(orderId: string) { + async getCteUrlPhysicalCustomer(cteId: string) { const ctePdf = await this.ctePdfRepository.getDataForGenerateCtePdfPhysicalCustomer( - orderId, + cteId, ); - this.validateCtePdfData(ctePdf); + this.validateCtePdfDataPhyscialCustomer(ctePdf); return await this.uploader.generatePdf(ctePdf); } - private validateCtePdfData(ctePdf: CtePdf) { + private validateCtePdfData(ctePdf: CteLegalClientPdf) { + if (!ctePdf.cteData) + throw new GraphQLError('CTE NOT FOUND', { + extensions: { code: HttpStatus.NOT_FOUND }, + }); + + if (!ctePdf.expenses) + throw new GraphQLError('EXPENSES NOT FOUND', { + extensions: { code: HttpStatus.NOT_FOUND }, + }); + if (!ctePdf.recipientLegalPerson && !ctePdf.recipientNaturalPerson) + throw new GraphQLError('RECIPIENT NOT FOUND', { + extensions: { code: HttpStatus.NOT_FOUND }, + }); + if (!ctePdf.senderLegalPerson && !ctePdf.senderNaturalPerson) + throw new GraphQLError('SENDER NOT FOUND', { + extensions: { code: HttpStatus.NOT_FOUND }, + }); + + if (!ctePdf.carrierCompany) + throw new GraphQLError('CARRIER COMPANY NOT FOUND', { + extensions: { code: HttpStatus.NOT_FOUND }, + }); + if (!ctePdf.legalClient) + throw new GraphQLError('LEGAL CLIENT NOT FOUND', { + extensions: { code: HttpStatus.NOT_FOUND }, + }); + } + private validateCtePdfDataPhyscialCustomer(ctePdf: CtePhyscialCustomerPdf) { if (!ctePdf.cteData) throw new GraphQLError('CTE NOT FOUND', { extensions: { code: HttpStatus.NOT_FOUND }, @@ -41,11 +70,11 @@ export class ctePdfUseCase { throw new GraphQLError('EXPENSES NOT FOUND', { extensions: { code: HttpStatus.NOT_FOUND }, }); - if (!ctePdf.recipient) + if (!ctePdf.recipientLegalPerson && !ctePdf.recipientNaturalPerson) throw new GraphQLError('RECIPIENT NOT FOUND', { extensions: { code: HttpStatus.NOT_FOUND }, }); - if (!ctePdf.sender) + if (!ctePdf.senderLegalPerson && !ctePdf.senderNaturalPerson) throw new GraphQLError('SENDER NOT FOUND', { extensions: { code: HttpStatus.NOT_FOUND }, }); @@ -54,5 +83,9 @@ export class ctePdfUseCase { throw new GraphQLError('CARRIER COMPANY NOT FOUND', { extensions: { code: HttpStatus.NOT_FOUND }, }); + if (!ctePdf.physicalCustomer) + throw new GraphQLError('PHYSICAL CUSTOMER NOT FOUND', { + extensions: { code: HttpStatus.NOT_FOUND }, + }); } } diff --git a/src/app/useCases/FreightExpenseUseCases/FreightExpenseUseCases.ts b/src/app/useCases/FreightExpenseUseCases/FreightExpenseUseCases.ts index 4c4e22ee..bea23e7a 100644 --- a/src/app/useCases/FreightExpenseUseCases/FreightExpenseUseCases.ts +++ b/src/app/useCases/FreightExpenseUseCases/FreightExpenseUseCases.ts @@ -4,7 +4,7 @@ import { GraphQLError } from 'graphql'; import { type GetFreightExpenseDTO } from 'domain/dto/repositories/getDataDtos/GetFreightExpenseDto'; import { - type CountAllFreightExpenseWhereRequestDTO, + type CountFreightExpenseRequestDTO, type FindAllFreightExpenseWhereRequestDTO, } from 'domain/dto/repositories/whereDtos/FreightExpenseRepository.Dto'; import { FreightExpense } from 'domain/entities/OrdersEntities/FreightExpense/FreightExpense'; @@ -24,7 +24,7 @@ export class FreightExpenseUseCases { private legalClientOrder: LegalClientOrderUseCases, private physicalCustomeOrder: PhysicalCustomerOrderUseCases, ) {} - async countFreightExpense(request: CountAllFreightExpenseWhereRequestDTO) { + async countFreightExpense(request: CountFreightExpenseRequestDTO) { return this.freightExpenseRepository.countFreightExpenseRepositoy(request); } async getFreightExpense(request: GetFreightExpenseDTO) { diff --git a/src/app/useCases/IncidentUseCases/IncidentUseCases.ts b/src/app/useCases/IncidentUseCases/IncidentUseCases.ts index 18e1e035..040f7417 100644 --- a/src/app/useCases/IncidentUseCases/IncidentUseCases.ts +++ b/src/app/useCases/IncidentUseCases/IncidentUseCases.ts @@ -4,8 +4,8 @@ import { GraphQLError } from 'graphql'; import { type GetIncidentDTO } from 'domain/dto/repositories/getDataDtos/GetIncidentDto'; import { - type CountIncidentRequestDTO, - type FindAllIncidentWhereRequestDTO, + type FindAllFreightIncidentWhereRequestDTO, + type CountFreightIncidentWhereRequestDTO, } from 'domain/dto/repositories/whereDtos/FreightIncidentRepository.Dto'; import { Incident } from 'domain/entities/OrdersEntities/IncidentEntity/Incident'; import { IncidentRepository } from 'domain/repositories/IncidentResitory'; @@ -22,7 +22,7 @@ export class IncidentUseCases { private incidentRepository: IncidentRepository, private orderProcessing: OrderProcessingUseCases, ) {} - async countIncident(request: CountIncidentRequestDTO) { + async countIncident(request: CountFreightIncidentWhereRequestDTO) { return this.incidentRepository.countIncident(request); } async getIncident(request: GetIncidentDTO) { @@ -41,7 +41,7 @@ export class IncidentUseCases { }); } - async getAllIncident(request: FindAllIncidentWhereRequestDTO) { + async getAllIncident(request: FindAllFreightIncidentWhereRequestDTO) { return this.incidentRepository.findAllIncident(request); } async createIncident(data: CreateIncidentDTO) { diff --git a/src/app/useCases/LegalClientOrderUseCases/LegalClientOrderUseCases.ts b/src/app/useCases/LegalClientOrderUseCases/LegalClientOrderUseCases.ts index e05de073..c0459899 100644 --- a/src/app/useCases/LegalClientOrderUseCases/LegalClientOrderUseCases.ts +++ b/src/app/useCases/LegalClientOrderUseCases/LegalClientOrderUseCases.ts @@ -40,6 +40,7 @@ export class LegalClientOrderUseCases { const order = await this.legalClientOrderRepository.findLegalClientOrder( request, ); + if (order) return order; throw new GraphQLError('ORDER Not Found', { @@ -74,6 +75,10 @@ export class LegalClientOrderUseCases { created_by: data.created_by, carrier_id: data.carrier_id, quote_table_id: data.quote_table_id, + total_receivable: data.total_receivable, + total_shipping_cost: data.total_shipping_cost, + total_tax_payable: data.total_tax_payable, + expenses: data.expenses, }); return this.legalClientOrderRepository.createLegalClientOrder(order); @@ -93,7 +98,11 @@ export class LegalClientOrderUseCases { updated_by: data.updated_by, created_by: data.updated_by, quote_table_id: data.legal_contract_id, + total_receivable: data.total_receivable, + total_shipping_cost: data.total_shipping_cost, + total_tax_payable: data.total_tax_payable, order: null, + expenses: data.expenses, }); return this.legalClientOrderRepository.updateLegalClientOrder(id, order); @@ -111,8 +120,12 @@ export class LegalClientOrderUseCases { carrier_id: legalclientorder.carrier_id, updated_by: updateBy, quote_table_id: legalclientorder.legal_contract_id, + total_receivable: legalclientorder.total_receivable, + total_shipping_cost: legalclientorder.total_shipping_cost, + total_tax_payable: legalclientorder.total_tax_payable, order: null, id: legalclientorder.id, + expenses: legalclientorder.expenses, }); return updateLegalClientOrder; diff --git a/src/app/useCases/LegalClientQuoteTableUseCase/LegalClientQuoteTable.ts b/src/app/useCases/LegalClientQuoteTableUseCase/LegalClientQuoteTable.ts index 25916ecb..342b6914 100644 --- a/src/app/useCases/LegalClientQuoteTableUseCase/LegalClientQuoteTable.ts +++ b/src/app/useCases/LegalClientQuoteTableUseCase/LegalClientQuoteTable.ts @@ -74,12 +74,16 @@ export class LegalClientQuoteTableUseCases { const quote = new LegalClientQuoteTable({ amount: data.amount, + formPayment: data.formPayment, + kindService: data.kindService, + natureService: data.natureService, + typeCte: data.typeCte, codQuote: data.codQuote, description: data.description, mass: data.mass, nf_value: data.nf_value, - postalCodDestiny: data.postalCodDestiny, - postalCodOrigin: data.postalCodOrigin, + adressDestiny: data.adressDestiny, + adressOrigin: data.adressOrigin, recipientId: data.recipientId, senderId: data.senderId, typeMerchandise: data.typeMerchandise, @@ -112,11 +116,15 @@ export class LegalClientQuoteTableUseCases { const order = new LegalClientQuoteTable({ amount: data.amount, codQuote: null, + formPayment: data.formPayment, + kindService: data.kindService, + natureService: data.natureService, + typeCte: data.typeCte, description: data.description, mass: data.mass, nf_value: data.nf_value, - postalCodDestiny: data.postalCodDestiny, - postalCodOrigin: data.postalCodOrigin, + adressDestiny: data.adressDestiny, + adressOrigin: data.adressOrigin, recipientId: data.recipientId, senderId: data.senderId, typeMerchandise: data.typeMerchandise, @@ -141,11 +149,15 @@ export class LegalClientQuoteTableUseCases { const updateLegalClientQuoteTable = new LegalClientQuoteTable({ amount: legalclientquotetable.amount, codQuote: null, + formPayment: legalclientquotetable.formPayment, + kindService: legalclientquotetable.kindService, + natureService: legalclientquotetable.natureService, + typeCte: legalclientquotetable.typeCte, description: legalclientquotetable.description, mass: legalclientquotetable.mass, nf_value: legalclientquotetable.nf_value, - postalCodDestiny: legalclientquotetable.postalCodDestiny, - postalCodOrigin: legalclientquotetable.postalCodOrigin, + adressDestiny: legalclientquotetable.adressDestiny, + adressOrigin: legalclientquotetable.adressOrigin, recipientId: legalclientquotetable.recipientId, senderId: legalclientquotetable.senderId, typeMerchandise: legalclientquotetable.typeMerchandise, diff --git a/src/app/useCases/PhysicalCustomerOrderCases/PhysicalCustomerOrderUseCases.ts b/src/app/useCases/PhysicalCustomerOrderCases/PhysicalCustomerOrderUseCases.ts index d96643f4..d52c5a59 100644 --- a/src/app/useCases/PhysicalCustomerOrderCases/PhysicalCustomerOrderUseCases.ts +++ b/src/app/useCases/PhysicalCustomerOrderCases/PhysicalCustomerOrderUseCases.ts @@ -83,7 +83,11 @@ export class PhysicalCustomerOrderUseCases { carrier_id: data.carrier_id, updated_by: data.updated_by, created_by: data.created_by, + total_receivable: data.total_receivable, + total_shipping_cost: data.total_shipping_cost, + total_tax_payable: data.total_tax_payable, quote_table_id: data.quote_table_id, + expenses: data.expenses, }); return this.physicalCustomerOrderRepository.createPhysicalCustomerOrder( @@ -109,8 +113,12 @@ export class PhysicalCustomerOrderUseCases { physicalCustomerId: data.physicalCustomerId, updated_by: data.updated_by, carrier_id: data.carrier_id, + total_receivable: data.total_receivable, + total_shipping_cost: data.total_shipping_cost, + total_tax_payable: data.total_tax_payable, order: null, quote_table_id: data.quote_table_id, + expenses: data.expenses, }); return this.physicalCustomerOrderRepository.updatePhysicalCustomerOrder( @@ -147,9 +155,13 @@ export class PhysicalCustomerOrderUseCases { physicalCustomerId: physicalcustomerorder.physicalCustomerId, updated_by: updateBy, carrier_id: physicalcustomerorder.carrier_id, + total_receivable: physicalcustomerorder.total_receivable, + total_shipping_cost: physicalcustomerorder.total_shipping_cost, + total_tax_payable: physicalcustomerorder.total_tax_payable, order: null, quote_table_id: physicalcustomerorder.quote_table_id, id: physicalcustomerorder.id, + expenses: physicalcustomerorder.expenses, }); return physicalcustomerorderUpdated; diff --git a/src/app/useCases/PhysicalCustomerQuoteTableUseCase/PhysicalCustomerQuoteTable.ts b/src/app/useCases/PhysicalCustomerQuoteTableUseCase/PhysicalCustomerQuoteTable.ts index 270b56cf..7f088f39 100644 --- a/src/app/useCases/PhysicalCustomerQuoteTableUseCase/PhysicalCustomerQuoteTable.ts +++ b/src/app/useCases/PhysicalCustomerQuoteTableUseCase/PhysicalCustomerQuoteTable.ts @@ -68,11 +68,15 @@ export class PhysicalCustomerQuoteTableUseCases { const quote = new PhysicalCustomerQuoteTable({ amount: data.amount, codQuote: data.codQuote, + formPayment: data.formPayment, + kindService: data.kindService, + natureService: data.natureService, + typeCte: data.typeCte, description: data.description, mass: data.mass, nf_value: data.nf_value, - postalCodDestiny: data.postalCodDestiny, - postalCodOrigin: data.postalCodOrigin, + adressDestiny: data.adressDestiny, + adressOrigin: data.adressOrigin, recipientId: data.recipientId, senderId: data.senderId, typeMerchandise: data.typeMerchandise, @@ -111,11 +115,15 @@ export class PhysicalCustomerQuoteTableUseCases { const order = new PhysicalCustomerQuoteTable({ amount: data.amount, codQuote: null, + formPayment: data.formPayment, + kindService: data.kindService, + natureService: data.natureService, + typeCte: data.typeCte, description: data.description, mass: data.mass, nf_value: data.nf_value, - postalCodDestiny: data.postalCodDestiny, - postalCodOrigin: data.postalCodOrigin, + adressDestiny: data.adressDestiny, + adressOrigin: data.adressOrigin, recipientId: data.recipientId, senderId: data.senderId, typeMerchandise: data.typeMerchandise, diff --git a/src/app/useCases/PhysicalCustomerUseCases/PhysicalCustomerUseCases.ts b/src/app/useCases/PhysicalCustomerUseCases/PhysicalCustomerUseCases.ts index f9f23bd2..db9394f5 100644 --- a/src/app/useCases/PhysicalCustomerUseCases/PhysicalCustomerUseCases.ts +++ b/src/app/useCases/PhysicalCustomerUseCases/PhysicalCustomerUseCases.ts @@ -78,9 +78,9 @@ export class PhysicalCustomerUseCases { branch: data.branch, created_by: data.created_by, }); - const naturalPerson = NaturalPersonEntityDto.createEntity( - data.NaturalPerson, - ); + const naturalPerson = data.NaturalPerson + ? NaturalPersonEntityDto.createEntity(data.NaturalPerson) + : undefined; return this.physicalCustomerRepository.createPhysicalCustomer( physicalCustomer, diff --git a/src/domain/dto/providers/CepSearchProviderDto.ts b/src/domain/dto/providers/CepSearchProviderDto.ts new file mode 100644 index 00000000..dc8e7829 --- /dev/null +++ b/src/domain/dto/providers/CepSearchProviderDto.ts @@ -0,0 +1,8 @@ +export abstract class CepSearchProviderDTO { + zipCode: string; + street: string; + complement?: string; + neighborhood: string; + city: string; + state: string; +} diff --git a/src/domain/dto/repositories/whereDtos/FreightExpenseRepository.Dto.ts b/src/domain/dto/repositories/whereDtos/FreightExpenseRepository.Dto.ts index b7d1fb45..cc04ae08 100644 --- a/src/domain/dto/repositories/whereDtos/FreightExpenseRepository.Dto.ts +++ b/src/domain/dto/repositories/whereDtos/FreightExpenseRepository.Dto.ts @@ -1,29 +1,21 @@ -import { type DateTimeFilterDTO } from 'domain/shared/dtos/DateTimeFilterDto'; +import { type NumberFilterDTO } from 'domain/shared/dtos/NumberFilterDto'; import { type StringFilterDTO } from 'domain/shared/dtos/StringFilterDto'; import { WhereDTO } from 'domain/shared/dtos/WhereDto'; export abstract class WhereFreightExpenseTypeDTO extends WhereDTO { id?: StringFilterDTO; - description?: string; - date_incident?: Date; - order_process_id?: string; - date_resolved?: DateTimeFilterDTO; - created_by?: StringFilterDTO; - updated_by?: StringFilterDTO; - updated_at?: DateTimeFilterDTO; - created_at?: DateTimeFilterDTO; + expense_name?: StringFilterDTO; + value?: NumberFilterDTO; + order_id?: StringFilterDTO; + physical_customer_id?: StringFilterDTO; + legal_client_order_id?: StringFilterDTO; } export abstract class SortByFreightExpenseTypeDTO { id?: 'asc' | 'desc'; - description?: 'asc' | 'desc'; - date_incident?: 'asc' | 'desc'; - order_process_id?: 'asc' | 'desc'; - date_resolved?: 'asc' | 'desc'; - created_by?: 'asc' | 'desc'; - updated_by?: 'asc' | 'desc'; - updated_at?: 'asc' | 'desc'; - created_at?: 'asc' | 'desc'; + expense_name?: 'asc' | 'desc'; + value?: 'asc' | 'desc'; + order_id?: 'asc' | 'desc'; } export class FindAllFreightExpenseWhereRequestDTO { @@ -32,6 +24,7 @@ export class FindAllFreightExpenseWhereRequestDTO { sort?: SortByFreightExpenseTypeDTO; where?: WhereFreightExpenseTypeDTO; } -export abstract class CountAllFreightExpenseWhereRequestDTO { + +export abstract class CountFreightExpenseRequestDTO { where?: WhereFreightExpenseTypeDTO; } diff --git a/src/domain/dto/repositories/whereDtos/FreightIncidentRepository.Dto.ts b/src/domain/dto/repositories/whereDtos/FreightIncidentRepository.Dto.ts index f6250e3e..db2ec378 100644 --- a/src/domain/dto/repositories/whereDtos/FreightIncidentRepository.Dto.ts +++ b/src/domain/dto/repositories/whereDtos/FreightIncidentRepository.Dto.ts @@ -1,28 +1,37 @@ -import { type NumberFilterDTO } from 'domain/shared/dtos/NumberFilterDto'; +import { type DateTimeFilterDTO } from 'domain/shared/dtos/DateTimeFilterDto'; import { type StringFilterDTO } from 'domain/shared/dtos/StringFilterDto'; import { WhereDTO } from 'domain/shared/dtos/WhereDto'; -export abstract class WhereIncidentTypeDTO extends WhereDTO { +export abstract class WhereFreightIncidentTypeDTO extends WhereDTO { id?: StringFilterDTO; - expense_name?: StringFilterDTO; - value?: NumberFilterDTO; - order_id?: StringFilterDTO; + description?: StringFilterDTO; + date_incident?: DateTimeFilterDTO; + order_process_id?: StringFilterDTO; + date_resolved?: DateTimeFilterDTO; + created_by?: StringFilterDTO; + updated_by?: StringFilterDTO; + updated_at?: DateTimeFilterDTO; + created_at?: DateTimeFilterDTO; } -export abstract class SortByIncidentTypeDTO { +export abstract class SortByFreightIncidentTypeDTO { id?: 'asc' | 'desc'; - expense_name?: 'asc' | 'desc'; - value?: 'asc' | 'desc'; - order_id?: 'asc' | 'desc'; + description?: 'asc' | 'desc'; + date_incident?: 'asc' | 'desc'; + order_process_id?: 'asc' | 'desc'; + date_resolved?: 'asc' | 'desc'; + created_by?: 'asc' | 'desc'; + updated_by?: 'asc' | 'desc'; + updated_at?: 'asc' | 'desc'; + created_at?: 'asc' | 'desc'; } -export class FindAllIncidentWhereRequestDTO { +export class FindAllFreightIncidentWhereRequestDTO { limit: number; offset: number; - sort?: SortByIncidentTypeDTO; - where?: WhereIncidentTypeDTO; + sort?: SortByFreightIncidentTypeDTO; + where?: WhereFreightIncidentTypeDTO; } - -export abstract class CountIncidentRequestDTO { - where?: WhereIncidentTypeDTO; +export abstract class CountFreightIncidentWhereRequestDTO { + where?: WhereFreightIncidentTypeDTO; } diff --git a/src/domain/entities/Cte Entities/CtePdfEntity/CtePdf.spec.ts b/src/domain/entities/Cte Entities/CtePdfEntity/CtePdf.spec.ts deleted file mode 100644 index 1e364eab..00000000 --- a/src/domain/entities/Cte Entities/CtePdfEntity/CtePdf.spec.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { LegalPerson } from 'domain/entities/LegalPerson/LegalPerson'; -import { NaturalPerson } from 'domain/entities/NaturalPerson/NaturalPerson'; - -import { PhysicalCustomerCte } from '../PhysicalCustomerCte/PhysicalCustomerCte'; -import { CtePdf } from './CtePdf'; - -describe('CarrierCompany', () => { - it('should create carrier company', () => { - const cte = new CtePdf({ - cteData: new PhysicalCustomerCte({ - acessKey: '26.5.65.645.465464654.45.645646546', - cteNumber: '123456789', - orderId: '6465465461654', - id: '56546', - observations: '464654', - cteType: '546496', - }), - expenses: [{ expenseName: 'sdasd', value: 45_646 }], - recipient: new NaturalPerson({ - name: 'Jão', - date_birth: new Date(), - gender: 'Masculino', - cpf: '147475874747', - rg: '1234567', - cep: '12345678', - public_place: 'Rua Principal', - address_number: '123', - neighborhood: 'Centro', - complement: 'Apartamento 456', - city: 'São Paulo', - uf: 'SP', - first_phone: '155455', - second_phone: null, - third_phone: '333333333', - email: 'joao@example.com', - nationality: 'Brasileiro', - }), - sender: new LegalPerson({ - fantasy_name: 'Empresa ABC', - cnpj: '12345678000123', - state_registration: '123456789', - corporate_name: 'Empresa ABC LTDA', - public_place: 'Rua Principal', - address_number: '123', - neighborhood: 'Centro', - complement: 'Sala 456', - city: 'São Paulo', - uf: 'SP', - first_phone: '11111111111', - second_phone: '22222222211', - third_phone: null, - email: 'empresa@example.com', - }), - carrierCompany: new LegalPerson({ - fantasy_name: 'Empresa ABC', - cnpj: '12345678000123', - state_registration: '123456789', - corporate_name: 'Empresa ABC LTDA', - public_place: 'Rua Principal', - address_number: '123', - neighborhood: 'Centro', - complement: 'Sala 456', - city: 'São Paulo', - uf: 'SP', - first_phone: '11111111111', - second_phone: '22222222211', - third_phone: null, - email: 'empresa@example.com', - }), - rntrc: '65465465', - }); - - expect(cte).toBeTruthy(); - }); -}); diff --git a/src/domain/entities/Cte Entities/CtePdfEntity/CtePdf.ts b/src/domain/entities/Cte Entities/CtePdfEntity/CtePdf.ts deleted file mode 100644 index 65d15ad3..00000000 --- a/src/domain/entities/Cte Entities/CtePdfEntity/CtePdf.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { type LegalPerson } from 'domain/entities/LegalPerson/LegalPerson'; -import { type NaturalPerson } from 'domain/entities/NaturalPerson/NaturalPerson'; - -import { type LegalClientCte } from '../LegalClientCte/LegalClientCte'; -import { type PhysicalCustomerCte } from '../PhysicalCustomerCte/PhysicalCustomerCte'; - -interface IExpensesCte { - value: number; - expenseName: string; -} - -export interface ICtePdf { - expenses: IExpensesCte[]; - sender: LegalPerson | NaturalPerson; - recipient: LegalPerson | NaturalPerson; - cteData: PhysicalCustomerCte | LegalClientCte; - carrierCompany: LegalPerson; - rntrc: string; -} - -export class CtePdf { - private props: ICtePdf; - - constructor(props: ICtePdf) { - this.props = { - ...props, - }; - } - - public get expenses(): IExpensesCte[] { - return this.props.expenses; - } - public set expenses(expense: IExpensesCte) { - this.props.expenses.push(expense); - } - public get cteData(): PhysicalCustomerCte | LegalClientCte { - return this.props.cteData; - } - public set cteData(cteData: PhysicalCustomerCte | LegalClientCte) { - this.props.cteData = cteData; - } - public get recipient(): NaturalPerson | LegalPerson { - return this.props.recipient; - } - public set recipient(recipient: NaturalPerson | LegalPerson) { - this.props.recipient = recipient; - } - public get sender(): NaturalPerson | LegalPerson { - return this.props.sender; - } - public set sender(sender: NaturalPerson | LegalPerson) { - this.props.sender = sender; - } - - public get carrierCompany(): LegalPerson { - return this.props.carrierCompany; - } - public set carrierCompany(carrierCompany: LegalPerson) { - this.props.carrierCompany = carrierCompany; - } - - public get rntrc(): string { - return this.props.rntrc; - } - public set rntrc(rntrc: string) { - this.props.rntrc = rntrc; - } -} diff --git a/src/domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient.spec.ts b/src/domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient.spec.ts new file mode 100644 index 00000000..b756d00f --- /dev/null +++ b/src/domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient.spec.ts @@ -0,0 +1,163 @@ +import { LegalPerson } from 'domain/entities/LegalPerson/LegalPerson'; +import { NaturalPerson } from 'domain/entities/NaturalPerson/NaturalPerson'; +import { LegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable'; + +import { LegalClientCte } from '../LegalClientCte/LegalClientCte'; +import { CteLegalClientPdf } from './CtePdfLegalClient'; + +describe('CarrierCompany', () => { + it('should create carrier company', () => { + const cte = new CteLegalClientPdf({ + carrierCompany: new LegalPerson({ + fantasy_name: 'Empresa ABC', + cnpj: '12345678000123', + state_registration: '123456789', + corporate_name: 'Empresa ABC LTDA', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Sala 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '11111111111', + second_phone: '22222222211', + third_phone: null, + email: 'empresa@example.com', + }), + legalClient: new LegalPerson({ + fantasy_name: 'Empresa ABC', + cnpj: '12345678000123', + state_registration: '123456789', + corporate_name: 'Empresa ABC LTDA', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Sala 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '11111111111', + second_phone: '22222222211', + third_phone: null, + email: 'empresa@example.com', + }), + cteData: new LegalClientCte({ + acessKey: '26.5.65.645.465464654.45.645646546', + cteNumber: '123456789', + orderId: '6465465461654', + id: '56546', + observations: '464654', + cteType: '546496', + }), + expenses: [{ expenseName: 'sdsds', value: 465_654 }], + orderData: new LegalClientQuoteTable({ + amount: 564, + codQuote: 'aSdasd', + created_by: 'sdsds', + description: 'sdasdas', + mass: 56.55, + nf_value: 454.747, + adressDestiny: { + address_number: '32+65', + city: '54654', + neighborhood: '546546', + postalCod: '1548787', + street: '646546', + uf: 'pf', + complement: '54654654', + }, + adressOrigin: { + address_number: '32+65', + city: '54654', + neighborhood: '546546', + postalCod: '1548787', + street: '646546', + uf: 'pf', + complement: '54654654', + }, + formPayment: 'Pix', + kindService: 'sadasd', + natureService: 'plksk', + typeCte: '5657467', + recipientId: '546.54.+654.6', + senderId: '454654654', + typeMerchandise: '155', + updated_by: '45654654', + volume: 54.45, + who_pays: 'FOB', + }), + rntrc: '46546', + senderLegalPerson: new LegalPerson({ + fantasy_name: 'Empresa ABC', + cnpj: '12345678000123', + state_registration: '123456789', + corporate_name: 'Empresa ABC LTDA', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Sala 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '11111111111', + second_phone: '22222222211', + third_phone: null, + email: 'empresa@example.com', + }), + recipientLegalPerson: new LegalPerson({ + fantasy_name: 'Empresa ABC', + cnpj: '12345678000123', + state_registration: '123456789', + corporate_name: 'Empresa ABC LTDA', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Sala 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '11111111111', + second_phone: '22222222211', + third_phone: null, + email: 'empresa@example.com', + }), + senderNaturalPerson: new NaturalPerson({ + name: 'Jão', + date_birth: new Date(), + gender: 'Masculino', + cpf: '147475874747', + rg: '1234567', + cep: '12345678', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Apartamento 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '155455', + second_phone: null, + third_phone: '333333333', + email: 'joao@example.com', + nationality: 'Brasileiro', + }), + recipientNaturalPerson: new NaturalPerson({ + name: 'Jão', + date_birth: new Date(), + gender: 'Masculino', + cpf: '147475874747', + rg: '1234567', + cep: '12345678', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Apartamento 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '155455', + second_phone: null, + third_phone: '333333333', + email: 'joao@example.com', + nationality: 'Brasileiro', + }), + }); + + expect(cte).toBeTruthy(); + }); +}); diff --git a/src/domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient.ts b/src/domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient.ts new file mode 100644 index 00000000..648f7a80 --- /dev/null +++ b/src/domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient.ts @@ -0,0 +1,100 @@ +import { type LegalPerson } from 'domain/entities/LegalPerson/LegalPerson'; +import { type NaturalPerson } from 'domain/entities/NaturalPerson/NaturalPerson'; +import { type LegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable'; + +import { type LegalClientCte } from '../LegalClientCte/LegalClientCte'; + +export interface IExpensesCte { + value: number; + expenseName: string; +} + +export interface ICteLegalClientPdf { + expenses: IExpensesCte[]; + senderLegalPerson: LegalPerson; + senderNaturalPerson: NaturalPerson; + recipientLegalPerson?: LegalPerson; + recipientNaturalPerson?: NaturalPerson; + cteData: LegalClientCte; + carrierCompany: LegalPerson; + legalClient: LegalPerson; + rntrc: string; + orderData: LegalClientQuoteTable; +} + +export class CteLegalClientPdf { + private props: ICteLegalClientPdf; + + constructor(props: ICteLegalClientPdf) { + this.props = { + ...props, + }; + } + + public get expenses(): IExpensesCte[] { + return this.props.expenses; + } + public set expenses(expense: IExpensesCte) { + this.props.expenses.push(expense); + } + + public get orderData(): LegalClientQuoteTable { + return this.props.orderData; + } + public set orderData(orderData: LegalClientQuoteTable) { + this.props.orderData = orderData; + } + + public get legalClient(): LegalPerson { + return this.props.legalClient; + } + public set legalClient(legalClient: LegalPerson) { + this.props.legalClient = legalClient; + } + public get cteData(): LegalClientCte { + return this.props.cteData; + } + public set cteData(cteData: LegalClientCte) { + this.props.cteData = cteData; + } + + public get recipientLegalPerson(): LegalPerson { + return this.props.recipientLegalPerson; + } + public set recipientLegalPerson(recipient: LegalPerson) { + this.props.recipientLegalPerson = recipient; + } + public get recipientNaturalPerson(): NaturalPerson { + return this.props.recipientNaturalPerson; + } + public set recipientNaturalPerson(recipient: NaturalPerson) { + this.props.recipientNaturalPerson = recipient; + } + public get senderLegalPerson(): LegalPerson { + return this.props.senderLegalPerson; + } + public set senderLegalPerson(sender: LegalPerson) { + this.props.senderLegalPerson = sender; + } + + public get senderNaturalPerson(): NaturalPerson { + return this.props.senderNaturalPerson; + } + public set senderNaturalPerson(sender: NaturalPerson) { + this.props.senderNaturalPerson = sender; + } + + public get carrierCompany(): LegalPerson { + return this.props.carrierCompany; + } + public set carrierCompany(carrierCompany: LegalPerson) { + this.props.carrierCompany = carrierCompany; + } + + public get rntrc(): string { + return this.props.rntrc; + } + public set rntrc(rntrc: string) { + this.props.rntrc = rntrc; + } +} diff --git a/src/domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer.spec.ts b/src/domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer.spec.ts new file mode 100644 index 00000000..87000dff --- /dev/null +++ b/src/domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer.spec.ts @@ -0,0 +1,166 @@ +import { LegalPerson } from 'domain/entities/LegalPerson/LegalPerson'; +import { NaturalPerson } from 'domain/entities/NaturalPerson/NaturalPerson'; +import { PhysicalCustomerQuoteTable } from 'domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable'; + +import { LegalClientCte } from '../LegalClientCte/LegalClientCte'; +import { CtePhyscialCustomerPdf } from './CtePdfPhysicalCustomer'; + +describe('CarrierCompany', () => { + it('should create carrier company', () => { + const cte = new CtePhyscialCustomerPdf({ + carrierCompany: new LegalPerson({ + fantasy_name: 'Empresa ABC', + cnpj: '12345678000123', + state_registration: '123456789', + corporate_name: 'Empresa ABC LTDA', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Sala 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '11111111111', + second_phone: '22222222211', + third_phone: null, + email: 'empresa@example.com', + }), + physicalCustomer: new NaturalPerson({ + name: 'Jão', + date_birth: new Date(), + gender: 'Masculino', + cpf: '147475874747', + rg: '1234567', + cep: '12345678', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Apartamento 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '155455', + second_phone: null, + third_phone: '333333333', + email: 'joao@example.com', + nationality: 'Brasileiro', + }), + cteData: new LegalClientCte({ + acessKey: '26.5.65.645.465464654.45.645646546', + cteNumber: '123456789', + orderId: '6465465461654', + id: '56546', + observations: '464654', + cteType: '546496', + }), + expenses: [{ expenseName: 'sdsds', value: 465_654 }], + orderData: new PhysicalCustomerQuoteTable({ + amount: 564, + codQuote: 'aSdasd', + created_by: 'sdsds', + description: 'sdasdas', + mass: 56.55, + nf_value: 454.747, + adressDestiny: { + address_number: '32+65', + city: '54654', + neighborhood: '546546', + postalCod: '1548787', + street: '646546', + uf: 'pf', + complement: '54654654', + }, + adressOrigin: { + address_number: '32+65', + city: '54654', + neighborhood: '546546', + postalCod: '1548787', + street: '646546', + uf: 'pf', + complement: '54654654', + }, + formPayment: 'Pix', + kindService: 'sadasd', + natureService: 'plksk', + typeCte: '5657467', + recipientId: '546.54.+654.6', + senderId: '454654654', + typeMerchandise: '155', + updated_by: '45654654', + volume: 54.45, + who_pays: 'FOB', + }), + rntrc: '46546', + senderLegalPerson: new LegalPerson({ + fantasy_name: 'Empresa ABC', + cnpj: '12345678000123', + state_registration: '123456789', + corporate_name: 'Empresa ABC LTDA', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Sala 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '11111111111', + second_phone: '22222222211', + third_phone: null, + email: 'empresa@example.com', + }), + recipientLegalPerson: new LegalPerson({ + fantasy_name: 'Empresa ABC', + cnpj: '12345678000123', + state_registration: '123456789', + corporate_name: 'Empresa ABC LTDA', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Sala 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '11111111111', + second_phone: '22222222211', + third_phone: null, + email: 'empresa@example.com', + }), + senderNaturalPerson: new NaturalPerson({ + name: 'Jão', + date_birth: new Date(), + gender: 'Masculino', + cpf: '147475874747', + rg: '1234567', + cep: '12345678', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Apartamento 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '155455', + second_phone: null, + third_phone: '333333333', + email: 'joao@example.com', + nationality: 'Brasileiro', + }), + recipientNaturalPerson: new NaturalPerson({ + name: 'Jão', + date_birth: new Date(), + gender: 'Masculino', + cpf: '147475874747', + rg: '1234567', + cep: '12345678', + public_place: 'Rua Principal', + address_number: '123', + neighborhood: 'Centro', + complement: 'Apartamento 456', + city: 'São Paulo', + uf: 'SP', + first_phone: '155455', + second_phone: null, + third_phone: '333333333', + email: 'joao@example.com', + nationality: 'Brasileiro', + }), + }); + + expect(cte).toBeTruthy(); + }); +}); diff --git a/src/domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer.ts b/src/domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer.ts new file mode 100644 index 00000000..e661bb5d --- /dev/null +++ b/src/domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer.ts @@ -0,0 +1,100 @@ +import { type LegalPerson } from 'domain/entities/LegalPerson/LegalPerson'; +import { type NaturalPerson } from 'domain/entities/NaturalPerson/NaturalPerson'; +import { type PhysicalCustomerQuoteTable } from 'domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable'; + +import { type LegalClientCte } from '../LegalClientCte/LegalClientCte'; + +interface IExpensesCte { + value: number; + expenseName: string; +} + +export interface ICtePhyscialCustomerPdf { + expenses: IExpensesCte[]; + senderLegalPerson: LegalPerson; + senderNaturalPerson: NaturalPerson; + recipientLegalPerson?: LegalPerson; + recipientNaturalPerson?: NaturalPerson; + cteData: LegalClientCte; + carrierCompany: LegalPerson; + physicalCustomer: NaturalPerson; + rntrc: string; + orderData: PhysicalCustomerQuoteTable; +} + +export class CtePhyscialCustomerPdf { + private props: ICtePhyscialCustomerPdf; + + constructor(props: ICtePhyscialCustomerPdf) { + this.props = { + ...props, + }; + } + + public get expenses(): IExpensesCte[] { + return this.props.expenses; + } + public set expenses(expense: IExpensesCte) { + this.props.expenses.push(expense); + } + + public get orderData(): PhysicalCustomerQuoteTable { + return this.props.orderData; + } + public set orderData(orderData: PhysicalCustomerQuoteTable) { + this.props.orderData = orderData; + } + + public get physicalCustomer(): NaturalPerson { + return this.props.physicalCustomer; + } + public set physicalCustomer(physicalCustomer: NaturalPerson) { + this.props.physicalCustomer = physicalCustomer; + } + public get cteData(): LegalClientCte { + return this.props.cteData; + } + public set cteData(cteData: LegalClientCte) { + this.props.cteData = cteData; + } + + public get recipientLegalPerson(): LegalPerson { + return this.props.recipientLegalPerson; + } + public set recipientLegalPerson(recipient: LegalPerson) { + this.props.recipientLegalPerson = recipient; + } + public get recipientNaturalPerson(): NaturalPerson { + return this.props.recipientNaturalPerson; + } + public set recipientNaturalPerson(recipient: NaturalPerson) { + this.props.recipientNaturalPerson = recipient; + } + public get senderLegalPerson(): LegalPerson { + return this.props.senderLegalPerson; + } + public set senderLegalPerson(sender: LegalPerson) { + this.props.senderLegalPerson = sender; + } + + public get senderNaturalPerson(): NaturalPerson { + return this.props.senderNaturalPerson; + } + public set senderNaturalPerson(sender: NaturalPerson) { + this.props.senderNaturalPerson = sender; + } + + public get carrierCompany(): LegalPerson { + return this.props.carrierCompany; + } + public set carrierCompany(carrierCompany: LegalPerson) { + this.props.carrierCompany = carrierCompany; + } + + public get rntrc(): string { + return this.props.rntrc; + } + public set rntrc(rntrc: string) { + this.props.rntrc = rntrc; + } +} diff --git a/src/domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder.ts b/src/domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder.ts index e7430fdd..cb5e5071 100644 --- a/src/domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder.ts +++ b/src/domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder.ts @@ -6,16 +6,31 @@ import { Entity } from '../../../shared/entities/Entity'; import { type IValidationField } from '../../../shared/notification/Notification'; import { NotificationError } from '../../../shared/notification/NotificationError'; +export interface IExpense { + id?: string; + expenseName: string; + value: number; +} export interface ILegalClientOrder { id?: string; order: string; legal_contract_id: string; quote_table_id: string; + total_shipping_cost?: number; + icms_tax?: number; + cofins_tax?: number; + pis_tax?: number; + calculated_pis?: number; + calculate_cofins?: number; + calculate_icms?: number; + total_receivable?: number; + total_tax_payable?: number; carrier_id: string; updated_at?: Date; created_at?: Date; created_by?: string; updated_by: string; + expenses?: IExpense[]; } export class LegalClientOrder extends Entity { @@ -65,6 +80,21 @@ export class LegalClientOrder extends Entity { fieldName: 'Carrier Company', maxLength: 999, }, + { + field: this.props.total_receivable, + fieldName: 'Total Receivable', + maxLength: 999, + }, + { + field: this.props.total_shipping_cost, + fieldName: 'Total Shipping Cost', + maxLength: 999, + }, + { + field: this.props.total_tax_payable, + fieldName: 'Total Tax Payable', + maxLength: 999, + }, ); this.notification.requiredField('LegalClientOrder', fieldsValidation); @@ -79,6 +109,28 @@ export class LegalClientOrder extends Entity { public set legal_contract_id(legal_contract_id: string) { this.props.legal_contract_id = legal_contract_id; } + public get expenses(): IExpense[] { + return this.props.expenses; + } + public set expenses(expenses: IExpense[]) { + this.props.expenses = expenses; + } + public get total_shipping_cost(): number { + return this.props.total_shipping_cost | 0; + } + public set total_shipping_cost(total_shipping_cost: number) { + this.props.total_shipping_cost = total_shipping_cost; + } + public get total_receivable(): number { + return (this.total_shipping_cost + this.total_tax_payable) | 0; + } + + public get total_tax_payable(): number { + return ( + (this.calculate_cofins + this.calculate_icms + this.calculated_pis) | 0 + ); + } + public set order(order: string) { this.props.order = order; } @@ -132,4 +184,54 @@ export class LegalClientOrder extends Entity { public get updated_by(): string { return this.props.updated_by; } + + public set icms_tax(icms_tax: number) { + this.props.icms_tax = icms_tax; + } + + public get icms_tax(): number { + return this.props.icms_tax; + } + + public set pis_tax(pis_tax: number) { + this.props.pis_tax = pis_tax; + } + + public get pis_tax(): number { + return this.props.pis_tax; + } + public set cofins_tax(cofins_tax: number) { + this.props.cofins_tax = cofins_tax; + } + + public get cofins_tax(): number { + return this.props.cofins_tax; + } + + public set calculated_pis(calculated_pis: number) { + this.props.calculated_pis = calculated_pis; + } + + public get calculated_pis(): number { + return this.aroundValues(this.props.calculated_pis); + } + + public set calculate_icms(calculate_icms: number) { + this.props.calculate_icms = calculate_icms; + } + + public get calculate_icms(): number { + return this.aroundValues(this.props.calculate_icms); + } + public set calculate_cofins(calculate_cofins: number) { + this.props.calculate_cofins = calculate_cofins; + } + + public get calculate_cofins(): number { + return this.aroundValues(this.props.calculate_cofins); + } + + private aroundValues(value: number): number { + return Number.parseFloat(value?.toFixed(2)); + } } diff --git a/src/domain/entities/PhysicalClientEntities/physicalCustomerOrder/PhysicalCustomerOrder.ts b/src/domain/entities/PhysicalClientEntities/physicalCustomerOrder/PhysicalCustomerOrder.ts index 4b5031ba..a26e9e8a 100644 --- a/src/domain/entities/PhysicalClientEntities/physicalCustomerOrder/PhysicalCustomerOrder.ts +++ b/src/domain/entities/PhysicalClientEntities/physicalCustomerOrder/PhysicalCustomerOrder.ts @@ -1,5 +1,7 @@ import { randomUUID } from 'node:crypto'; +import { type IExpense } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; + import { type Replace } from 'helpers/Replace'; import { Entity } from '../../../shared/entities/Entity'; @@ -10,12 +12,22 @@ export interface IPhysicalCustomerOrder { id?: string; order: string; physicalCustomerId: string; + total_shipping_cost?: number; + icms_tax?: number; + cofins_tax?: number; + pis_tax?: number; + calculated_pis?: number; + calculate_cofins?: number; + calculate_icms?: number; + total_receivable?: number; + total_tax_payable?: number; quote_table_id: string; carrier_id: string; updated_at?: Date; created_at?: Date; updated_by: string; created_by: string; + expenses?: IExpense[]; } export class PhysicalCustomerOrder extends Entity { @@ -88,6 +100,21 @@ export class PhysicalCustomerOrder extends Entity { fieldName: 'Carrier Company', maxLength: 999, }, + { + field: this.props.total_receivable, + fieldName: 'Total Receivable', + maxLength: 999, + }, + { + field: this.props.total_shipping_cost, + fieldName: 'Total Shipping Cost', + maxLength: 999, + }, + { + field: this.props.total_tax_payable, + fieldName: 'Total Tax Payable', + maxLength: 999, + }, ); this.notification.requiredField('CustomerOrder', fieldsValidation); @@ -104,6 +131,12 @@ export class PhysicalCustomerOrder extends Entity { this.props.quote_table_id = quote_table_id; } + public get expenses(): IExpense[] { + return this.props.expenses; + } + public set expenses(expenses: IExpense[]) { + this.props.expenses = expenses; + } get order(): string { return this.props.order; } @@ -111,6 +144,21 @@ export class PhysicalCustomerOrder extends Entity { set order(order: string) { this.props.order = order; } + public get total_shipping_cost(): number { + return this.props.total_shipping_cost | 0; + } + public set total_shipping_cost(total_shipping_cost: number) { + this.props.total_shipping_cost = total_shipping_cost; + } + public get total_receivable(): number { + return (this.total_shipping_cost + this.total_tax_payable) | 0; + } + + public get total_tax_payable(): number { + return ( + (this.calculate_cofins + this.calculate_icms + this.calculated_pis) | 0 + ); + } get physicalCustomerId(): string { return this.props.physicalCustomerId; } @@ -150,4 +198,54 @@ export class PhysicalCustomerOrder extends Entity { set created_by(created_by: string) { this.props.created_by = created_by; } + + public set icms_tax(icms_tax: number) { + this.props.icms_tax = icms_tax; + } + + public get icms_tax(): number { + return this.props.icms_tax; + } + + public set pis_tax(pis_tax: number) { + this.props.pis_tax = pis_tax; + } + + public get pis_tax(): number { + return this.props.pis_tax; + } + public set cofins_tax(cofins_tax: number) { + this.props.cofins_tax = cofins_tax; + } + + public get cofins_tax(): number { + return this.props.cofins_tax; + } + + public set calculated_pis(calculated_pis: number) { + this.props.calculated_pis = calculated_pis; + } + + public get calculated_pis(): number { + return this.aroundValues(this.props.calculated_pis); + } + + public set calculate_icms(calculate_icms: number) { + this.props.calculate_icms = calculate_icms; + } + + public get calculate_icms(): number { + return this.aroundValues(this.props.calculate_icms); + } + public set calculate_cofins(calculate_cofins: number) { + this.props.calculate_cofins = calculate_cofins; + } + + public get calculate_cofins(): number { + return this.aroundValues(this.props.calculate_cofins); + } + + private aroundValues(value: number): number { + return Number.parseFloat(value?.toFixed(2)); + } } diff --git a/src/domain/entities/QuoteTables/AdressesType.ts b/src/domain/entities/QuoteTables/AdressesType.ts new file mode 100644 index 00000000..5f385956 --- /dev/null +++ b/src/domain/entities/QuoteTables/AdressesType.ts @@ -0,0 +1,10 @@ +export abstract class AdressesType { + id?: string; + postalCod: string; + street: string; + address_number: string; + neighborhood: string; + complement?: string; + city: string; + uf: string; +} diff --git a/src/domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable.spec.ts b/src/domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable.spec.ts index 23b04fb2..83f01f02 100644 --- a/src/domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable.spec.ts +++ b/src/domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable.spec.ts @@ -9,8 +9,28 @@ describe('User', () => { description: 'sdasdas', mass: 56.55, nf_value: 454.747, - postalCodDestiny: '1234567', - postalCodOrigin: '1234567', + adressDestiny: { + address_number: '32+65', + city: '54654', + neighborhood: '546546', + postalCod: '1548787', + street: '646546', + uf: 'pf', + complement: '54654654', + }, + adressOrigin: { + address_number: '32+65', + city: '54654', + neighborhood: '546546', + postalCod: '1548787', + street: '646546', + uf: 'pf', + complement: '54654654', + }, + formPayment: 'Pix', + kindService: 'sadasd', + natureService: 'plksk', + typeCte: '5657467', recipientId: '546.54.+654.6', senderId: '454654654', typeMerchandise: '155', diff --git a/src/domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable.ts b/src/domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable.ts index 6cd21020..77446666 100644 --- a/src/domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable.ts +++ b/src/domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable.ts @@ -5,15 +5,20 @@ import { type Replace } from 'helpers/Replace'; import { Entity } from '../../../shared/entities/Entity'; import { type IValidationField } from '../../../shared/notification/Notification'; import { NotificationError } from '../../../shared/notification/NotificationError'; +import { type AdressesType } from '../AdressesType'; export interface ILegalClientQuoteTable { id?: string; codQuote: string; + kindService: string; + typeCte: string; + natureService: string; + formPayment: string; recipientId: string; senderId: string; who_pays: string; - postalCodOrigin: string; - postalCodDestiny: string; + adressOrigin: AdressesType; + adressDestiny: AdressesType; typeMerchandise: string; amount: number; description: string; @@ -24,6 +29,7 @@ export interface ILegalClientQuoteTable { updated_at?: Date; created_by: string; updated_by: string; + icms_id?: string; } export class LegalClientQuoteTable extends Entity { @@ -77,13 +83,13 @@ export class LegalClientQuoteTable extends Entity { maxLength: 8, }, { - field: this.props.postalCodDestiny, - fieldName: 'Postal Cod Destiny', - maxLength: 9, + field: this.props.adressOrigin.postalCod, + fieldName: 'Adress Destiny', + maxLength: 8000, }, { - field: this.props.postalCodOrigin, - fieldName: 'Postal Cod Origin', + field: this.props.adressOrigin.postalCod, + fieldName: 'Adress Origin', maxLength: 9, }, { @@ -130,6 +136,38 @@ export class LegalClientQuoteTable extends Entity { set codQuote(codQuote: string) { this.props.codQuote = codQuote; } + + get kindService(): string { + return this.props.kindService; + } + + set kindService(value: string) { + this.props.kindService = value; + } + + get typeCte(): string { + return this.props.typeCte; + } + + set typeCte(value: string) { + this.props.typeCte = value; + } + + get natureService(): string { + return this.props.natureService; + } + + set natureService(value: string) { + this.props.natureService = value; + } + + get formPayment(): string { + return this.props.formPayment; + } + + set formPayment(value: string) { + this.props.formPayment = value; + } get recipientId(): string { return this.props.recipientId; } @@ -154,20 +192,20 @@ export class LegalClientQuoteTable extends Entity { this.props.who_pays = who_pays; } - get postalCodOrigin(): string { - return this.props.postalCodOrigin; + get adressOrigin(): AdressesType { + return this.props.adressOrigin; } - set postalCodOrigin(postalCodOrigin: string) { - this.props.postalCodOrigin = postalCodOrigin; + set adressOrigin(adressOrigin: AdressesType) { + this.props.adressOrigin = adressOrigin; } - get postalCodDestiny(): string { - return this.props.postalCodDestiny; + get adressDestiny(): AdressesType { + return this.props.adressDestiny; } - set postalCodDestiny(postalCodDestiny: string) { - this.props.postalCodDestiny = postalCodDestiny; + set adressDestiny(adressDestiny: AdressesType) { + this.props.adressDestiny = adressDestiny; } get typeMerchandise(): string { @@ -249,4 +287,11 @@ export class LegalClientQuoteTable extends Entity { set created_by(created_by: string | undefined) { this.props.created_by = created_by; } + get icms_id(): string { + return this.props.icms_id; + } + + set icms_id(icms_id: string) { + this.props.icms_id = icms_id; + } } diff --git a/src/domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable.spec.ts b/src/domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable.spec.ts index bfe44de9..5e58a450 100644 --- a/src/domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable.spec.ts +++ b/src/domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable.spec.ts @@ -9,8 +9,28 @@ describe('User', () => { description: 'sdasdas', mass: 56.55, nf_value: 454.747, - postalCodDestiny: '1234567', - postalCodOrigin: '1234567', + adressDestiny: { + address_number: '32+65', + city: '54654', + neighborhood: '546546', + postalCod: '1548787', + street: '646546', + uf: 'pf', + complement: '54654654', + }, + adressOrigin: { + address_number: '32+65', + city: '54654', + neighborhood: '546546', + postalCod: '1548787', + street: '646546', + uf: 'pf', + complement: '54654654', + }, + formPayment: 'Pix', + kindService: 'sadasd', + natureService: 'plksk', + typeCte: '5657467', recipientId: '546.54.+654.6', senderId: '454654654', typeMerchandise: '155', diff --git a/src/domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable.ts b/src/domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable.ts index edd186b3..62cee990 100644 --- a/src/domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable.ts +++ b/src/domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable.ts @@ -5,15 +5,20 @@ import { type Replace } from 'helpers/Replace'; import { Entity } from '../../../shared/entities/Entity'; import { type IValidationField } from '../../../shared/notification/Notification'; import { NotificationError } from '../../../shared/notification/NotificationError'; +import { type AdressesType } from '../AdressesType'; export interface IPhysicalCustomerQuoteTable { id?: string; codQuote: string; + kindService: string; + typeCte: string; + natureService: string; + formPayment: string; recipientId: string; senderId: string; who_pays: string; - postalCodOrigin: string; - postalCodDestiny: string; + adressDestiny: AdressesType; + adressOrigin: AdressesType; typeMerchandise: string; amount: number; description: string; @@ -24,6 +29,7 @@ export interface IPhysicalCustomerQuoteTable { updated_at?: Date; created_by: string; updated_by: string; + icms_id?: string; } export class PhysicalCustomerQuoteTable extends Entity { @@ -77,13 +83,13 @@ export class PhysicalCustomerQuoteTable extends Entity { maxLength: 8, }, { - field: this.props.postalCodDestiny, - fieldName: 'Postal Cod Destiny', + field: this.props.adressDestiny.postalCod, + fieldName: 'Adress Destiny', maxLength: 9, }, { - field: this.props.postalCodOrigin, - fieldName: 'Postal Cod Origin', + field: this.props.adressOrigin.postalCod, + fieldName: 'Adress Origin', maxLength: 9, }, { @@ -133,6 +139,37 @@ export class PhysicalCustomerQuoteTable extends Entity { set codQuote(codQuote: string) { this.props.codQuote = codQuote; } + get kindService(): string { + return this.props.kindService; + } + + set kindService(value: string) { + this.props.kindService = value; + } + + get typeCte(): string { + return this.props.typeCte; + } + + set typeCte(value: string) { + this.props.typeCte = value; + } + + get natureService(): string { + return this.props.natureService; + } + + set natureService(value: string) { + this.props.natureService = value; + } + + get formPayment(): string { + return this.props.formPayment; + } + + set formPayment(value: string) { + this.props.formPayment = value; + } get recipientId(): string { return this.props.recipientId; } @@ -157,20 +194,20 @@ export class PhysicalCustomerQuoteTable extends Entity { this.props.who_pays = who_pays; } - get postalCodOrigin(): string { - return this.props.postalCodOrigin; + get adressDestiny(): AdressesType { + return this.props.adressDestiny; } - set postalCodOrigin(postalCodOrigin: string) { - this.props.postalCodOrigin = postalCodOrigin; + set adressDestiny(adressDestiny: AdressesType) { + this.props.adressDestiny = adressDestiny; } - get postalCodDestiny(): string { - return this.props.postalCodDestiny; + get adressOrigin(): AdressesType { + return this.props.adressOrigin; } - set postalCodDestiny(postalCodDestiny: string) { - this.props.postalCodDestiny = postalCodDestiny; + set adressOrigin(adressOrigin: AdressesType) { + this.props.adressOrigin = adressOrigin; } get typeMerchandise(): string { @@ -252,4 +289,12 @@ export class PhysicalCustomerQuoteTable extends Entity { set created_by(created_by: string | undefined) { this.props.created_by = created_by; } + + get icms_id(): string { + return this.props.icms_id; + } + + set icms_id(icms_id: string) { + this.props.icms_id = icms_id; + } } diff --git a/src/domain/providers/CepSearchProvider.ts b/src/domain/providers/CepSearchProvider.ts new file mode 100644 index 00000000..880952b5 --- /dev/null +++ b/src/domain/providers/CepSearchProvider.ts @@ -0,0 +1,5 @@ +import { type CepSearchProviderDTO } from 'domain/dto/providers/CepSearchProviderDto'; + +export abstract class CepSearchProvider { + abstract getZipCodeData(zipCode: string): Promise; +} diff --git a/src/domain/repositories/CtePdfRepository.ts b/src/domain/repositories/CtePdfRepository.ts index 219d77b9..528c2df7 100644 --- a/src/domain/repositories/CtePdfRepository.ts +++ b/src/domain/repositories/CtePdfRepository.ts @@ -1,10 +1,11 @@ -import { type CtePdf } from 'domain/entities/Cte Entities/CtePdfEntity/CtePdf'; +import { type CteLegalClientPdf } from 'domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient'; +import { type CtePhyscialCustomerPdf } from 'domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer'; export abstract class CtePdfRepository { abstract getDataForGenerateCtePdfLegalClient( - orderId: string, - ): Promise; + cteId: string, + ): Promise; abstract getDataForGenerateCtePdfPhysicalCustomer( - orderId: string, - ): Promise; + cteId: string, + ): Promise; } diff --git a/src/domain/repositories/FreightExpenseResitory.ts b/src/domain/repositories/FreightExpenseResitory.ts index a98a0b71..b9f14e76 100644 --- a/src/domain/repositories/FreightExpenseResitory.ts +++ b/src/domain/repositories/FreightExpenseResitory.ts @@ -1,13 +1,13 @@ import { type GetFreightExpenseDTO } from 'domain/dto/repositories/getDataDtos/GetFreightExpenseDto'; import { - type CountAllFreightExpenseWhereRequestDTO, + type CountFreightExpenseRequestDTO, type FindAllFreightExpenseWhereRequestDTO, } from 'domain/dto/repositories/whereDtos/FreightExpenseRepository.Dto'; import { type FreightExpense } from 'domain/entities/OrdersEntities/FreightExpense/FreightExpense'; export abstract class FreightExpenseRepository { abstract countFreightExpenseRepositoy( - parameters: CountAllFreightExpenseWhereRequestDTO, + parameters: CountFreightExpenseRequestDTO, ): Promise; abstract getFreightExpense( request: GetFreightExpenseDTO, diff --git a/src/domain/repositories/IncidentResitory.ts b/src/domain/repositories/IncidentResitory.ts index 7ee95228..541f4326 100644 --- a/src/domain/repositories/IncidentResitory.ts +++ b/src/domain/repositories/IncidentResitory.ts @@ -1,15 +1,17 @@ import { type GetIncidentDTO } from 'domain/dto/repositories/getDataDtos/GetIncidentDto'; import { - type CountIncidentRequestDTO, - type FindAllIncidentWhereRequestDTO, + type FindAllFreightIncidentWhereRequestDTO, + type CountFreightIncidentWhereRequestDTO, } from 'domain/dto/repositories/whereDtos/FreightIncidentRepository.Dto'; import { type Incident } from 'domain/entities/OrdersEntities/IncidentEntity/Incident'; export abstract class IncidentRepository { - abstract countIncident(request: CountIncidentRequestDTO): Promise; + abstract countIncident( + request: CountFreightIncidentWhereRequestDTO, + ): Promise; abstract getIncident(request: GetIncidentDTO): Promise; abstract findAllIncident( - parameters: FindAllIncidentWhereRequestDTO, + parameters: FindAllFreightIncidentWhereRequestDTO, ): Promise; abstract createIncident(expense: Incident): Promise; abstract updateIncident(id: string, expense: Incident): Promise; diff --git a/src/domain/shared/taxes/taxes.ts b/src/domain/shared/taxes/taxes.ts new file mode 100644 index 00000000..e701546a --- /dev/null +++ b/src/domain/shared/taxes/taxes.ts @@ -0,0 +1,2 @@ +export const pisValue = 1.65; +export const cofinsValue = 0.76; diff --git a/src/infra/database/prisma/services/CtePdf.service.ts b/src/infra/database/prisma/services/CtePdf.service.ts index 9edf512e..af98f7c4 100644 --- a/src/infra/database/prisma/services/CtePdf.service.ts +++ b/src/infra/database/prisma/services/CtePdf.service.ts @@ -1,140 +1,215 @@ import { Injectable } from '@nestjs/common'; -import { CtePdf } from 'domain/entities/Cte Entities/CtePdfEntity/CtePdf'; +import { CteLegalClientPdf } from 'domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient'; +import { CtePhyscialCustomerPdf } from 'domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer'; import { LegalClientCte } from 'domain/entities/Cte Entities/LegalClientCte/LegalClientCte'; -import { PhysicalCustomerCte } from 'domain/entities/Cte Entities/PhysicalCustomerCte/PhysicalCustomerCte'; import { LegalPerson } from 'domain/entities/LegalPerson/LegalPerson'; -import { NaturalPerson } from 'domain/entities/NaturalPerson/NaturalPerson'; import { type CtePdfRepository } from 'domain/repositories/CtePdfRepository'; import { PrismaService } from '../prisma.service'; +import { LegalClientQuoteTablePrismaDTO } from './prismaDTO/LegalClientQuoteTablePrismaDto'; +import { LegalPersonPrismaDTO } from './prismaDTO/LegalPersonPrismaDto'; +import { NaturalPersonPrismaDTO } from './prismaDTO/NaturalPersonPrismaDto'; +import { PhysicalCustomerQuoteTablePrismaDTO } from './prismaDTO/PhysicalCustomerQuoteTablePrismaDto'; @Injectable() export class CtePdfPrismaService implements CtePdfRepository { constructor(private prisma: PrismaService) {} - async getDataForGenerateCtePdfLegalClient(orderId: string): Promise { - const cteDataPrisma = await this.prisma.legalClientOrder.findFirst({ - where: { id: orderId }, + async getDataForGenerateCtePdfLegalClient( + cteId: string, + ): Promise { + console.log(cteId); + const cteDataPrisma = await this.prisma.legalClientCte.findFirst({ + where: { id: cteId }, select: { - FreightExpenses: { select: { value: true, expense_name: true } }, - QuoteTable: { - include: { - Recipient: { - select: { NaturalPerson: true, LegalPerson: true }, + LegalClientOrder: { + select: { + total_receivable: true, + total_shipping_cost: true, + total_tax_payable: true, + FreightExpenses: { select: { value: true, expense_name: true } }, + LegalContract: { + select: { LegalClient: { select: { LegalPerson: true } } }, }, - Sender: { - select: { NaturalPerson: true, LegalPerson: true }, + QuoteTable: { + include: { + AdressDestiny: true, + AdressOrigin: true, + Recipient: { + select: { NaturalPerson: true, LegalPerson: true }, + }, + Sender: { + select: { NaturalPerson: true, LegalPerson: true }, + }, + }, }, + CarrierCompany: { select: { LegalPerson: true, rntrc: true } }, }, }, - LegalClientCte: true, - CarrierCompany: { select: { LegalPerson: true, rntrc: true } }, + access_key: true, + cte_number: true, + id: true, + observations: true, + type_cte: true, + order_id: true, }, }); + const recipientLegalPerson = + cteDataPrisma?.LegalClientOrder.QuoteTable?.Recipient.LegalPerson; + const recipientNaturalPerson = + cteDataPrisma?.LegalClientOrder.QuoteTable?.Recipient.NaturalPerson; - const recipientLegalClient = - cteDataPrisma?.QuoteTable?.Recipient.LegalPerson; - const recipientPhysicalCustomer = - cteDataPrisma?.QuoteTable?.Recipient.NaturalPerson; - const recipient = recipientLegalClient - ? new LegalPerson({ ...recipientLegalClient }) - : new NaturalPerson({ ...recipientPhysicalCustomer }); + const originAdress = cteDataPrisma.LegalClientOrder.QuoteTable.AdressOrigin; + + const destinyAdress = + cteDataPrisma.LegalClientOrder.QuoteTable.AdressDestiny; + + const senderLegalPerson = + cteDataPrisma?.LegalClientOrder.QuoteTable?.Sender.LegalPerson; + const senderNaturalPerson = + cteDataPrisma?.LegalClientOrder.QuoteTable?.Sender.NaturalPerson; - const senderLegalClient = cteDataPrisma?.QuoteTable?.Sender.LegalPerson; - const senderPhysicalCustomer = - cteDataPrisma?.QuoteTable?.Sender.NaturalPerson; - const sender = recipientLegalClient - ? new LegalPerson({ ...senderLegalClient }) - : new NaturalPerson({ ...senderPhysicalCustomer }); const carrierCompany = new LegalPerson({ - ...cteDataPrisma.CarrierCompany.LegalPerson, + ...cteDataPrisma.LegalClientOrder.CarrierCompany.LegalPerson, }); - const expenses = cteDataPrisma?.FreightExpenses.map(expense => ({ - expenseName: expense.expense_name, - value: expense.value, - })); + + const legalClientPrisma = + cteDataPrisma.LegalClientOrder.LegalContract.LegalClient.LegalPerson; + const expenses = cteDataPrisma?.LegalClientOrder.FreightExpenses.map( + expense => ({ + expenseName: expense.expense_name, + value: expense.value, + }), + ); + const order = LegalClientQuoteTablePrismaDTO.PrismaToEntity( + cteDataPrisma.LegalClientOrder.QuoteTable, + originAdress, + destinyAdress, + ); const cteData = new LegalClientCte({ - acessKey: cteDataPrisma?.LegalClientCte?.access_key, - cteNumber: cteDataPrisma?.LegalClientCte?.cte_number, - cteType: cteDataPrisma?.LegalClientCte?.type_cte, - orderId: cteDataPrisma?.LegalClientCte?.order_id, - observations: cteDataPrisma?.LegalClientCte?.observations, - id: cteDataPrisma?.LegalClientCte?.id, + acessKey: cteDataPrisma?.access_key, + cteNumber: cteDataPrisma?.cte_number, + cteType: cteDataPrisma?.type_cte, + orderId: cteDataPrisma?.order_id, + observations: cteDataPrisma?.observations, + id: cteDataPrisma?.id, }); - const ctePdf = new CtePdf({ + const ctePdf = new CteLegalClientPdf({ expenses, cteData, - recipient, - sender, + recipientLegalPerson: + LegalPersonPrismaDTO.PrismaToEntity(recipientLegalPerson), + recipientNaturalPerson: NaturalPersonPrismaDTO.PrismaToEntity( + recipientNaturalPerson, + ), + senderLegalPerson: LegalPersonPrismaDTO.PrismaToEntity(senderLegalPerson), + senderNaturalPerson: + NaturalPersonPrismaDTO.PrismaToEntity(senderNaturalPerson), + legalClient: LegalPersonPrismaDTO.PrismaToEntity(legalClientPrisma), carrierCompany, - rntrc: cteDataPrisma.CarrierCompany.rntrc, + rntrc: cteDataPrisma.LegalClientOrder.CarrierCompany.rntrc, + orderData: order, }); return ctePdf; } async getDataForGenerateCtePdfPhysicalCustomer( - orderId: string, - ): Promise { - const cteDataPrisma = await this.prisma.physicalCustomerOrder.findFirst({ - where: { id: orderId }, + cteId: string, + ): Promise { + const cteDataPrisma = await this.prisma.physicalCustomerCte.findFirst({ + where: { id: cteId }, select: { - FreightExpenses: { select: { value: true, expense_name: true } }, - PhysicalCustomerQuoteTable: { - include: { - Recipient: { - select: { NaturalPerson: true, LegalPerson: true }, - }, - Sender: { - select: { NaturalPerson: true, LegalPerson: true }, + PhysicalCustomerOrder: { + select: { + FreightExpenses: { select: { value: true, expense_name: true } }, + PhysicalCustomer: { select: { NaturalPerson: true } }, + PhysicalCustomerQuoteTable: { + include: { + AdressDestiny: true, + AdressOrigin: true, + Recipient: { + select: { NaturalPerson: true, LegalPerson: true }, + }, + Sender: { + select: { NaturalPerson: true, LegalPerson: true }, + }, + }, }, + CarrierCompany: { select: { LegalPerson: true, rntrc: true } }, }, }, - PhysicalCustomerCte: true, - CarrierCompany: { select: { rntrc: true, LegalPerson: true } }, + access_key: true, + cte_number: true, + id: true, + observations: true, + type_cte: true, + order_id: true, }, }); - console.log(cteDataPrisma); - const recipientLegalClient = - cteDataPrisma?.PhysicalCustomerQuoteTable?.Recipient.LegalPerson; - const recipientPhysicalCustomer = - cteDataPrisma?.PhysicalCustomerQuoteTable?.Recipient.NaturalPerson; - const recipient = recipientLegalClient - ? new LegalPerson({ ...recipientLegalClient }) - : new NaturalPerson({ ...recipientPhysicalCustomer }); + const recipientLegalPerson = + cteDataPrisma?.PhysicalCustomerOrder.PhysicalCustomerQuoteTable?.Recipient + .LegalPerson; + const recipientNaturalPerson = + cteDataPrisma?.PhysicalCustomerOrder.PhysicalCustomerQuoteTable?.Recipient + .NaturalPerson; - const senderLegalClient = - cteDataPrisma?.PhysicalCustomerQuoteTable?.Sender.LegalPerson; - const senderPhysicalCustomer = - cteDataPrisma?.PhysicalCustomerQuoteTable?.Sender.NaturalPerson; - const sender = recipientLegalClient - ? new LegalPerson({ ...senderLegalClient }) - : new NaturalPerson({ ...senderPhysicalCustomer }); + const senderLegalPerson = + cteDataPrisma?.PhysicalCustomerOrder.PhysicalCustomerQuoteTable?.Sender + .LegalPerson; + const senderNaturalPerson = + cteDataPrisma?.PhysicalCustomerOrder.PhysicalCustomerQuoteTable?.Sender + .NaturalPerson; - const expenses = cteDataPrisma?.FreightExpenses.map(expense => ({ - expenseName: expense.expense_name, - value: expense.value, - })); const carrierCompany = new LegalPerson({ - ...cteDataPrisma.CarrierCompany.LegalPerson, - }); - const cteData = new PhysicalCustomerCte({ - acessKey: cteDataPrisma?.PhysicalCustomerCte?.access_key, - cteNumber: cteDataPrisma?.PhysicalCustomerCte?.cte_number, - cteType: cteDataPrisma?.PhysicalCustomerCte?.type_cte, - orderId: cteDataPrisma?.PhysicalCustomerCte?.order_id, - observations: cteDataPrisma?.PhysicalCustomerCte?.observations, - id: cteDataPrisma?.PhysicalCustomerCte?.id, + ...cteDataPrisma?.PhysicalCustomerOrder?.CarrierCompany.LegalPerson, }); - const data = new CtePdf({ + const legalClientPrisma = + cteDataPrisma?.PhysicalCustomerOrder?.PhysicalCustomer.NaturalPerson; + const expenses = cteDataPrisma?.PhysicalCustomerOrder.FreightExpenses.map( + expense => ({ + expenseName: expense.expense_name, + value: expense.value, + }), + ); + const originAdress = + cteDataPrisma.PhysicalCustomerOrder.PhysicalCustomerQuoteTable + .AdressOrigin; + + const destinyAdress = + cteDataPrisma.PhysicalCustomerOrder.PhysicalCustomerQuoteTable + .AdressDestiny; + const cteData = new LegalClientCte({ + acessKey: cteDataPrisma?.access_key, + cteNumber: cteDataPrisma?.cte_number, + cteType: cteDataPrisma?.type_cte, + orderId: cteDataPrisma?.order_id, + observations: cteDataPrisma?.observations, + id: cteDataPrisma?.id, + }); + const order = PhysicalCustomerQuoteTablePrismaDTO.PrismaToEntity( + cteDataPrisma.PhysicalCustomerOrder.PhysicalCustomerQuoteTable, + originAdress, + destinyAdress, + ); + const ctePdf = new CtePhyscialCustomerPdf({ expenses, cteData, - recipient, - sender, + recipientLegalPerson: + LegalPersonPrismaDTO.PrismaToEntity(recipientLegalPerson), + recipientNaturalPerson: NaturalPersonPrismaDTO.PrismaToEntity( + recipientNaturalPerson, + ), + senderLegalPerson: LegalPersonPrismaDTO.PrismaToEntity(senderLegalPerson), + senderNaturalPerson: + NaturalPersonPrismaDTO.PrismaToEntity(senderNaturalPerson), + physicalCustomer: + NaturalPersonPrismaDTO.PrismaToEntity(legalClientPrisma), carrierCompany, - rntrc: cteDataPrisma.CarrierCompany.rntrc, + rntrc: cteDataPrisma?.PhysicalCustomerOrder?.CarrierCompany.rntrc, + orderData: order, }); - return data; + return ctePdf; } } diff --git a/src/infra/database/prisma/services/FreightExpense.service.ts b/src/infra/database/prisma/services/FreightExpense.service.ts index 249cdb23..9ef932d1 100644 --- a/src/infra/database/prisma/services/FreightExpense.service.ts +++ b/src/infra/database/prisma/services/FreightExpense.service.ts @@ -2,8 +2,8 @@ import { Injectable } from '@nestjs/common'; import { type GetFreightExpenseDTO } from 'domain/dto/repositories/getDataDtos/GetFreightExpenseDto'; import { - type CountAllFreightExpenseWhereRequestDTO, type FindAllFreightExpenseWhereRequestDTO, + type CountFreightExpenseRequestDTO, } from 'domain/dto/repositories/whereDtos/FreightExpenseRepository.Dto'; import { type FreightExpense } from 'domain/entities/OrdersEntities/FreightExpense/FreightExpense'; import { type FreightExpenseRepository } from 'domain/repositories/FreightExpenseResitory'; @@ -15,7 +15,7 @@ import { FreightExpensePrismaDTO } from './prismaDTO/FreightExpensePrismaDto'; export class FreightExpensePrismaService implements FreightExpenseRepository { constructor(private prisma: PrismaService) {} countFreightExpenseRepositoy( - parameters: CountAllFreightExpenseWhereRequestDTO, + parameters: CountFreightExpenseRequestDTO, ): Promise { return this.prisma.freightExpenses.count({ where: parameters.where ?? undefined, diff --git a/src/infra/database/prisma/services/Incident.service.ts b/src/infra/database/prisma/services/Incident.service.ts index 940c35f1..47ace407 100644 --- a/src/infra/database/prisma/services/Incident.service.ts +++ b/src/infra/database/prisma/services/Incident.service.ts @@ -2,8 +2,8 @@ import { Injectable } from '@nestjs/common'; import { type GetIncidentDTO } from 'domain/dto/repositories/getDataDtos/GetIncidentDto'; import { - type CountIncidentRequestDTO, - type FindAllIncidentWhereRequestDTO, + type FindAllFreightIncidentWhereRequestDTO, + type CountFreightIncidentWhereRequestDTO, } from 'domain/dto/repositories/whereDtos/FreightIncidentRepository.Dto'; import { type Incident } from 'domain/entities/OrdersEntities/IncidentEntity/Incident'; import { type IncidentRepository } from 'domain/repositories/IncidentResitory'; @@ -14,7 +14,7 @@ import { IncidentPrismaDTO } from './prismaDTO/IncidentPrismaDto'; @Injectable() export class IncidentPrismaService implements IncidentRepository { constructor(private prisma: PrismaService) {} - countIncident(request: CountIncidentRequestDTO): Promise { + countIncident(request: CountFreightIncidentWhereRequestDTO): Promise { return this.prisma.incident.count({ where: request.where ?? undefined, }); @@ -29,7 +29,7 @@ export class IncidentPrismaService implements IncidentRepository { ); } async findAllIncident( - parameters: FindAllIncidentWhereRequestDTO, + parameters: FindAllFreightIncidentWhereRequestDTO, ): Promise { const incidents = await this.prisma.incident.findMany({ take: parameters.limit, diff --git a/src/infra/database/prisma/services/LegalClientOrder.service.ts b/src/infra/database/prisma/services/LegalClientOrder.service.ts index a266fc28..0ad16b12 100644 --- a/src/infra/database/prisma/services/LegalClientOrder.service.ts +++ b/src/infra/database/prisma/services/LegalClientOrder.service.ts @@ -42,27 +42,53 @@ export class LegalClientOrderPrismaService ): Promise { const orders = await this.prisma.legalClientOrder.findMany({ where: { LegalContract: { legal_client_id: legalClientId } }, + include: { + FreightExpenses: true, + QuoteTable: { select: { Icms: { select: { aliquot: true } } } }, + }, }); - return orders.map(order => LegalClientOrderPrismaDTO.PrismaToEntity(order)); + return orders.map(legalClientOrder => + LegalClientOrderPrismaDTO.PrismaToEntity( + legalClientOrder, + legalClientOrder.FreightExpenses, + legalClientOrder.QuoteTable.Icms.aliquot, + ), + ); } async findLegalClientOrder( request: GetLegalClientOrderDTO, ): Promise { const legalClientOrder = await this.prisma.legalClientOrder.findFirst({ where: { OR: [{ id: request.id }, { order: request.order }] }, + include: { + FreightExpenses: true, + QuoteTable: { select: { Icms: { select: { aliquot: true } } } }, + }, }); - return LegalClientOrderPrismaDTO.PrismaToEntity(legalClientOrder); + return LegalClientOrderPrismaDTO.PrismaToEntity( + legalClientOrder, + legalClientOrder.FreightExpenses, + legalClientOrder.QuoteTable.Icms.aliquot, + ); } async createLegalClientOrder( legalClientOrder: LegalClientOrder, ): Promise { const legalClientOrderPrisma = await this.prisma.legalClientOrder.create({ data: LegalClientOrderPrismaDTO.EntityToCreatePrisma(legalClientOrder), + include: { + FreightExpenses: true, + QuoteTable: { select: { Icms: { select: { aliquot: true } } } }, + }, }); - return LegalClientOrderPrismaDTO.PrismaToEntity(legalClientOrderPrisma); + return LegalClientOrderPrismaDTO.PrismaToEntity( + legalClientOrderPrisma, + legalClientOrderPrisma.FreightExpenses, + legalClientOrderPrisma.QuoteTable.Icms.aliquot, + ); } async updateLegalClientOrder( id: string, @@ -71,9 +97,17 @@ export class LegalClientOrderPrismaService const legalClientOrderPrisma = await this.prisma.legalClientOrder.update({ data: LegalClientOrderPrismaDTO.EntityToPrismaUpdate(legalClientOrder), where: { id }, + include: { + FreightExpenses: true, + QuoteTable: { select: { Icms: { select: { aliquot: true } } } }, + }, }); - return LegalClientOrderPrismaDTO.PrismaToEntity(legalClientOrderPrisma); + return LegalClientOrderPrismaDTO.PrismaToEntity( + legalClientOrderPrisma, + legalClientOrderPrisma.FreightExpenses, + legalClientOrderPrisma.QuoteTable.Icms.aliquot, + ); } async getAllLegalClientOrder( @@ -84,10 +118,18 @@ export class LegalClientOrderPrismaService skip: parameters.offset, where: parameters.where, orderBy: parameters.sort, + include: { + FreightExpenses: true, + QuoteTable: { select: { Icms: { select: { aliquot: true } } } }, + }, }); return legalClientOrders.map(legalClientOrder => - LegalClientOrderPrismaDTO.PrismaToEntity(legalClientOrder), + LegalClientOrderPrismaDTO.PrismaToEntity( + legalClientOrder, + legalClientOrder.FreightExpenses, + legalClientOrder.QuoteTable.Icms.aliquot, + ), ); } updateManyLegalClientOrder( @@ -96,14 +138,22 @@ export class LegalClientOrderPrismaService console.log(data); const legalclientorderUpdate = this.prisma.$transaction(async tx => { const promises = data.map(async legalclientorder => { - const legalclientorderPrisma = await tx.legalClientOrder.update({ + const legalClientOrderPrisma = await tx.legalClientOrder.update({ data: LegalClientOrderPrismaDTO.EntityToPrismaUpdate( legalclientorder, ), where: { id: legalclientorder.id }, + include: { + FreightExpenses: true, + QuoteTable: { select: { Icms: { select: { aliquot: true } } } }, + }, }); - return LegalClientOrderPrismaDTO.PrismaToEntity(legalclientorderPrisma); + return LegalClientOrderPrismaDTO.PrismaToEntity( + legalClientOrderPrisma, + legalClientOrderPrisma.FreightExpenses, + legalClientOrderPrisma.QuoteTable.Icms.aliquot, + ); }); return Promise.all(promises); @@ -113,18 +163,36 @@ export class LegalClientOrderPrismaService } async deleteLegalClientOrder(id: string): Promise { + const legalClientOrderPrisma = await this.prisma.legalClientOrder.delete({ + where: { id }, + include: { + FreightExpenses: true, + QuoteTable: { select: { Icms: { select: { aliquot: true } } } }, + }, + }); + return LegalClientOrderPrismaDTO.PrismaToEntity( - await this.prisma.legalClientOrder.delete({ where: { id } }), + legalClientOrderPrisma, + legalClientOrderPrisma.FreightExpenses, + legalClientOrderPrisma.QuoteTable.Icms.aliquot, ); } deleteManyLegalClientOrder(ids: string[]): Promise { const legalclientorderDeleted = this.prisma.$transaction(async tx => { const promises = ids.map(async icmdsId => { - const legalclientorderPrisma = await tx.legalClientOrder.delete({ + const legalClientOrderPrisma = await tx.legalClientOrder.delete({ where: { id: icmdsId }, + include: { + FreightExpenses: true, + QuoteTable: { select: { Icms: { select: { aliquot: true } } } }, + }, }); - return LegalClientOrderPrismaDTO.PrismaToEntity(legalclientorderPrisma); + return LegalClientOrderPrismaDTO.PrismaToEntity( + legalClientOrderPrisma, + legalClientOrderPrisma.FreightExpenses, + legalClientOrderPrisma.QuoteTable.Icms.aliquot, + ); }); return Promise.all(promises); diff --git a/src/infra/database/prisma/services/LegalClientQuoteTable.service.ts b/src/infra/database/prisma/services/LegalClientQuoteTable.service.ts index cc78173d..54a467d3 100644 --- a/src/infra/database/prisma/services/LegalClientQuoteTable.service.ts +++ b/src/infra/database/prisma/services/LegalClientQuoteTable.service.ts @@ -31,9 +31,14 @@ export class LegalClientQuoteTablePrismaService where: { OR: [{ id: request.id }, { cod_quote: request.codQuote }], }, + include: { AdressDestiny: true, AdressOrigin: true }, }); - return LegalClientQuoteTablePrismaDTO.PrismaToEntity(legalclientquotetable); + return LegalClientQuoteTablePrismaDTO.PrismaToEntity( + legalclientquotetable, + legalclientquotetable?.AdressOrigin, + legalclientquotetable?.AdressDestiny, + ); } async createLegalClientQuoteTable( legalclientquotetable: LegalClientQuoteTable, @@ -43,10 +48,13 @@ export class LegalClientQuoteTablePrismaService data: LegalClientQuoteTablePrismaDTO.EntityToCreatePrisma( legalclientquotetable, ), + include: { AdressDestiny: true, AdressOrigin: true }, }); return LegalClientQuoteTablePrismaDTO.PrismaToEntity( legalclientquotetablePrisma, + legalclientquotetablePrisma.AdressOrigin, + legalclientquotetablePrisma.AdressDestiny, ); } async updateLegalClientQuoteTable( @@ -58,11 +66,14 @@ export class LegalClientQuoteTablePrismaService data: LegalClientQuoteTablePrismaDTO.EntityToPrismaUpdate( legalclientquotetable, ), + include: { AdressDestiny: true, AdressOrigin: true }, where: { id }, }); return LegalClientQuoteTablePrismaDTO.PrismaToEntity( legalclientquotetablePrisma, + legalclientquotetablePrisma.AdressOrigin, + legalclientquotetablePrisma.AdressDestiny, ); } @@ -75,10 +86,15 @@ export class LegalClientQuoteTablePrismaService skip: parameters.offset, where: parameters.where, orderBy: parameters.sort, + include: { AdressDestiny: true, AdressOrigin: true }, }); return legalclientquotetables.map(legalclientquotetable => - LegalClientQuoteTablePrismaDTO.PrismaToEntity(legalclientquotetable), + LegalClientQuoteTablePrismaDTO.PrismaToEntity( + legalclientquotetable, + legalclientquotetable.AdressOrigin, + legalclientquotetable.AdressDestiny, + ), ); } updateManyLegalClientQuoteTable( @@ -93,10 +109,13 @@ export class LegalClientQuoteTablePrismaService legalclientquotetable, ), where: { id: legalclientquotetable.id }, + include: { AdressDestiny: true, AdressOrigin: true }, }); return LegalClientQuoteTablePrismaDTO.PrismaToEntity( legalclientquotetablePrisma, + legalclientquotetablePrisma.AdressOrigin, + legalclientquotetablePrisma.AdressDestiny, ); }); @@ -109,8 +128,15 @@ export class LegalClientQuoteTablePrismaService async deleteLegalClientQuoteTable( id: string, ): Promise { + const data = await this.prisma.legalClientQuoteTable.delete({ + where: { id }, + include: { AdressDestiny: true, AdressOrigin: true }, + }); + return LegalClientQuoteTablePrismaDTO.PrismaToEntity( - await this.prisma.legalClientQuoteTable.delete({ where: { id } }), + data, + data.AdressOrigin, + data.AdressDestiny, ); } deleteManyLegalClientQuoteTable( @@ -121,10 +147,13 @@ export class LegalClientQuoteTablePrismaService const legalclientquotetablePrisma = await tx.legalClientQuoteTable.delete({ where: { id: icmdsId }, + include: { AdressDestiny: true, AdressOrigin: true }, }); return LegalClientQuoteTablePrismaDTO.PrismaToEntity( legalclientquotetablePrisma, + legalclientquotetablePrisma.AdressOrigin, + legalclientquotetablePrisma.AdressDestiny, ); }); diff --git a/src/infra/database/prisma/services/PhysicalCustomerOrder.service.ts b/src/infra/database/prisma/services/PhysicalCustomerOrder.service.ts index 9b341c72..4dcdd2be 100644 --- a/src/infra/database/prisma/services/PhysicalCustomerOrder.service.ts +++ b/src/infra/database/prisma/services/PhysicalCustomerOrder.service.ts @@ -28,23 +28,44 @@ export class PhysicalCustomerOrderPrismaService async findOrdersByPhyiscalCustomer( physicalCustomerId: string, ): Promise { - const orders = await this.prisma.physicalCustomerOrder.findMany({ - where: { physical_customer_id: physicalCustomerId }, - }); + const physicalCustomerOrders = + await this.prisma.physicalCustomerOrder.findMany({ + where: { physical_customer_id: physicalCustomerId }, + include: { + FreightExpenses: true, + PhysicalCustomerQuoteTable: { + select: { Icms: { select: { aliquot: true } } }, + }, + }, + }); - return orders.map(order => - PhysicalCustomerOrderPrismaDTO.PrismaToEntity(order), + return physicalCustomerOrders.map(order => + PhysicalCustomerOrderPrismaDTO.PrismaToEntity( + order, + order.FreightExpenses, + order.PhysicalCustomerQuoteTable.Icms.aliquot, + ), ); } async findPhysicalCustomerOrder( request: GetPhysicalCustomerOrderDTO, ): Promise { - const physicalCustomerOrder = + const physicalCustomerOrderPrisma = await this.prisma.physicalCustomerOrder.findFirst({ where: { OR: [{ id: request.id }, { order: request.order }] }, + include: { + FreightExpenses: true, + PhysicalCustomerQuoteTable: { + select: { Icms: { select: { aliquot: true } } }, + }, + }, }); - return PhysicalCustomerOrderPrismaDTO.PrismaToEntity(physicalCustomerOrder); + return PhysicalCustomerOrderPrismaDTO.PrismaToEntity( + physicalCustomerOrderPrisma, + physicalCustomerOrderPrisma?.FreightExpenses, + physicalCustomerOrderPrisma?.PhysicalCustomerQuoteTable.Icms.aliquot, + ); } async createPhysicalCustomerOrder( physicalCustomerOrder: PhysicalCustomerOrder, @@ -54,10 +75,18 @@ export class PhysicalCustomerOrderPrismaService data: PhysicalCustomerOrderPrismaDTO.EntityToCreatePrisma( physicalCustomerOrder, ), + include: { + FreightExpenses: true, + PhysicalCustomerQuoteTable: { + select: { Icms: { select: { aliquot: true } } }, + }, + }, }); return PhysicalCustomerOrderPrismaDTO.PrismaToEntity( physicalCustomerOrderPrisma, + physicalCustomerOrderPrisma?.FreightExpenses, + physicalCustomerOrderPrisma?.PhysicalCustomerQuoteTable.Icms.aliquot, ); } async updatePhysicalCustomerOrder( @@ -70,10 +99,18 @@ export class PhysicalCustomerOrderPrismaService physicalCustomerOrder, ), where: { id }, + include: { + FreightExpenses: true, + PhysicalCustomerQuoteTable: { + select: { Icms: { select: { aliquot: true } } }, + }, + }, }); return PhysicalCustomerOrderPrismaDTO.PrismaToEntity( physicalCustomerOrderPrisma, + physicalCustomerOrderPrisma?.FreightExpenses, + physicalCustomerOrderPrisma?.PhysicalCustomerQuoteTable.Icms.aliquot, ); } @@ -86,10 +123,20 @@ export class PhysicalCustomerOrderPrismaService skip: parameters.offset, where: parameters.where, orderBy: parameters.sort, + include: { + FreightExpenses: true, + PhysicalCustomerQuoteTable: { + select: { Icms: { select: { aliquot: true } } }, + }, + }, }); - return physicalCustomerOrders.map(physicalCustomerOrder => - PhysicalCustomerOrderPrismaDTO.PrismaToEntity(physicalCustomerOrder), + return physicalCustomerOrders.map(order => + PhysicalCustomerOrderPrismaDTO.PrismaToEntity( + order, + order?.FreightExpenses, + order?.PhysicalCustomerQuoteTable.Icms.aliquot, + ), ); } async getAllExpenses( @@ -108,7 +155,6 @@ export class PhysicalCustomerOrderPrismaService updateManyPhysicalCustomerOrder( data: PhysicalCustomerOrder[], ): Promise { - console.log(data); const physicalcustomerorderUpdate = this.prisma.$transaction(async tx => { const promises = data.map(async physicalcustomerorder => { const physicalcustomerorderPrisma = @@ -117,10 +163,18 @@ export class PhysicalCustomerOrderPrismaService physicalcustomerorder, ), where: { id: physicalcustomerorder.id }, + include: { + FreightExpenses: true, + PhysicalCustomerQuoteTable: { + select: { Icms: { select: { aliquot: true } } }, + }, + }, }); return PhysicalCustomerOrderPrismaDTO.PrismaToEntity( physicalcustomerorderPrisma, + physicalcustomerorderPrisma?.FreightExpenses, + physicalcustomerorderPrisma?.PhysicalCustomerQuoteTable.Icms.aliquot, ); }); @@ -133,8 +187,21 @@ export class PhysicalCustomerOrderPrismaService async deletePhysicalCustomerOrder( id: string, ): Promise { + const physicalcustomerorderPrisma = + await this.prisma.physicalCustomerOrder.delete({ + where: { id }, + include: { + FreightExpenses: true, + PhysicalCustomerQuoteTable: { + select: { Icms: { select: { aliquot: true } } }, + }, + }, + }); + return PhysicalCustomerOrderPrismaDTO.PrismaToEntity( - await this.prisma.physicalCustomerOrder.delete({ where: { id } }), + physicalcustomerorderPrisma, + physicalcustomerorderPrisma?.FreightExpenses, + physicalcustomerorderPrisma?.PhysicalCustomerQuoteTable.Icms.aliquot, ); } deleteManyPhysicalCustomerOrder( @@ -145,10 +212,18 @@ export class PhysicalCustomerOrderPrismaService const physicalcustomerorderPrisma = await tx.physicalCustomerOrder.delete({ where: { id: icmdsId }, + include: { + FreightExpenses: true, + PhysicalCustomerQuoteTable: { + select: { Icms: { select: { aliquot: true } } }, + }, + }, }); return PhysicalCustomerOrderPrismaDTO.PrismaToEntity( physicalcustomerorderPrisma, + physicalcustomerorderPrisma?.FreightExpenses, + physicalcustomerorderPrisma?.PhysicalCustomerQuoteTable.Icms.aliquot, ); }); diff --git a/src/infra/database/prisma/services/PhysicalCustomerQuoteTable.service.ts b/src/infra/database/prisma/services/PhysicalCustomerQuoteTable.service.ts index 5692bf62..d5fab647 100644 --- a/src/infra/database/prisma/services/PhysicalCustomerQuoteTable.service.ts +++ b/src/infra/database/prisma/services/PhysicalCustomerQuoteTable.service.ts @@ -21,10 +21,13 @@ export class PhysicalCustomerQuoteTablePrismaService where: { OR: [{ id: request.id }, { cod_quote: request.codQuote }], }, + include: { AdressDestiny: true, AdressOrigin: true }, }); return PhysicalCustomerQuoteTablePrismaDTO.PrismaToEntity( physicalcustomerquotetable, + physicalcustomerquotetable?.AdressOrigin, + physicalcustomerquotetable?.AdressDestiny, ); } async createPhysicalCustomerQuoteTable( @@ -35,10 +38,13 @@ export class PhysicalCustomerQuoteTablePrismaService data: PhysicalCustomerQuoteTablePrismaDTO.EntityToCreatePrisma( physicalcustomerquotetable, ), + include: { AdressDestiny: true, AdressOrigin: true }, }); return PhysicalCustomerQuoteTablePrismaDTO.PrismaToEntity( physicalcustomerquotetablePrisma, + physicalcustomerquotetablePrisma.AdressOrigin, + physicalcustomerquotetablePrisma.AdressDestiny, ); } async updatePhysicalCustomerQuoteTable( @@ -50,11 +56,14 @@ export class PhysicalCustomerQuoteTablePrismaService data: PhysicalCustomerQuoteTablePrismaDTO.EntityToPrismaUpdate( physicalcustomerquotetable, ), + include: { AdressDestiny: true, AdressOrigin: true }, where: { id }, }); return PhysicalCustomerQuoteTablePrismaDTO.PrismaToEntity( physicalcustomerquotetablePrisma, + physicalcustomerquotetablePrisma.AdressOrigin, + physicalcustomerquotetablePrisma.AdressDestiny, ); } @@ -67,11 +76,14 @@ export class PhysicalCustomerQuoteTablePrismaService skip: parameters.offset, where: parameters.where, orderBy: parameters.sort, + include: { AdressDestiny: true, AdressOrigin: true }, }); return physicalcustomerquotetables.map(physicalcustomerquotetable => PhysicalCustomerQuoteTablePrismaDTO.PrismaToEntity( physicalcustomerquotetable, + physicalcustomerquotetable.AdressOrigin, + physicalcustomerquotetable.AdressDestiny, ), ); } diff --git a/src/infra/database/prisma/services/prismaDTO/AdressPrismaDto.ts b/src/infra/database/prisma/services/prismaDTO/AdressPrismaDto.ts new file mode 100644 index 00000000..2a866ca9 --- /dev/null +++ b/src/infra/database/prisma/services/prismaDTO/AdressPrismaDto.ts @@ -0,0 +1,18 @@ +import { type Adresses as AdressesPrisma } from '@prisma/client'; + +import { type AdressesType } from 'domain/entities/QuoteTables/AdressesType'; + +export class AdressPrismDto { + public static prismaToType(adressPrisma: AdressesPrisma): AdressesType { + return { + address_number: adressPrisma.address_number, + city: adressPrisma.city, + neighborhood: adressPrisma.neighborhood, + postalCod: adressPrisma.neighborhood, + street: adressPrisma.street, + uf: adressPrisma.uf, + complement: adressPrisma.complement, + id: adressPrisma.id, + }; + } +} diff --git a/src/infra/database/prisma/services/prismaDTO/LegalClientOrderPrismaDto.ts b/src/infra/database/prisma/services/prismaDTO/LegalClientOrderPrismaDto.ts index 3c155c88..d9b2df2f 100644 --- a/src/infra/database/prisma/services/prismaDTO/LegalClientOrderPrismaDto.ts +++ b/src/infra/database/prisma/services/prismaDTO/LegalClientOrderPrismaDto.ts @@ -1,13 +1,19 @@ import { type Prisma, type LegalClientOrder as LegalClientOrderPrisma, + type FreightExpenses as FreightExpensePrisma, } from '@prisma/client'; import { LegalClientOrder } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; export class LegalClientOrderPrismaDTO { - public static PrismaToEntity(legalClientOrderPrisma: LegalClientOrderPrisma) { + public static PrismaToEntity( + legalClientOrderPrisma: LegalClientOrderPrisma, + expensesPrisma?: FreightExpensePrisma[], + icms?: number, + ) { if (!legalClientOrderPrisma) return null; + console.log(expensesPrisma); return new LegalClientOrder({ legal_contract_id: legalClientOrderPrisma.legal_contract_id, @@ -15,10 +21,19 @@ export class LegalClientOrderPrismaDTO { updated_by: legalClientOrderPrisma.updated_by, quote_table_id: legalClientOrderPrisma.quote_table_id, created_at: legalClientOrderPrisma.created_at, + total_receivable: legalClientOrderPrisma.total_receivable, + total_shipping_cost: legalClientOrderPrisma.total_shipping_cost, + total_tax_payable: legalClientOrderPrisma.total_tax_payable, created_by: legalClientOrderPrisma.created_by, id: legalClientOrderPrisma.id, updated_at: legalClientOrderPrisma.updated_at, carrier_id: legalClientOrderPrisma.carrier_id, + expenses: expensesPrisma?.map(expense => ({ + expenseName: expense.expense_name, + value: expense.value, + id: expense.id, + })), + icms_tax: icms, }); } public static EntityToCreatePrisma(legalClientOrder: LegalClientOrder) { @@ -31,6 +46,17 @@ export class LegalClientOrderPrismaDTO { updated_at: legalClientOrder.updated_at, QuoteTable: { connect: { id: legalClientOrder.quote_table_id } }, CarrierCompany: { connect: { id: legalClientOrder.carrier_id } }, + total_receivable: legalClientOrder.total_receivable, + total_shipping_cost: legalClientOrder.total_shipping_cost, + total_tax_payable: legalClientOrder.total_tax_payable, + FreightExpenses: { + createMany: { + data: legalClientOrder.expenses.map(expense => ({ + expense_name: expense.expenseName, + value: expense.value, + })), + }, + }, }; return legalClientOrderPrisma; @@ -49,6 +75,24 @@ export class LegalClientOrderPrismaDTO { CarrierCompany: legalClientOrder.carrier_id ? { connect: { id: legalClientOrder.carrier_id } } : undefined, + total_receivable: legalClientOrder.total_receivable, + total_shipping_cost: legalClientOrder.total_shipping_cost, + total_tax_payable: legalClientOrder.total_tax_payable, + FreightExpenses: legalClientOrder.expenses + ? { + upsert: legalClientOrder.expenses.map(expense => ({ + create: { + expense_name: expense.expenseName, + value: expense.value, + }, + update: { + expense_name: expense.expenseName, + value: expense.value, + }, + where: { id: expense.id ?? '' }, + })), + } + : undefined, }; return legalClientOrderUptade; diff --git a/src/infra/database/prisma/services/prismaDTO/LegalClientQuoteTablePrismaDto.ts b/src/infra/database/prisma/services/prismaDTO/LegalClientQuoteTablePrismaDto.ts index e0dcfeef..f2d200bf 100644 --- a/src/infra/database/prisma/services/prismaDTO/LegalClientQuoteTablePrismaDto.ts +++ b/src/infra/database/prisma/services/prismaDTO/LegalClientQuoteTablePrismaDto.ts @@ -1,6 +1,7 @@ import { type Prisma, type LegalClientQuoteTable as LegalClientQuoteTablePrisma, + type Adresses as AdressesPrisma, } from '@prisma/client'; import { LegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable'; @@ -8,17 +9,41 @@ import { LegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQu export class LegalClientQuoteTablePrismaDTO { public static PrismaToEntity( legalclientquotetablePrisma: LegalClientQuoteTablePrisma, + adressOriginPrisma: AdressesPrisma, + adressDestinyPrisma: AdressesPrisma, ) { if (!legalclientquotetablePrisma) return null; return new LegalClientQuoteTable({ amount: legalclientquotetablePrisma.amount, + formPayment: legalclientquotetablePrisma.form_payment, + kindService: legalclientquotetablePrisma.kind_service, + natureService: legalclientquotetablePrisma.nature_service, + typeCte: legalclientquotetablePrisma.type_cte, codQuote: legalclientquotetablePrisma.cod_quote, description: legalclientquotetablePrisma.description, mass: legalclientquotetablePrisma.mass, nf_value: legalclientquotetablePrisma.nf_value, - postalCodDestiny: legalclientquotetablePrisma.postal_cod_destiny, - postalCodOrigin: legalclientquotetablePrisma.postal_cod_origin, + adressDestiny: { + address_number: adressDestinyPrisma.address_number, + city: adressDestinyPrisma.city, + id: adressDestinyPrisma.id, + neighborhood: adressDestinyPrisma.neighborhood, + postalCod: adressDestinyPrisma.postal_cod, + street: adressDestinyPrisma.street, + uf: adressDestinyPrisma.uf, + complement: adressDestinyPrisma.complement, + }, + adressOrigin: { + address_number: adressOriginPrisma.address_number, + city: adressOriginPrisma.city, + id: adressOriginPrisma.id, + neighborhood: adressOriginPrisma.neighborhood, + postalCod: adressOriginPrisma.postal_cod, + street: adressOriginPrisma.street, + uf: adressOriginPrisma.uf, + complement: adressOriginPrisma.complement, + }, recipientId: legalclientquotetablePrisma.recipient_id, senderId: legalclientquotetablePrisma.sender_id, typeMerchandise: legalclientquotetablePrisma.type_merchandise, @@ -36,14 +61,65 @@ export class LegalClientQuoteTablePrismaDTO { ) { const legalclientquotetablePrisma: Prisma.LegalClientQuoteTableCreateInput = { + Icms: { + connect: { + state_orgin_recipient_state: { + recipient_state: legalclientquotetable.adressDestiny.uf, + state_orgin: legalclientquotetable.adressOrigin.uf, + }, + }, + }, CreatedBy: { connect: { id: legalclientquotetable.created_by } }, amount: legalclientquotetable.amount, cod_quote: legalclientquotetable.codQuote, + form_payment: legalclientquotetable.formPayment, + kind_service: legalclientquotetable.kindService, + nature_service: legalclientquotetable.natureService, + type_cte: legalclientquotetable.typeCte, description: legalclientquotetable.description, mass: legalclientquotetable.mass, nf_value: legalclientquotetable.nf_value, - postal_cod_destiny: legalclientquotetable.postalCodDestiny, - postal_cod_origin: legalclientquotetable.postalCodOrigin, + AdressDestiny: { + connectOrCreate: { + where: { + postal_cod_address_number: { + address_number: + legalclientquotetable.adressDestiny.address_number, + postal_cod: legalclientquotetable.adressDestiny.postalCod, + }, + }, + create: { + address_number: + legalclientquotetable.adressDestiny.address_number, + city: legalclientquotetable.adressDestiny.city, + neighborhood: legalclientquotetable.adressDestiny.neighborhood, + postal_cod: legalclientquotetable.adressDestiny.postalCod, + street: legalclientquotetable.adressDestiny.street, + uf: legalclientquotetable.adressDestiny.uf, + complement: legalclientquotetable.adressDestiny.complement, + }, + }, + }, + AdressOrigin: { + connectOrCreate: { + where: { + postal_cod_address_number: { + address_number: + legalclientquotetable.adressOrigin.address_number, + postal_cod: legalclientquotetable.adressOrigin.postalCod, + }, + }, + create: { + address_number: legalclientquotetable.adressOrigin.address_number, + city: legalclientquotetable.adressOrigin.city, + neighborhood: legalclientquotetable.adressOrigin.neighborhood, + postal_cod: legalclientquotetable.adressOrigin.postalCod, + street: legalclientquotetable.adressOrigin.street, + uf: legalclientquotetable.adressOrigin.uf, + complement: legalclientquotetable.adressOrigin.complement, + }, + }, + }, Recipient: { connect: { id: legalclientquotetable.recipientId } }, Sender: { connect: { id: legalclientquotetable.senderId } }, type_merchandise: legalclientquotetable.typeMerchandise, @@ -66,9 +142,39 @@ export class LegalClientQuoteTablePrismaDTO { amount: legalclientquotetable.amount, description: legalclientquotetable.description, mass: legalclientquotetable.mass, + form_payment: legalclientquotetable.formPayment, + kind_service: legalclientquotetable.kindService, + nature_service: legalclientquotetable.natureService, + type_cte: legalclientquotetable.typeCte, nf_value: legalclientquotetable.nf_value, - postal_cod_destiny: legalclientquotetable.postalCodDestiny, - postal_cod_origin: legalclientquotetable.postalCodOrigin, + AdressDestiny: legalclientquotetable.adressDestiny + ? { + update: { + address_number: + legalclientquotetable.adressDestiny?.address_number, + city: legalclientquotetable.adressDestiny?.city, + neighborhood: legalclientquotetable.adressDestiny?.neighborhood, + postal_cod: legalclientquotetable.adressDestiny?.postalCod, + street: legalclientquotetable.adressDestiny?.street, + uf: legalclientquotetable.adressDestiny?.uf, + complement: legalclientquotetable.adressDestiny?.complement, + }, + } + : undefined, + AdressOrigin: legalclientquotetable.adressOrigin + ? { + update: { + address_number: + legalclientquotetable.adressOrigin?.address_number, + city: legalclientquotetable.adressOrigin?.city, + neighborhood: legalclientquotetable.adressOrigin?.neighborhood, + postal_cod: legalclientquotetable.adressOrigin?.postalCod, + street: legalclientquotetable.adressOrigin?.street, + uf: legalclientquotetable.adressOrigin?.uf, + complement: legalclientquotetable.adressOrigin?.complement, + }, + } + : undefined, Recipient: legalclientquotetable.recipientId ? { connect: { id: legalclientquotetable.recipientId } } : undefined, @@ -80,6 +186,14 @@ export class LegalClientQuoteTablePrismaDTO { who_pays: legalclientquotetable.who_pays, UpdatedBy: { connect: { id: legalclientquotetable.updated_by } }, updated_at: legalclientquotetable.updated_at, + Icms: { + connect: { + state_orgin_recipient_state: { + recipient_state: legalclientquotetable.adressDestiny.uf, + state_orgin: legalclientquotetable.adressOrigin.uf, + }, + }, + }, }; return legalclientquotetableUptade; diff --git a/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerOrderPrismaDto.ts b/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerOrderPrismaDto.ts index 8929d0ba..f3159f02 100644 --- a/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerOrderPrismaDto.ts +++ b/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerOrderPrismaDto.ts @@ -1,6 +1,7 @@ import { type Prisma, type PhysicalCustomerOrder as PhysicalCustomerOrderPrisma, + type FreightExpenses as FreightExpensePrisma, } from '@prisma/client'; import { PhysicalCustomerOrder } from 'domain/entities/PhysicalClientEntities/physicalCustomerOrder/PhysicalCustomerOrder'; @@ -8,6 +9,8 @@ import { PhysicalCustomerOrder } from 'domain/entities/PhysicalClientEntities/ph export class PhysicalCustomerOrderPrismaDTO { public static PrismaToEntity( physicalCustomerOrderPrisma: PhysicalCustomerOrderPrisma, + expensesPrisma?: FreightExpensePrisma[], + icms?: number, ) { if (!physicalCustomerOrderPrisma) return null; @@ -21,12 +24,21 @@ export class PhysicalCustomerOrderPrismaDTO { updated_at: physicalCustomerOrderPrisma.updated_at, quote_table_id: physicalCustomerOrderPrisma.quote_table_id, carrier_id: physicalCustomerOrderPrisma.carrier_id, + total_receivable: physicalCustomerOrderPrisma.total_receivable, + total_shipping_cost: physicalCustomerOrderPrisma.total_shipping_cost, + total_tax_payable: physicalCustomerOrderPrisma.total_tax_payable, + expenses: expensesPrisma?.map(expense => ({ + expenseName: expense.expense_name, + value: expense.value, + id: expense.id, + })), + icms_tax: icms, }); } public static EntityToCreatePrisma( physicalCustomerOrder: PhysicalCustomerOrder, ) { - console.log(physicalCustomerOrder.quote_table_id); + console.log(physicalCustomerOrder.expenses); const physicalCustomerOrderPrisma: Prisma.PhysicalCustomerOrderCreateInput = { CreatedBy: { connect: { id: physicalCustomerOrder.created_by } }, @@ -41,6 +53,17 @@ export class PhysicalCustomerOrderPrismaDTO { connect: { id: physicalCustomerOrder.quote_table_id }, }, CarrierCompany: { connect: { id: physicalCustomerOrder.carrier_id } }, + total_receivable: physicalCustomerOrder.total_receivable, + total_shipping_cost: physicalCustomerOrder.total_shipping_cost, + total_tax_payable: physicalCustomerOrder.total_tax_payable, + FreightExpenses: { + createMany: { + data: physicalCustomerOrder.expenses.map(expense => ({ + expense_name: expense.expenseName, + value: expense.value, + })), + }, + }, }; return physicalCustomerOrderPrisma; @@ -63,6 +86,24 @@ export class PhysicalCustomerOrderPrismaDTO { CarrierCompany: physicalCustomerOrder.carrier_id ? { connect: { id: physicalCustomerOrder.carrier_id } } : undefined, + total_receivable: physicalCustomerOrder.total_receivable, + total_shipping_cost: physicalCustomerOrder.total_shipping_cost, + total_tax_payable: physicalCustomerOrder.total_tax_payable, + FreightExpenses: physicalCustomerOrder.expenses + ? { + upsert: physicalCustomerOrder.expenses.map(expense => ({ + create: { + expense_name: expense.expenseName, + value: expense.value, + }, + update: { + expense_name: expense.expenseName, + value: expense.value, + }, + where: { id: expense.id ?? '' }, + })), + } + : undefined, }; return physicalCustomerOrderPrisma; diff --git a/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerPrismaDto.ts b/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerPrismaDto.ts index 6c9e5bcc..eac36787 100644 --- a/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerPrismaDto.ts +++ b/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerPrismaDto.ts @@ -26,11 +26,14 @@ export class PhysicalCustomerPrismaDTO { physicalCustomer: PhysicalCustomer, naturalPerson: NaturalPerson, ) { + console.log(physicalCustomer); + console.log(); const physicalCustomerPrisma: Prisma.PhysicalCustomerCreateInput = { branch: physicalCustomer.branch, - NaturalPerson: { - create: NaturalPersonPrismaDTO.EntityToPrisma(naturalPerson), - }, + NaturalPerson: this.naturalPersonQuery( + naturalPerson, + physicalCustomer.natural_person_id, + ), CreatedBy: { connect: { id: physicalCustomer.created_by } }, created_at: physicalCustomer.created_at, UpdatedBy: { connect: { id: physicalCustomer.updated_by } }, @@ -59,52 +62,16 @@ export class PhysicalCustomerPrismaDTO { return outsourcedDriverUptade; } - /*private static createOrUpdateContract(contract: ContractOutsourcedDriver) { - if (contract.id) { - console.log(contract); - const updateContract: Prisma.Enumerable = - { - data: { - cpf: contract.cpf, - situation: contract.situation, - start_at: contract.start_at, - type: contract.type, - created_at: contract.created_at, - created_by: contract.created_by, - end_at: contract.end_at, - updated_by: contract.updated_by, - updated_at: contract.updated_at, - }, - where: { id: contract.id }, - }; - const queryPrisma: Prisma.ContractOutsourcedDriverUpdateManyWithoutOutsourcedDriverNestedInput = - { - update: updateContract, - }; - - return queryPrisma; - } else { - const createContract: Prisma.XOR< - Prisma.Enumerable, - Prisma.Enumerable - > = { - contract_number: contract.contract_number, - cpf: contract.cpf, - situation: contract.situation, - start_at: contract.start_at, - type: contract.type, - created_at: contract.created_at, - created_by: contract.created_by, - end_at: contract.end_at, - updated_by: contract.updated_by, - updated_at: contract.updated_at, - }; - const queryPrisma: Prisma.ContractOutsourcedDriverUpdateManyWithoutOutsourcedDriverNestedInput = - { - create: createContract, - }; + private static naturalPersonQuery( + naturalPerson?: NaturalPerson, + natualPersonId?: string, + ) { + if (!naturalPerson && !natualPersonId) return; + const query: Prisma.NaturalPersonCreateNestedOneWithoutRecipientInput = + naturalPerson + ? { create: NaturalPersonPrismaDTO.EntityToPrisma(naturalPerson) } + : { connect: { id: natualPersonId } }; - return queryPrisma; - } - }*/ + return query; + } } diff --git a/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerQuoteTablePrismaDto.ts b/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerQuoteTablePrismaDto.ts index 5add25ec..a2afc8ab 100644 --- a/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerQuoteTablePrismaDto.ts +++ b/src/infra/database/prisma/services/prismaDTO/PhysicalCustomerQuoteTablePrismaDto.ts @@ -1,6 +1,7 @@ import { type Prisma, type PhysicalCustomerQuoteTable as PhysicalCustomerQuoteTablePrisma, + type Adresses as AdressesPrisma, } from '@prisma/client'; import { PhysicalCustomerQuoteTable } from 'domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable'; @@ -8,17 +9,41 @@ import { PhysicalCustomerQuoteTable } from 'domain/entities/QuoteTables/Physical export class PhysicalCustomerQuoteTablePrismaDTO { public static PrismaToEntity( physicalcustomerquotetablePrisma: PhysicalCustomerQuoteTablePrisma, + adressOriginPrisma: AdressesPrisma, + adressDestinyPrisma: AdressesPrisma, ) { if (!physicalcustomerquotetablePrisma) return null; return new PhysicalCustomerQuoteTable({ amount: physicalcustomerquotetablePrisma.amount, codQuote: physicalcustomerquotetablePrisma.cod_quote, + formPayment: physicalcustomerquotetablePrisma.form_payment, + kindService: physicalcustomerquotetablePrisma.kind_service, + natureService: physicalcustomerquotetablePrisma.natute_service, + typeCte: physicalcustomerquotetablePrisma.type_cte, description: physicalcustomerquotetablePrisma.description, mass: physicalcustomerquotetablePrisma.mass, nf_value: physicalcustomerquotetablePrisma.nf_value, - postalCodDestiny: physicalcustomerquotetablePrisma.postal_cod_destiny, - postalCodOrigin: physicalcustomerquotetablePrisma.postal_cod_origin, + adressDestiny: { + address_number: adressDestinyPrisma.address_number, + city: adressDestinyPrisma.city, + id: adressDestinyPrisma.id, + neighborhood: adressDestinyPrisma.neighborhood, + postalCod: adressDestinyPrisma.postal_cod, + street: adressDestinyPrisma.street, + uf: adressDestinyPrisma.uf, + complement: adressDestinyPrisma.complement, + }, + adressOrigin: { + address_number: adressOriginPrisma.address_number, + city: adressOriginPrisma.city, + id: adressOriginPrisma.id, + neighborhood: adressOriginPrisma.neighborhood, + postalCod: adressOriginPrisma.postal_cod, + street: adressOriginPrisma.street, + uf: adressOriginPrisma.uf, + complement: adressOriginPrisma.complement, + }, recipientId: physicalcustomerquotetablePrisma.recipient_id, senderId: physicalcustomerquotetablePrisma.senderId, typeMerchandise: physicalcustomerquotetablePrisma.type_merchandise, @@ -29,6 +54,7 @@ export class PhysicalCustomerQuoteTablePrismaDTO { updated_by: physicalcustomerquotetablePrisma.updated_by, created_at: physicalcustomerquotetablePrisma.created_at, updated_at: physicalcustomerquotetablePrisma.updated_at, + icms_id: physicalcustomerquotetablePrisma.icms_id, }); } public static EntityToCreatePrisma( @@ -36,20 +62,70 @@ export class PhysicalCustomerQuoteTablePrismaDTO { ) { const physicalcustomerquotetablePrisma: Prisma.PhysicalCustomerQuoteTableCreateInput = { + Icms: { + connect: { + state_orgin_recipient_state: { + recipient_state: physicalcustomerquotetable.adressDestiny.uf, + state_orgin: physicalcustomerquotetable.adressOrigin.uf, + }, + }, + }, CreatedBy: { connect: { id: physicalcustomerquotetable.created_by } }, amount: physicalcustomerquotetable.amount, cod_quote: physicalcustomerquotetable.codQuote, + form_payment: physicalcustomerquotetable.formPayment, + kind_service: physicalcustomerquotetable.kindService, + natute_service: physicalcustomerquotetable.natureService, + type_cte: physicalcustomerquotetable.typeCte, description: physicalcustomerquotetable.description, mass: physicalcustomerquotetable.mass, nf_value: physicalcustomerquotetable.nf_value, - postal_cod_destiny: physicalcustomerquotetable.postalCodDestiny, - postal_cod_origin: physicalcustomerquotetable.postalCodOrigin, - Recipient: physicalcustomerquotetable.recipientId - ? { connect: { id: physicalcustomerquotetable.recipientId } } - : undefined, - Sender: physicalcustomerquotetable.senderId - ? { connect: { id: physicalcustomerquotetable.senderId } } - : undefined, + AdressDestiny: { + connectOrCreate: { + where: { + postal_cod_address_number: { + address_number: + physicalcustomerquotetable.adressDestiny.address_number, + postal_cod: physicalcustomerquotetable.adressDestiny.postalCod, + }, + }, + create: { + address_number: + physicalcustomerquotetable.adressDestiny.address_number, + city: physicalcustomerquotetable.adressDestiny.city, + neighborhood: + physicalcustomerquotetable.adressDestiny.neighborhood, + postal_cod: physicalcustomerquotetable.adressDestiny.postalCod, + street: physicalcustomerquotetable.adressDestiny.street, + uf: physicalcustomerquotetable.adressDestiny.uf, + complement: physicalcustomerquotetable.adressDestiny.complement, + }, + }, + }, + AdressOrigin: { + connectOrCreate: { + where: { + postal_cod_address_number: { + address_number: + physicalcustomerquotetable.adressOrigin.address_number, + postal_cod: physicalcustomerquotetable.adressOrigin.postalCod, + }, + }, + create: { + address_number: + physicalcustomerquotetable.adressOrigin.address_number, + city: physicalcustomerquotetable.adressOrigin.city, + neighborhood: + physicalcustomerquotetable.adressOrigin.neighborhood, + postal_cod: physicalcustomerquotetable.adressOrigin.postalCod, + street: physicalcustomerquotetable.adressOrigin.street, + uf: physicalcustomerquotetable.adressOrigin.uf, + complement: physicalcustomerquotetable.adressOrigin.complement, + }, + }, + }, + Recipient: { connect: { id: physicalcustomerquotetable.recipientId } }, + Sender: { connect: { id: physicalcustomerquotetable.senderId } }, type_merchandise: physicalcustomerquotetable.typeMerchandise, volume: physicalcustomerquotetable.volume, who_pays: physicalcustomerquotetable.who_pays, @@ -70,16 +146,61 @@ export class PhysicalCustomerQuoteTablePrismaDTO { amount: physicalcustomerquotetable.amount, description: physicalcustomerquotetable.description, mass: physicalcustomerquotetable.mass, + form_payment: physicalcustomerquotetable.formPayment, + kind_service: physicalcustomerquotetable.kindService, + natute_service: physicalcustomerquotetable.natureService, + type_cte: physicalcustomerquotetable.typeCte, nf_value: physicalcustomerquotetable.nf_value, - postal_cod_destiny: physicalcustomerquotetable.postalCodDestiny, - postal_cod_origin: physicalcustomerquotetable.postalCodOrigin, - Recipient: { connect: { id: physicalcustomerquotetable.recipientId } }, - Sender: { connect: { id: physicalcustomerquotetable.senderId } }, + AdressDestiny: physicalcustomerquotetable.adressDestiny + ? { + update: { + address_number: + physicalcustomerquotetable.adressDestiny?.address_number, + city: physicalcustomerquotetable.adressDestiny?.city, + neighborhood: + physicalcustomerquotetable.adressDestiny?.neighborhood, + postal_cod: physicalcustomerquotetable.adressDestiny?.postalCod, + street: physicalcustomerquotetable.adressDestiny?.street, + uf: physicalcustomerquotetable.adressDestiny?.uf, + complement: + physicalcustomerquotetable.adressDestiny?.complement, + }, + } + : undefined, + AdressOrigin: physicalcustomerquotetable.adressOrigin + ? { + update: { + address_number: + physicalcustomerquotetable.adressOrigin?.address_number, + city: physicalcustomerquotetable.adressOrigin?.city, + neighborhood: + physicalcustomerquotetable.adressOrigin?.neighborhood, + postal_cod: physicalcustomerquotetable.adressOrigin?.postalCod, + street: physicalcustomerquotetable.adressOrigin?.street, + uf: physicalcustomerquotetable.adressOrigin?.uf, + complement: physicalcustomerquotetable.adressOrigin?.complement, + }, + } + : undefined, + Recipient: physicalcustomerquotetable.recipientId + ? { connect: { id: physicalcustomerquotetable.recipientId } } + : undefined, + Sender: physicalcustomerquotetable.senderId + ? { connect: { id: physicalcustomerquotetable.senderId } } + : undefined, type_merchandise: physicalcustomerquotetable.typeMerchandise, volume: physicalcustomerquotetable.volume, who_pays: physicalcustomerquotetable.who_pays, UpdatedBy: { connect: { id: physicalcustomerquotetable.updated_by } }, updated_at: physicalcustomerquotetable.updated_at, + Icms: { + connect: { + state_orgin_recipient_state: { + recipient_state: physicalcustomerquotetable.adressDestiny.uf, + state_orgin: physicalcustomerquotetable.adressOrigin.uf, + }, + }, + }, }; return physicalcustomerquotetableUptade; diff --git a/src/infra/graphql/entities/AdressesGraphql/Adresses.input.ts b/src/infra/graphql/entities/AdressesGraphql/Adresses.input.ts new file mode 100644 index 00000000..819b1148 --- /dev/null +++ b/src/infra/graphql/entities/AdressesGraphql/Adresses.input.ts @@ -0,0 +1,21 @@ +import { Field, InputType } from '@nestjs/graphql'; + +import { type AdressesType } from 'domain/entities/QuoteTables/AdressesType'; + +@InputType() +export class AdressInput implements AdressesType { + @Field() + postalCod: string; + @Field() + street: string; + @Field() + address_number: string; + @Field() + neighborhood: string; + @Field({ nullable: true }) + complement?: string; + @Field() + city: string; + @Field() + uf: string; +} diff --git a/src/infra/graphql/entities/AdressesGraphql/Adresses.model.ts b/src/infra/graphql/entities/AdressesGraphql/Adresses.model.ts new file mode 100644 index 00000000..f927cb66 --- /dev/null +++ b/src/infra/graphql/entities/AdressesGraphql/Adresses.model.ts @@ -0,0 +1,23 @@ +import { Field, ObjectType } from '@nestjs/graphql'; + +import { type AdressesType } from 'domain/entities/QuoteTables/AdressesType'; + +@ObjectType() +export class AdressModel implements AdressesType { + @Field() + id?: string; + @Field() + postalCod: string; + @Field() + street: string; + @Field() + address_number: string; + @Field() + neighborhood: string; + @Field({ nullable: true }) + complement?: string; + @Field() + city: string; + @Field() + uf: string; +} diff --git a/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.input.ts b/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.input.ts index a68054ad..0decaceb 100644 --- a/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.input.ts +++ b/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.input.ts @@ -46,3 +46,25 @@ export class FreightExpenseUpdateManyInput extends PartialType( @IsNotEmpty() id: string; } + +@InputType() +export class FreightExpenseOrderInput + implements Omit +{ + @Field() + @IsString() + @IsNotEmpty() + expenseName: string; + @Field(() => Float) + @IsNumber() + @IsNotEmpty() + value: number; +} + +@InputType() +export class FreightExpenseUpdateOrderInput extends FreightExpenseOrderInput { + @Field({ nullable: true }) + @IsUUID() + @IsOptional() + id?: string; +} diff --git a/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.model.ts b/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.model.ts index ee709935..acf62da5 100644 --- a/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.model.ts +++ b/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.model.ts @@ -15,3 +15,13 @@ export class FreightExpenseModel implements IFreightExpense { @Field({ nullable: true }) legalClientOrderId?: string; } + +@ObjectType() +export class FreightExpenseOrderModel implements IFreightExpense { + @Field({ nullable: true }) + id?: string; + @Field() + expenseName: string; + @Field(() => Float) + value: number; +} diff --git a/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.resolver.ts b/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.resolver.ts index 6d7dd7ec..dafebf28 100644 --- a/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.resolver.ts +++ b/src/infra/graphql/entities/FreightExpenseGraphql/FreightExpense.resolver.ts @@ -17,9 +17,8 @@ import { } from './Args/WhereFreightExpenseArgs'; import { FreightExpenseUpdateManyInput, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - FreightExpenseInput, FreightExpenseUpdateInput, + FreightExpenseInput, } from './FreightExpense.input'; import { FreightExpenseModel } from './FreightExpense.model'; @@ -50,9 +49,9 @@ export class FreightExpenseResolver { @Mutation(() => FreightExpenseModel) async createFreightExpense( @Args('data') - FreightExpenseInput: FreightExpenseInput, + freightExpenseInput: FreightExpenseInput, ) { - return this.freightExpenseUseCase.createFreightExpense(FreightExpenseInput); + return this.freightExpenseUseCase.createFreightExpense(freightExpenseInput); } @Mutation(() => FreightExpenseModel) async updateFreightExpense( diff --git a/src/infra/graphql/entities/GenerateCtePdfGraphql/CtePdf.input.ts b/src/infra/graphql/entities/GenerateCtePdfGraphql/CtePdf.input.ts index 1cedd14c..e5e98a18 100644 --- a/src/infra/graphql/entities/GenerateCtePdfGraphql/CtePdf.input.ts +++ b/src/infra/graphql/entities/GenerateCtePdfGraphql/CtePdf.input.ts @@ -3,10 +3,10 @@ import { Field, InputType } from '@nestjs/graphql'; @InputType() export class CtePdfLegalClientInput { @Field() - legalClientOrderId: string; + cteLegalPersonId: string; } @InputType() export class CtePdfPhysicalCustomerInput { @Field() - physicalCustomerOrderId: string; + ctePhysicalCustomerId: string; } diff --git a/src/infra/graphql/entities/GenerateCtePdfGraphql/CtePdf.resolver.ts b/src/infra/graphql/entities/GenerateCtePdfGraphql/CtePdf.resolver.ts index b3e176e2..782cbc32 100644 --- a/src/infra/graphql/entities/GenerateCtePdfGraphql/CtePdf.resolver.ts +++ b/src/infra/graphql/entities/GenerateCtePdfGraphql/CtePdf.resolver.ts @@ -17,7 +17,7 @@ export class CtePdfResolver { @Args('request') request: CtePdfLegalClientInput, ) { const cteUrl = await this.ctePdfUseCase.getCteUrlLegalClient( - request.legalClientOrderId, + request.cteLegalPersonId, ); return { cteUrl }; @@ -27,7 +27,7 @@ export class CtePdfResolver { @Args('request') request: CtePdfPhysicalCustomerInput, ) { const cteUrl = await this.ctePdfUseCase.getCteUrlPhysicalCustomer( - request.physicalCustomerOrderId, + request.ctePhysicalCustomerId, ); return { cteUrl }; diff --git a/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.input.ts b/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.input.ts index 8e9e3aec..40a806d8 100644 --- a/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.input.ts +++ b/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.input.ts @@ -1,9 +1,28 @@ -import { Field, HideField, InputType, PartialType } from '@nestjs/graphql'; +import { + Field, + Float, + HideField, + InputType, + PartialType, +} from '@nestjs/graphql'; -import { Allow, IsNotEmpty, IsString, IsUUID } from 'class-validator'; +import { Type } from 'class-transformer'; +import { + Allow, + IsNotEmpty, + IsNumber, + IsOptional, + IsString, + IsUUID, +} from 'class-validator'; import { type ILegalClientOrder } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; +import { + FreightExpenseOrderInput, + FreightExpenseUpdateOrderInput, +} from '../FreightExpenseGraphql/FreightExpense.input'; + @InputType() export class LegalClientOrderInput implements Omit @@ -29,11 +48,32 @@ export class LegalClientOrderInput @HideField() @Allow() updated_by: string; + @Field(() => Float, { nullable: true }) + @IsNumber() + @IsOptional() + total_shipping_cost?: number; + @Field(() => Float, { nullable: true }) + @IsNumber() + @IsOptional() + total_receivable?: number; + @Field(() => Float, { nullable: true }) + @IsNumber() + @IsOptional() + total_tax_payable?: number; + @Field(() => [FreightExpenseOrderInput]) + @IsOptional() + @Type(() => FreightExpenseOrderInput) + expenses?: FreightExpenseOrderInput[]; } @InputType() export class LegalClientOrderUpdateInput extends PartialType( LegalClientOrderInput, -) {} +) { + @Field(() => [FreightExpenseUpdateOrderInput], { nullable: true }) + @IsOptional() + @Type(() => FreightExpenseUpdateOrderInput) + expenses?: FreightExpenseUpdateOrderInput[]; +} @InputType() export class LegalClientOrderUpdateManyInput extends PartialType( @@ -43,4 +83,8 @@ export class LegalClientOrderUpdateManyInput extends PartialType( @IsUUID() @IsNotEmpty() id: string; + @Field(() => [FreightExpenseUpdateOrderInput], { nullable: true }) + @IsOptional() + @Type(() => FreightExpenseUpdateOrderInput) + expenses?: FreightExpenseUpdateOrderInput[]; } diff --git a/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.model.ts b/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.model.ts index eb830650..c3eda12b 100644 --- a/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.model.ts +++ b/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.model.ts @@ -1,9 +1,9 @@ -import { Field, ObjectType } from '@nestjs/graphql'; +import { Field, Float, ObjectType } from '@nestjs/graphql'; import { type ILegalClientOrder } from 'domain/entities/LegalClientEntities/LegalClientOrder/LegaClientOrder'; import { CarrierCompanyModel } from '../CarrierCompanyGraphql/CarrierCompany.model'; -import { FreightExpenseModel } from '../FreightExpenseGraphql/FreightExpense.model'; +import { FreightExpenseOrderModel } from '../FreightExpenseGraphql/FreightExpense.model'; import { LegalClientQuoteTableModel } from '../LegalClientQuoteTableGraphql/LegalClientQuoteTable.model'; import { LegalContractModel, @@ -29,6 +29,12 @@ export class LegalClientOrderModel implements ILegalClientOrder { updated_by: string; @Field() carrier_id: string; + @Field(() => Float, { nullable: true }) + total_shipping_cost?: number; + @Field(() => Float, { nullable: true }) + total_receivable?: number; + @Field(() => Float, { nullable: true }) + total_tax_payable?: number; @Field(() => LegalContractModel) LegalContract: LegalContractReferences; @Field(() => UserModelRefereces) @@ -40,8 +46,22 @@ export class LegalClientOrderModel implements ILegalClientOrder { quote_table_id: string; @Field(() => LegalClientQuoteTableModel) Quote: LegalClientQuoteTableModel; - @Field(() => [FreightExpenseModel]) - FreightExpenses: FreightExpenseModel[]; + @Field(() => CarrierCompanyModel) CarrierCompany: CarrierCompanyModel; + @Field(() => Float) + calculate_cofins?: number; + @Field(() => Float) + calculated_pis?: number; + @Field(() => Float) + cofins_tax?: number; + @Field(() => Float) + calculate_icms?: number; + @Field(() => Float) + pis_tax?: number; + @Field(() => Float) + icms_tax?: number; + + @Field(() => [FreightExpenseOrderModel], { nullable: true }) + expenses?: FreightExpenseOrderModel[]; } diff --git a/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.resolver.ts b/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.resolver.ts index daa59105..d5bfcbac 100644 --- a/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.resolver.ts +++ b/src/infra/graphql/entities/LegalClientOrderGraphql/LegalClientOrder.resolver.ts @@ -27,7 +27,6 @@ import { RoleInterceptor } from 'infra/graphql/utilities/interceptors/RoleInterc import { GraphQLAuthGuard } from 'infra/guard/GraphQlAuthGuard'; import { CarrierCompanyModel } from '../CarrierCompanyGraphql/CarrierCompany.model'; -import { FreightExpenseModel } from '../FreightExpenseGraphql/FreightExpense.model'; import { LegalClientQuoteTableModel } from '../LegalClientQuoteTableGraphql/LegalClientQuoteTable.model'; import { LegalContractModel } from '../LegalContractGraphql/LegalContract.model'; import { UserModelRefereces } from '../UserGraphql/user.model'; @@ -151,10 +150,4 @@ export class LegalClientOrderResolver { id: order.carrier_id, }); } - @ResolveField(() => [FreightExpenseModel]) - async FreightExpenses(@Parent() order: LegalClientOrderInput) { - return await this.legalClientOrdeUseCase.getExpenses({ - order: order.order, - }); - } } diff --git a/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.input.ts b/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.input.ts index 07e273dc..cb0a7d15 100644 --- a/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.input.ts +++ b/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.input.ts @@ -7,37 +7,63 @@ import { PartialType, } from '@nestjs/graphql'; -import { Allow, IsNotEmpty, IsNumber, IsString, IsUUID } from 'class-validator'; +import { + Allow, + IsNotEmpty, + IsNumber, + IsObject, + IsString, + IsUUID, +} from 'class-validator'; import { type ILegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable'; +import { AdressInput } from '../AdressesGraphql/Adresses.input'; + @InputType() export class LegalClientQuoteTableInput implements Omit { - @HideField() - @Allow() - codQuote: string; @Field() + @IsNotEmpty() @IsString() + kindService: string; + @Field() @IsNotEmpty() - recipientId: string; + @IsString() + typeCte: string; @Field() + @IsNotEmpty() @IsString() + natureService: string; + @Field() @IsNotEmpty() - senderId: string; + @IsString() + formPayment: string; + @Field(() => AdressInput) + @IsObject() + @IsNotEmpty() + adressOrigin: AdressInput; + @Field(() => AdressInput) + @IsObject() + @IsNotEmpty() + adressDestiny: AdressInput; + @HideField() + @Allow() + codQuote: string; @Field() @IsString() @IsNotEmpty() - who_pays: string; + recipientId: string; @Field() @IsString() @IsNotEmpty() - postalCodOrigin: string; + senderId: string; @Field() @IsString() @IsNotEmpty() - postalCodDestiny: string; + who_pays: string; + @Field() @IsString() @IsNotEmpty() diff --git a/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.model.ts b/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.model.ts index c8f6ef31..301acb06 100644 --- a/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.model.ts +++ b/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.model.ts @@ -2,13 +2,32 @@ import { Field, Int, ObjectType } from '@nestjs/graphql'; import { type ILegalClientQuoteTable } from 'domain/entities/QuoteTables/LegalClientQuoteTable/LegalClientQuoteTable'; +import { AdressModel } from '../AdressesGraphql/Adresses.model'; +import { IcmsModel } from '../IcmsGraphql/Icms.model'; import { RecipientModel } from '../RecipientGraphql/Recipient.model'; import { SenderModel } from '../SenderGraphql/Sender.model'; @ObjectType() export class LegalClientQuoteTableModel implements ILegalClientQuoteTable { @Field() - id?: string; + id: string; + @Field() + kindService: string; + @Field() + @Field() + typeCte: string; + @Field() + natureService: string; + @Field() + formPayment: string; + @Field(() => Date) + created_at: Date; + @Field(() => Date) + updated_at: Date; + @Field(() => AdressModel) + adressOrigin: AdressModel; + @Field(() => AdressModel) + adressDestiny: AdressModel; @Field() codQuote: string; @Field() @@ -18,10 +37,6 @@ export class LegalClientQuoteTableModel implements ILegalClientQuoteTable { @Field() who_pays: string; @Field() - postalCodOrigin: string; - @Field() - postalCodDestiny: string; - @Field() typeMerchandise: string; @Field(() => Int) amount: number; @@ -41,4 +56,8 @@ export class LegalClientQuoteTableModel implements ILegalClientQuoteTable { Recipient: RecipientModel; @Field(() => SenderModel) Sender: SenderModel; + @Field() + icms_id?: string; + @Field(() => IcmsModel) + Icms: IcmsModel; } diff --git a/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.module.ts b/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.module.ts index f518ff92..abff4c38 100644 --- a/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.module.ts +++ b/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.module.ts @@ -7,6 +7,7 @@ import { LegalClientQuoteTableUseCases } from 'app/useCases/LegalClientQuoteTabl import { LegalClientQuoteTablePrismaService } from 'infra/database/prisma/services/LegalClientQuoteTable.service'; import { GraphqlCenterModule } from '../GraphqlCenter.module'; +import { IcmsModule } from '../IcmsGraphql/Icms.module'; import { RecipientModule } from '../RecipientGraphql/Recipient.module'; import { SenderModule } from '../SenderGraphql/Sender.module'; import { LegalClientQuoteTableResolver } from './LegalClientQuoteTable.resolver'; @@ -20,7 +21,7 @@ import { LegalClientQuoteTableResolver } from './LegalClientQuoteTable.resolver' LegalClientQuoteTableResolver, LegalClientQuoteTableUseCases, ], - imports: [GraphqlCenterModule, SenderModule, RecipientModule], + imports: [GraphqlCenterModule, SenderModule, RecipientModule, IcmsModule], exports: [LegalClientQuoteTableUseCases], }) export class LegalClientQuoteTableModule {} diff --git a/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.resolver.ts b/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.resolver.ts index ca8f85a9..a06a0f21 100644 --- a/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.resolver.ts +++ b/src/infra/graphql/entities/LegalClientQuoteTableGraphql/LegalClientQuoteTable.resolver.ts @@ -11,6 +11,7 @@ import { import { ROLE, User } from 'domain/entities/User/User'; +import { IcmsUseCases } from 'app/useCases/IcmsUseCase/IcmsUseCases'; import { LegalClientQuoteTableUseCases } from 'app/useCases/LegalClientQuoteTableUseCase/LegalClientQuoteTable'; import { RecipientUseCases } from 'app/useCases/RecipientUseCase /RecipientUseCases'; import { SenderUseCases } from 'app/useCases/SenderUseCase /SenderUseCases'; @@ -25,6 +26,7 @@ import { CurrentUser } from 'infra/graphql/utilities/decorators/CurrentUser'; import { RoleInterceptor } from 'infra/graphql/utilities/interceptors/RoleInterceptor'; import { GraphQLAuthGuard } from 'infra/guard/GraphQlAuthGuard'; +import { IcmsModel } from '../IcmsGraphql/Icms.model'; import { RecipientModel } from '../RecipientGraphql/Recipient.model'; import { SenderModel } from '../SenderGraphql/Sender.model'; import { UserModelRefereces } from '../UserGraphql/user.model'; @@ -46,6 +48,7 @@ export class LegalClientQuoteTableResolver { private userCase: UserUseCases, private recipientUseCase: RecipientUseCases, private senderUseCase: SenderUseCases, + private icmsUseCase: IcmsUseCases, ) {} @Query(() => Int) async countLegalClientQuoteTable( @@ -148,4 +151,8 @@ export class LegalClientQuoteTableResolver { id: quote.senderId, }); } + @ResolveField(() => IcmsModel) + Icms(@Parent() quote: LegalClientQuoteTableModel) { + return this.icmsUseCase.getIcms({ id: quote.icms_id }); + } } diff --git a/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.input.ts b/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.input.ts index f490b471..01bd221e 100644 --- a/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.input.ts +++ b/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.input.ts @@ -1,9 +1,18 @@ import { Field, HideField, InputType, PartialType } from '@nestjs/graphql'; -import { Allow, IsNotEmpty, IsString, IsUUID } from 'class-validator'; +import { Type } from 'class-transformer'; +import { + Allow, + IsNotEmpty, + IsOptional, + IsString, + IsUUID, +} from 'class-validator'; import { type IPhysicalCustomerOrder } from 'domain/entities/PhysicalClientEntities/physicalCustomerOrder/PhysicalCustomerOrder'; +import { FreightExpenseUpdateOrderInput } from '../FreightExpenseGraphql/FreightExpense.input'; + @InputType() export class PhysicalCustomerOrderInput implements Omit @@ -29,11 +38,32 @@ export class PhysicalCustomerOrderInput @HideField() @Allow() updated_by: string; + @HideField() + @Allow() + @IsOptional() + total_shipping_cost?: number; + @HideField() + @Allow() + @IsOptional() + total_receivable?: number; + @HideField() + @Allow() + @IsOptional() + total_tax_payable?: number; + @Field(() => [FreightExpenseUpdateOrderInput], { nullable: true }) + @IsOptional() + @Type(() => FreightExpenseUpdateOrderInput) + expenses?: FreightExpenseUpdateOrderInput[]; } @InputType() export class PhysicalCustomerOrderUpdateInput extends PartialType( PhysicalCustomerOrderInput, -) {} +) { + @Field(() => [FreightExpenseUpdateOrderInput], { nullable: true }) + @IsOptional() + @Type(() => FreightExpenseUpdateOrderInput) + expenses?: FreightExpenseUpdateOrderInput[]; +} @InputType() export class PhysicalCustomerOrderUpdateManyInput extends PartialType( PhysicalCustomerOrderInput, @@ -42,4 +72,8 @@ export class PhysicalCustomerOrderUpdateManyInput extends PartialType( @IsUUID() @IsNotEmpty() id: string; + @Field(() => [FreightExpenseUpdateOrderInput], { nullable: true }) + @IsOptional() + @Type(() => FreightExpenseUpdateOrderInput) + expenses?: FreightExpenseUpdateOrderInput[]; } diff --git a/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.model.ts b/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.model.ts index 3ce6efe2..ab92f6e3 100644 --- a/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.model.ts +++ b/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.model.ts @@ -1,9 +1,9 @@ -import { Field, ObjectType } from '@nestjs/graphql'; +import { Field, Float, ObjectType } from '@nestjs/graphql'; import { type IPhysicalCustomerOrder } from 'domain/entities/PhysicalClientEntities/physicalCustomerOrder/PhysicalCustomerOrder'; import { CarrierCompanyModel } from '../CarrierCompanyGraphql/CarrierCompany.model'; -import { FreightExpenseModel } from '../FreightExpenseGraphql/FreightExpense.model'; +import { FreightExpenseOrderModel } from '../FreightExpenseGraphql/FreightExpense.model'; import { PhysicalCustomerModel } from '../PhysicalCustomerGraphql/PhysicalCustomer.model'; import { PhysicalCustomerQuoteTableModel } from '../PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.model'; import { UserModelRefereces } from '../UserGraphql/user.model'; @@ -36,8 +36,14 @@ export class PhysicalCustomerOrderModel implements IPhysicalCustomerOrder { CreatedUser: UserModelRefereces; @Field(() => UserModelRefereces) UpdatedUser: UserModelRefereces; - @Field(() => [FreightExpenseModel]) - FreightExpenses: FreightExpenseModel[]; + @Field(() => [FreightExpenseOrderModel]) + expenses: FreightExpenseOrderModel[]; @Field(() => CarrierCompanyModel) CarrierCompany: CarrierCompanyModel; + @Field(() => Float, { nullable: true }) + total_shipping_cost?: number; + @Field(() => Float, { nullable: true }) + total_receivable?: number; + @Field(() => Float, { nullable: true }) + total_tax_payable?: number; } diff --git a/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.resolver.ts b/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.resolver.ts index 253e9bf5..bcef3e30 100644 --- a/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.resolver.ts +++ b/src/infra/graphql/entities/PhysicalCustomerOrderGraphql/PhysicalCustomerOrder.resolver.ts @@ -23,7 +23,6 @@ import { RoleInterceptor } from 'infra/graphql/utilities/interceptors/RoleInterc import { GraphQLAuthGuard } from 'infra/guard/GraphQlAuthGuard'; import { CarrierCompanyModel } from '../CarrierCompanyGraphql/CarrierCompany.model'; -import { FreightExpenseModel } from '../FreightExpenseGraphql/FreightExpense.model'; import { PhysicalCustomerModel } from '../PhysicalCustomerGraphql/PhysicalCustomer.model'; import { PhysicalCustomerQuoteTableModel } from '../PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.model'; import { UserModelRefereces } from '../UserGraphql/user.model'; @@ -158,10 +157,4 @@ export class PhysicalCustomerOrderResolver { id: order.carrier_id, }); } - @ResolveField(() => [FreightExpenseModel]) - async FreightExpenses(@Parent() order: PhysicalCustomerOrderInput) { - return await this.physicalCustomerOrderUseCase.getExpenses({ - order: order.order, - }); - } } diff --git a/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.input.ts b/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.input.ts index abb2dff2..2ea30b52 100644 --- a/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.input.ts +++ b/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.input.ts @@ -6,15 +6,39 @@ import { PartialType, } from '@nestjs/graphql'; -import { Allow, IsNotEmpty, IsNumber, IsString } from 'class-validator'; +import { + Allow, + IsNotEmpty, + IsNumber, + IsObject, + IsString, +} from 'class-validator'; import { type IPhysicalCustomerQuoteTable } from 'domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable'; +import { AdressInput } from '../AdressesGraphql/Adresses.input'; + @InputType() export class PhysicalCustomerQuoteTableInput implements Omit { + @Field() + @IsNotEmpty() + @IsString() + kindService: string; + @Field() + @IsNotEmpty() + @IsString() + typeCte: string; + @Field() + @IsNotEmpty() + @IsString() + natureService: string; + @Field() + @IsNotEmpty() + @IsString() + formPayment: string; @HideField() @Allow() codQuote: string; @@ -30,14 +54,14 @@ export class PhysicalCustomerQuoteTableInput @IsString() @IsNotEmpty() who_pays: string; - @Field() - @IsString() + @Field(() => AdressInput) + @IsObject() @IsNotEmpty() - postalCodOrigin: string; - @Field() - @IsString() + adressOrigin: AdressInput; + @Field(() => AdressInput) + @IsObject() @IsNotEmpty() - postalCodDestiny: string; + adressDestiny: AdressInput; @Field() @IsString() @IsNotEmpty() diff --git a/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.model.ts b/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.model.ts index 26a91e1b..0f778058 100644 --- a/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.model.ts +++ b/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.model.ts @@ -2,6 +2,8 @@ import { Field, ObjectType } from '@nestjs/graphql'; import { type IPhysicalCustomerQuoteTable } from 'domain/entities/QuoteTables/PhysicalCustomerQuoteTable/PhysicalCustomerQuoteTable'; +import { AdressModel } from '../AdressesGraphql/Adresses.model'; +import { IcmsModel } from '../IcmsGraphql/Icms.model'; import { RecipientModel } from '../RecipientGraphql/Recipient.model'; import { SenderModel } from '../SenderGraphql/Sender.model'; @@ -12,6 +14,19 @@ export class PhysicalCustomerQuoteTableModel @Field() id: string; @Field() + kindService: string; + @Field() + @Field() + typeCte: string; + @Field() + natureService: string; + @Field() + formPayment: string; + @Field(() => Date) + created_at: Date; + @Field(() => Date) + updated_at: Date; + @Field() codQuote: string; @Field() recipientId: string; @@ -19,10 +34,10 @@ export class PhysicalCustomerQuoteTableModel senderId: string; @Field() who_pays: string; - @Field() - postalCodOrigin: string; - @Field() - postalCodDestiny: string; + @Field(() => AdressModel) + adressOrigin: AdressModel; + @Field(() => AdressModel) + adressDestiny: AdressModel; @Field() typeMerchandise: string; @Field() @@ -43,4 +58,8 @@ export class PhysicalCustomerQuoteTableModel Recipient: RecipientModel; @Field(() => SenderModel) Sender: SenderModel; + @Field() + icms_id?: string; + @Field(() => IcmsModel) + Icms: IcmsModel; } diff --git a/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.module.ts b/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.module.ts index 79bc1117..259834f6 100644 --- a/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.module.ts +++ b/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.module.ts @@ -7,6 +7,7 @@ import { PhysicalCustomerQuoteTableUseCases } from 'app/useCases/PhysicalCustome import { PhysicalCustomerQuoteTablePrismaService } from 'infra/database/prisma/services/PhysicalCustomerQuoteTable.service'; import { GraphqlCenterModule } from '../GraphqlCenter.module'; +import { IcmsModule } from '../IcmsGraphql/Icms.module'; import { RecipientModule } from '../RecipientGraphql/Recipient.module'; import { SenderModule } from '../SenderGraphql/Sender.module'; import { PhysicalCustomerQuoteTableResolver } from './PhysicalCustomerQuoteTable.resolver'; @@ -20,7 +21,7 @@ import { PhysicalCustomerQuoteTableResolver } from './PhysicalCustomerQuoteTable PhysicalCustomerQuoteTableResolver, PhysicalCustomerQuoteTableUseCases, ], - imports: [GraphqlCenterModule, SenderModule, RecipientModule], + imports: [GraphqlCenterModule, SenderModule, RecipientModule, IcmsModule], exports: [PhysicalCustomerQuoteTableUseCases], }) export class PhysicalCustomerQuoteTableModule {} diff --git a/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.resolver.ts b/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.resolver.ts index c4d0d570..ec1098a3 100644 --- a/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.resolver.ts +++ b/src/infra/graphql/entities/PhysicalCustomerQuoteTableGraphql/PhysicalCustomerQuoteTable.resolver.ts @@ -10,6 +10,7 @@ import { import { ROLE, User } from 'domain/entities/User/User'; +import { IcmsUseCases } from 'app/useCases/IcmsUseCase/IcmsUseCases'; import { PhysicalCustomerQuoteTableUseCases } from 'app/useCases/PhysicalCustomerQuoteTableUseCase/PhysicalCustomerQuoteTable'; import { RecipientUseCases } from 'app/useCases/RecipientUseCase /RecipientUseCases'; import { SenderUseCases } from 'app/useCases/SenderUseCase /SenderUseCases'; @@ -21,6 +22,7 @@ import { CurrentUser } from 'infra/graphql/utilities/decorators/CurrentUser'; import { RoleInterceptor } from 'infra/graphql/utilities/interceptors/RoleInterceptor'; import { GraphQLAuthGuard } from 'infra/guard/GraphQlAuthGuard'; +import { IcmsModel } from '../IcmsGraphql/Icms.model'; import { RecipientModel } from '../RecipientGraphql/Recipient.model'; import { SenderModel } from '../SenderGraphql/Sender.model'; import { UserModelRefereces } from '../UserGraphql/user.model'; @@ -41,6 +43,7 @@ export class PhysicalCustomerQuoteTableResolver { private userCase: UserUseCases, private recipientUseCase: RecipientUseCases, private senderUseCase: SenderUseCases, + private icmsUseCase: IcmsUseCases, ) {} @Query(() => PhysicalCustomerQuoteTableModel, { nullable: true }) async getPhysicalCustomerQuoteTable( @@ -109,4 +112,8 @@ export class PhysicalCustomerQuoteTableResolver { id: quote.senderId, }); } + @ResolveField(() => IcmsModel) + Icms(@Parent() quote: PhysicalCustomerQuoteTableModel) { + return this.icmsUseCase.getIcms({ id: quote.icms_id }); + } } diff --git a/src/infra/graphql/generated/schema.gql b/src/infra/graphql/generated/schema.gql index a5730876..513976f6 100644 --- a/src/infra/graphql/generated/schema.gql +++ b/src/infra/graphql/generated/schema.gql @@ -2,6 +2,60 @@ # THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) # ------------------------------------------------------ +input AdressInput { + address_number: String! + city: String! + complement: String + neighborhood: String! + postalCod: String! + street: String! + uf: String! +} + +type AdressModel { + address_number: String! + city: String! + complement: String + id: String! + neighborhood: String! + postalCod: String! + street: String! + uf: String! +} + +input AdressesOrderByWithRelationInput { + LegalClientQuoteTableOrigin: LegalClientQuoteTableOrderByRelationAggregateInput + LegalClientQuoteTablesDestiny: LegalClientQuoteTableOrderByRelationAggregateInput + PhysicalCustomerQuoteTableDestiny: PhysicalCustomerQuoteTableOrderByRelationAggregateInput + PhysicalCustomerQuoteTableOrigin: PhysicalCustomerQuoteTableOrderByRelationAggregateInput + address_number: SortOrder + city: SortOrder + complement: SortOrder + id: SortOrder + neighborhood: SortOrder + postal_cod: SortOrder + street: SortOrder + uf: SortOrder +} + +input AdressesWhereInput { + AND: [AdressesWhereInput!] + LegalClientQuoteTableOrigin: LegalClientQuoteTableListRelationFilter + LegalClientQuoteTablesDestiny: LegalClientQuoteTableListRelationFilter + NOT: [AdressesWhereInput!] + OR: [AdressesWhereInput!] + PhysicalCustomerQuoteTableDestiny: PhysicalCustomerQuoteTableListRelationFilter + PhysicalCustomerQuoteTableOrigin: PhysicalCustomerQuoteTableListRelationFilter + address_number: StringFilter + city: StringFilter + complement: StringNullableFilter + id: StringFilter + neighborhood: StringFilter + postal_cod: StringFilter + street: StringFilter + uf: StringFilter +} + input AuthInput { email: String! password: String! @@ -206,7 +260,6 @@ input CompanyVehicleOrderByWithRelationInput { created_at: SortOrder created_by: SortOrder id: SortOrder - orderProcessingLegalClientId: SortOrder updated_at: SortOrder updated_by: SortOrder vehicle_id: SortOrder @@ -231,7 +284,6 @@ input CompanyVehicleWhereInput { created_at: DateTimeFilter created_by: StringFilter id: StringFilter - orderProcessingLegalClientId: StringNullableFilter updated_at: DateTimeFilter updated_by: StringFilter vehicle_id: StringFilter @@ -429,11 +481,11 @@ type CtePDfModel { } input CtePdfLegalClientInput { - legalClientOrderId: String! + cteLegalPersonId: String! } input CtePdfPhysicalCustomerInput { - physicalCustomerOrderId: String! + ctePhysicalCustomerId: String! } input DateTimeFilter { @@ -488,6 +540,17 @@ type FreightExpenseModel { value: Float! } +input FreightExpenseOrderInput { + expenseName: String! + value: Float! +} + +type FreightExpenseOrderModel { + expenseName: String! + id: String + value: Float! +} + input FreightExpenseUpdateInput { expenseName: String legalClientOrderId: String @@ -503,6 +566,12 @@ input FreightExpenseUpdateManyInput { value: Float } +input FreightExpenseUpdateOrderInput { + expenseName: String! + id: String + value: Float! +} + input FreightExpensesListRelationFilter { every: FreightExpensesWhereInput none: FreightExpensesWhereInput @@ -585,6 +654,8 @@ input IcmsOrderByRelationAggregateInput { input IcmsOrderByWithRelationInput { CreatedBy: UserOrderByWithRelationInput + LegalClientQuoteTable: LegalClientQuoteTableOrderByRelationAggregateInput + PhysicalCustomerQuoteTable: PhysicalCustomerQuoteTableOrderByRelationAggregateInput UpdatedBy: UserOrderByWithRelationInput aliquot: SortOrder created_at: SortOrder @@ -615,8 +686,10 @@ input IcmsUpdateManyInput { input IcmsWhereInput { AND: [IcmsWhereInput!] CreatedBy: UserWhereInput + LegalClientQuoteTable: LegalClientQuoteTableListRelationFilter NOT: [IcmsWhereInput!] OR: [IcmsWhereInput!] + PhysicalCustomerQuoteTable: PhysicalCustomerQuoteTableListRelationFilter UpdatedBy: UserWhereInput aliquot: FloatFilter created_at: DateTimeFilter @@ -817,8 +890,12 @@ input LegalClientOrderByWithRelationInput { input LegalClientOrderInput { carrier_id: String! + expenses: [FreightExpenseOrderInput!]! legal_contract_id: String! quote_table_id: String! + total_receivable: Float + total_shipping_cost: Float + total_tax_payable: Float } input LegalClientOrderListRelationFilter { @@ -830,17 +907,26 @@ input LegalClientOrderListRelationFilter { type LegalClientOrderModel { CarrierCompany: CarrierCompanyModel! CreatedUser: UserModelRefereces! - FreightExpenses: [FreightExpenseModel!]! LegalContract: LegalContractModel! Quote: LegalClientQuoteTableModel! UpdatedUser: UserModelRefereces! + calculate_cofins: Float! + calculate_icms: Float! + calculated_pis: Float! carrier_id: String! + cofins_tax: Float! created_at: Timestamp! created_by: String! + expenses: [FreightExpenseOrderModel!] + icms_tax: Float! id: String! legal_contract_id: String! order: String! + pis_tax: Float! quote_table_id: String! + total_receivable: Float + total_shipping_cost: Float + total_tax_payable: Float updated_at: Timestamp! updated_by: String! } @@ -869,21 +955,32 @@ input LegalClientOrderOrderByWithRelationInput { order: SortOrder order_processing_id: SortOrder quote_table_id: SortOrder + total_receivable: SortOrder + total_shipping_cost: SortOrder + total_tax_payable: SortOrder updated_at: SortOrder updated_by: SortOrder } input LegalClientOrderUpdateInput { carrier_id: String + expenses: [FreightExpenseUpdateOrderInput!] legal_contract_id: String quote_table_id: String + total_receivable: Float + total_shipping_cost: Float + total_tax_payable: Float } input LegalClientOrderUpdateManyInput { carrier_id: String + expenses: [FreightExpenseUpdateOrderInput!] id: String! legal_contract_id: String quote_table_id: String + total_receivable: Float + total_shipping_cost: Float + total_tax_payable: Float } input LegalClientOrderWhereInput { @@ -909,19 +1006,26 @@ input LegalClientOrderWhereInput { order: StringFilter order_processing_id: StringNullableFilter quote_table_id: StringFilter + total_receivable: FloatFilter + total_shipping_cost: FloatFilter + total_tax_payable: FloatFilter updated_at: DateTimeFilter updated_by: StringFilter } input LegalClientQuoteTableInput { + adressDestiny: AdressInput! + adressOrigin: AdressInput! amount: Int! description: String! + formPayment: String! + kindService: String! mass: Float! + natureService: String! nf_value: Float! - postalCodDestiny: String! - postalCodOrigin: String! recipientId: String! senderId: String! + typeCte: String! typeMerchandise: String! volume: Float! who_pays: String! @@ -934,22 +1038,30 @@ input LegalClientQuoteTableListRelationFilter { } type LegalClientQuoteTableModel { + Icms: IcmsModel! Recipient: RecipientModel! Sender: SenderModel! + adressDestiny: AdressModel! + adressOrigin: AdressModel! amount: Int! codQuote: String! createdUser: UserModelRefereces! + created_at: Timestamp! created_by: String! description: String! + formPayment: String! + icms_id: String! id: String! + kindService: String! mass: Float! + natureService: String! nf_value: Float! - postalCodDestiny: String! - postalCodOrigin: String! recipientId: String! senderId: String! + typeCte: String! typeMerchandise: String! updatedUser: UserModelRefereces! + updated_at: Timestamp! updated_by: String! volume: Float! who_pays: String! @@ -960,23 +1072,31 @@ input LegalClientQuoteTableOrderByRelationAggregateInput { } input LegalClientQuoteTableOrderByWithRelationInput { + AdressDestiny: AdressesOrderByWithRelationInput + AdressOrigin: AdressesOrderByWithRelationInput CreatedBy: UserOrderByWithRelationInput + Icms: IcmsOrderByWithRelationInput LegalClientOrder: LegalClientOrderOrderByRelationAggregateInput Recipient: RecipientOrderByWithRelationInput Sender: SenderOrderByWithRelationInput UpdatedBy: UserOrderByWithRelationInput + adress_destiny_id: SortOrder + adress_origin_id: SortOrder amount: SortOrder cod_quote: SortOrder created_at: SortOrder created_by: SortOrder description: SortOrder + form_payment: SortOrder + icms_id: SortOrder id: SortOrder + kind_service: SortOrder mass: SortOrder + nature_service: SortOrder nf_value: SortOrder - postal_cod_destiny: SortOrder - postal_cod_origin: SortOrder recipient_id: SortOrder sender_id: SortOrder + type_cte: SortOrder type_merchandise: SortOrder updated_at: SortOrder updated_by: SortOrder @@ -985,29 +1105,37 @@ input LegalClientQuoteTableOrderByWithRelationInput { } input LegalClientQuoteTableUpdate { + adressDestiny: AdressInput + adressOrigin: AdressInput amount: Int description: String + formPayment: String + kindService: String mass: Float + natureService: String nf_value: Float - postalCodDestiny: String - postalCodOrigin: String recipientId: String senderId: String + typeCte: String typeMerchandise: String volume: Float who_pays: String } input LegalClientQuoteTableUpdateManyInput { + adressDestiny: AdressInput + adressOrigin: AdressInput amount: Int description: String + formPayment: String id: String! + kindService: String mass: Float + natureService: String nf_value: Float - postalCodDestiny: String - postalCodOrigin: String recipientId: String senderId: String + typeCte: String typeMerchandise: String volume: Float who_pays: String @@ -1015,25 +1143,33 @@ input LegalClientQuoteTableUpdateManyInput { input LegalClientQuoteTableWhereInput { AND: [LegalClientQuoteTableWhereInput!] + AdressDestiny: AdressesWhereInput + AdressOrigin: AdressesWhereInput CreatedBy: UserWhereInput + Icms: IcmsWhereInput LegalClientOrder: LegalClientOrderListRelationFilter NOT: [LegalClientQuoteTableWhereInput!] OR: [LegalClientQuoteTableWhereInput!] Recipient: RecipientWhereInput Sender: SenderWhereInput UpdatedBy: UserWhereInput + adress_destiny_id: StringFilter + adress_origin_id: StringFilter amount: IntFilter cod_quote: StringFilter created_at: DateTimeFilter created_by: StringFilter description: StringFilter + form_payment: StringFilter + icms_id: StringFilter id: StringFilter + kind_service: StringFilter mass: FloatFilter + nature_service: StringFilter nf_value: FloatFilter - postal_cod_destiny: StringFilter - postal_cod_origin: StringFilter recipient_id: StringFilter sender_id: StringFilter + type_cte: StringFilter type_merchandise: StringFilter updated_at: DateTimeFilter updated_by: StringFilter @@ -2311,7 +2447,6 @@ input OutsourcedVehicleOrderByWithRelationInput { created_at: SortOrder created_by: SortOrder id: SortOrder - orderProcessingLegalClientId: SortOrder order_processing_id: SortOrder updated_at: SortOrder updated_by: SortOrder @@ -2333,7 +2468,6 @@ input OutsourcedVehicleWhereInput { created_at: DateTimeFilter created_by: StringFilter id: StringFilter - orderProcessingLegalClientId: StringNullableFilter order_processing_id: StringNullableFilter updated_at: DateTimeFilter updated_by: StringFilter @@ -2523,6 +2657,7 @@ input PhysicalCustomerOrderByWithRelationInput { input PhysicalCustomerOrderInput { carrier_id: String! + expenses: [FreightExpenseUpdateOrderInput!] physicalCustomerId: String! quote_table_id: String! } @@ -2536,17 +2671,20 @@ input PhysicalCustomerOrderListRelationFilter { type PhysicalCustomerOrderModel { CarrierCompany: CarrierCompanyModel! CreatedUser: UserModelRefereces! - FreightExpenses: [FreightExpenseModel!]! PhysicalCustomer: PhysicalCustomerModel! Quote: PhysicalCustomerQuoteTableModel! UpdatedUser: UserModelRefereces! carrier_id: String! created_at: Timestamp! created_by: String! + expenses: [FreightExpenseOrderModel!]! id: String! order: String! physicalCustomerId: String! quote_table_id: String! + total_receivable: Float + total_shipping_cost: Float + total_tax_payable: Float updated_at: Timestamp! updated_by: String! } @@ -2574,18 +2712,23 @@ input PhysicalCustomerOrderOrderByWithRelationInput { order_processing_id: SortOrder physical_customer_id: SortOrder quote_table_id: SortOrder + total_receivable: SortOrder + total_shipping_cost: SortOrder + total_tax_payable: SortOrder updated_at: SortOrder updated_by: SortOrder } input PhysicalCustomerOrderUpdateInput { carrier_id: String + expenses: [FreightExpenseUpdateOrderInput!] physicalCustomerId: String quote_table_id: String } input PhysicalCustomerOrderUpdateManyInput { carrier_id: String + expenses: [FreightExpenseUpdateOrderInput!] id: String! physicalCustomerId: String quote_table_id: String @@ -2613,19 +2756,26 @@ input PhysicalCustomerOrderWhereInput { order_processing_id: StringNullableFilter physical_customer_id: StringFilter quote_table_id: StringFilter + total_receivable: FloatFilter + total_shipping_cost: FloatFilter + total_tax_payable: FloatFilter updated_at: DateTimeFilter updated_by: StringFilter } input PhysicalCustomerQuoteTableInput { + adressDestiny: AdressInput! + adressOrigin: AdressInput! amount: Float! description: String! + formPayment: String! + kindService: String! mass: Float! + natureService: String! nf_value: Float! - postalCodDestiny: String! - postalCodOrigin: String! recipientId: String! senderId: String! + typeCte: String! typeMerchandise: String! volume: Float! who_pays: String! @@ -2638,22 +2788,30 @@ input PhysicalCustomerQuoteTableListRelationFilter { } type PhysicalCustomerQuoteTableModel { + Icms: IcmsModel! Recipient: RecipientModel! Sender: SenderModel! + adressDestiny: AdressModel! + adressOrigin: AdressModel! amount: Float! codQuote: String! createdUser: UserModelRefereces! + created_at: Timestamp! created_by: String! description: String! + formPayment: String! + icms_id: String! id: String! + kindService: String! mass: Float! + natureService: String! nf_value: Float! - postalCodDestiny: String! - postalCodOrigin: String! recipientId: String! senderId: String! + typeCte: String! typeMerchandise: String! updatedUser: UserModelRefereces! + updated_at: Timestamp! updated_by: String! volume: Float! who_pays: String! @@ -2664,23 +2822,31 @@ input PhysicalCustomerQuoteTableOrderByRelationAggregateInput { } input PhysicalCustomerQuoteTableOrderByWithRelationInput { + AdressDestiny: AdressesOrderByWithRelationInput + AdressOrigin: AdressesOrderByWithRelationInput CreatedBy: UserOrderByWithRelationInput + Icms: IcmsOrderByWithRelationInput PhysicalCustomerOrder: PhysicalCustomerOrderOrderByRelationAggregateInput Recipient: RecipientOrderByWithRelationInput Sender: SenderOrderByWithRelationInput UpdatedBy: UserOrderByWithRelationInput + adress_destiny_id: SortOrder + adress_origin_id: SortOrder amount: SortOrder cod_quote: SortOrder created_at: SortOrder created_by: SortOrder description: SortOrder + form_payment: SortOrder + icms_id: SortOrder id: SortOrder + kind_service: SortOrder mass: SortOrder + natute_service: SortOrder nf_value: SortOrder - postal_cod_destiny: SortOrder - postal_cod_origin: SortOrder recipient_id: SortOrder senderId: SortOrder + type_cte: SortOrder type_merchandise: SortOrder updated_at: SortOrder updated_by: SortOrder @@ -2689,14 +2855,18 @@ input PhysicalCustomerQuoteTableOrderByWithRelationInput { } input PhysicalCustomerQuoteTableUpdate { + adressDestiny: AdressInput + adressOrigin: AdressInput amount: Float description: String + formPayment: String + kindService: String mass: Float + natureService: String nf_value: Float - postalCodDestiny: String - postalCodOrigin: String recipientId: String senderId: String + typeCte: String typeMerchandise: String volume: Float who_pays: String @@ -2704,25 +2874,33 @@ input PhysicalCustomerQuoteTableUpdate { input PhysicalCustomerQuoteTableWhereInput { AND: [PhysicalCustomerQuoteTableWhereInput!] + AdressDestiny: AdressesWhereInput + AdressOrigin: AdressesWhereInput CreatedBy: UserWhereInput + Icms: IcmsWhereInput NOT: [PhysicalCustomerQuoteTableWhereInput!] OR: [PhysicalCustomerQuoteTableWhereInput!] PhysicalCustomerOrder: PhysicalCustomerOrderListRelationFilter Recipient: RecipientWhereInput Sender: SenderWhereInput UpdatedBy: UserWhereInput + adress_destiny_id: StringFilter + adress_origin_id: StringFilter amount: IntFilter cod_quote: StringFilter created_at: DateTimeFilter created_by: StringFilter description: StringFilter + form_payment: StringFilter + icms_id: StringFilter id: StringFilter + kind_service: StringFilter mass: FloatFilter + natute_service: StringFilter nf_value: FloatFilter - postal_cod_destiny: StringFilter - postal_cod_origin: StringFilter recipient_id: StringFilter senderId: StringFilter + type_cte: StringFilter type_merchandise: StringFilter updated_at: DateTimeFilter updated_by: StringFilter diff --git a/src/infra/guard/auth.resolver.ts b/src/infra/guard/auth.resolver.ts index 74474997..27e9af3f 100644 --- a/src/infra/guard/auth.resolver.ts +++ b/src/infra/guard/auth.resolver.ts @@ -13,7 +13,7 @@ export class AuthResolver { constructor(private authRepository: AuthRepository) {} @Mutation(() => AuthModel) async login(@Args('loginData') userData: AuthInput) { - console.log(hashSync('1234', 10)); + console.log(hashSync('123456789', 10)); const response = await this.authRepository.signIn(userData); const resolver: IJWTResolver = { diff --git a/src/infra/services/generatePdf/GenerateCtePdf.ts b/src/infra/services/generatePdf/GenerateCtePdf.ts index 3a48fffa..e0728b1a 100644 --- a/src/infra/services/generatePdf/GenerateCtePdf.ts +++ b/src/infra/services/generatePdf/GenerateCtePdf.ts @@ -6,19 +6,22 @@ import { type CreateOptions } from 'html-pdf'; import pdf from 'html-pdf'; import path from 'path'; -import { type CtePdf } from 'domain/entities/Cte Entities/CtePdfEntity/CtePdf'; +import { type CteLegalClientPdf } from 'domain/entities/Cte Entities/CtePdfLegalClient/CtePdfLegalClient'; +import { type CtePhyscialCustomerPdf } from 'domain/entities/Cte Entities/CtePdfPhysicalClient/CtePdfPhysicalCustomer'; import { UploaderProvider } from 'domain/providers/UploaderProvider'; @Injectable() export class GenerateCtePdfService { - private cteUrl: string; constructor(private cloudFilesService: UploaderProvider) {} - async generatePdf(cteData: CtePdf): Promise { + async generatePdf( + cteData: CteLegalClientPdf | CtePhyscialCustomerPdf, + ): Promise { const options: CreateOptions = { format: 'A4', type: 'pdf', }; + console.log(cteData.orderData.natureService); const html = await this.compileEjs(cteData); return new Promise((resolve, reject) => { @@ -28,7 +31,6 @@ export class GenerateCtePdfService { reject(new GraphQLError('Erro ao Gerar PDF')); } else { try { - // Supondo que cloudFilesService.uploadPdf seja uma função assíncrona que faz o upload do PDF const url = await this.cloudFilesService.uploadPdf(buffer, 'test'); resolve(url.path); } catch (uploadError) { @@ -38,7 +40,9 @@ export class GenerateCtePdfService { }); }); } - private async compileEjs(cteData: CtePdf) { + private async compileEjs( + cteData: CteLegalClientPdf | CtePhyscialCustomerPdf, + ) { const html = await ejs.renderFile( path.dirname(process.cwd()) + '/app/src//infra/services/generatePdf/templates/test.ejs', diff --git a/src/infra/services/generatePdf/GeneratePdfCteModule.ts b/src/infra/services/generatePdf/GeneratePdfCteModule.ts index 7c3a9ca9..27b43d44 100644 --- a/src/infra/services/generatePdf/GeneratePdfCteModule.ts +++ b/src/infra/services/generatePdf/GeneratePdfCteModule.ts @@ -1,10 +1,16 @@ import { Module } from '@nestjs/common'; +import { CepSearchProvider } from 'domain/providers/CepSearchProvider'; + import { ServicesModule } from '../services.module'; +import { ViaCepService } from '../viaCep/provider/ViaCepService'; import { GenerateCtePdfService } from './GenerateCtePdf'; @Module({ - providers: [GenerateCtePdfService], + providers: [ + GenerateCtePdfService, + { provide: CepSearchProvider, useClass: ViaCepService }, + ], exports: [GenerateCtePdfService], imports: [ServicesModule], }) diff --git a/src/infra/services/generatePdf/templates/test.ejs b/src/infra/services/generatePdf/templates/test.ejs index 23bf42b8..2abe1a34 100644 --- a/src/infra/services/generatePdf/templates/test.ejs +++ b/src/infra/services/generatePdf/templates/test.ejs @@ -1,91 +1,369 @@ -
-
- - +
+
+
+ + + - - - - - + + - + - + - + - + - + - + + + + + + + +
- Transportadora: <%= carrierCompany.fantasy_name %> + Transportadora: <%= carrierCompany.fantasy_name %>
- CNPJ: <%= carrierCompany.cnpj %> + CNPJ: <%= carrierCompany.cnpj %>
- Inscrição Estatual: <%= carrierCompany.state_registration %> + Inscrição Estatual: <%= carrierCompany.state_registration %>
- + Endereço: Rua: <%= carrierCompany.public_place %> -
- Numero: <%= carrierCompany.adress_number %> -
- Bairro: <%= carrierCompany.neighborhood %> -
- Cidede: <%= carrierCompany.city %> -
- Estado: <%= carrierCompany.uf %> -
- Telefone: <%= carrierCompany.first_phone%> - - +
+ Numero: <%= carrierCompany.adress_number %> +
+ Bairro: <%= carrierCompany.neighborhood %> +
+ Cidede: <%= carrierCompany.city %> +
+ Estado: <%= carrierCompany.uf %> +
+ Telefone: <%= carrierCompany.first_phone%>
-
TIPO DO CT-E
- cteData.cteType + <%= cteData.cteType %> +
+ TIPO DO SERVIÇO +
+ <%= orderData.kindService %> +
+ NATURUREZA DA PRESTAÇÃO +
+ <%= orderData.natureService %>
  
    + Origem: +
+ <%= orderData.adressOrigin.city %>/<%= orderData.adressOrigin.uf %> +
Destino: +
+ <%= orderData.adressDestiny.city %>/<%= orderData.adressDestiny.uf %> +
+ Emitido por +
+ <%= carrierCompany.fantasy_name %> +
  + <% if ( typeof legalClient != "undefined") { %> + REMETENTE: <%= legalClient.corporate_name %> +
+ END: <%= legalClient.public_place %> + <%= legalClient.address_number %> + <%= legalClient.neighborhood %> +
+ MUN: <%= legalClient.city %> - <%= legalClient.uf %> CEP: A Fazer +
+ CNPJ: <%= legalClient.cnpj %> IE: <%= legalClient.state_registration %> FONE: <%= + legalClient.first_phone %> + <% } else { %> + REMETENTE: <%= physicalCustomer.name %> +
+ END: <%= physicalCustomer.public_place %> + <%= physicalCustomer.address_number %> + <%= physicalCustomer.neighborhood %> +
+ MUN: <%= physicalCustomer.city %> - <%= physicalCustomer.uf %> CEP: A Fazer +
+ FONE: <%= physicalCustomer.first_phone %> + <% } %> +
  + <% if ( recipientLegalPerson ) { %> + REMETENTE: <%= recipientLegalPerson.corporate_name %> +
+ END: <%= recipientLegalPerson.public_place %> + <%= recipientLegalPerson.address_number %> + <%= recipientLegalPerson.neighborhood %> +
+ MUN: <%= recipientLegalPerson.city %> - <%= recipientLegalPerson.uf %> CEP: A Fazer +
+ CNPJ: <%= recipientLegalPerson.cnpj %> IE: <%= recipientLegalPerson.state_registration %> + FONE: <%= recipientLegalPerson.first_phone %> + <% } else { %> + REMETENTE: <%= recipientNaturalPerson.name %> +
+ END: <%= recipientNaturalPerson.public_place %> + <%= recipientNaturalPerson.address_number %> + <%= recipientNaturalPerson.neighborhood %> +
+ MUN: <%= recipientNaturalPerson.city %> - <%= recipientNaturalPerson.uf %> + CEP: A Fazer +
+ FONE: <%= recipientNaturalPerson.first_phone %> + <% } %> +
  + <% if ( senderLegalPerson ) { %> + RECEBEDOR: <%= senderLegalPerson.corporate_name %> +
+ END: <%= senderLegalPerson.public_place %> + <%= senderLegalPerson.address_number %> + <%= senderLegalPerson.neighborhood %> +
+ MUN: <%= senderLegalPerson.city %> - <%= senderLegalPerson.uf %> CEP: A Fazer +
+ CNPJ: <%= senderLegalPerson.cnpj %> IE: <%= senderLegalPerson.state_registration %> FONE: <%= + senderLegalPerson.first_phone %> + <% } else { %> + RECEBEDOR: <%= senderNaturalPerson.name %> +
+ END: <%= senderNaturalPerson.public_place %> + <%= senderNaturalPerson.address_number %> + <%= senderNaturalPerson.neighborhood %> +
+ MUN: <%= senderNaturalPerson.city %> - <%= senderNaturalPerson.uf %> CEP: A + Fazer +
+ FONE: <%= senderNaturalPerson.first_phone %> + <% } %> +
  + <% if ( typeof legalClient != "undefined" ) { %> + TOMADOR: <%= legalClient.corporate_name %> +
+ END: <%= legalClient.public_place %> + <%= legalClient.address_number %> + <%= legalClient.neighborhood %> +
+ MUN: <%= legalClient.city %> - <%= legalClient.uf %> CEP: A Fazer +
+ CNPJ: <%= legalClient.cnpj %> IE: <%= legalClient.state_registration %> FONE: <%= + legalClient.first_phone %> + <% } else { %> + TOMADOR: <%= physicalCustomer.name %> +
+ END: <%= physicalCustomer.public_place %> + <%= physicalCustomer.address_number %> + <%= physicalCustomer.neighborhood %> +
+ MUN: <%= physicalCustomer.city %> - <%= physicalCustomer.uf %> CEP: A Fazer +
+ FONE: <%= physicalCustomer.first_phone %> + <% } %> +
  + Observações: +
+ <%= cteData?.observations %> +

+ + PLACA DE COLETE: A FAZER NR: <%= cteData.cteNumber %> +
  + TOMADOR SERVIÇO: +
+ A FAZER +
+ COBRAR +
+ <%= orderData.formPayment %> +
+ PREV.ENTREGA +
+ A Fazer +
+
+
+ +
+ + +
+ + + + + - + + + + - + + + + + + + + + + + + + - - + + + + + + - - - + + + + + + + + + + + + + +
+

D A C T E

+
+ Documento Auxiliar do Conhecimento de Transporte Eletrônico +
+ AUTORIZAÇÃO +
+ A Fazer +
  + SERIE +
+ A Fazer +
+ NUMERO +
+ A Fazer +
+ MODELO +
+ A fazer +
+ N°PROTOCOLO +
+ A fazer +
  + FOTO CODIGO DE BARRAS +
+ Chave de acesso para consulta de autenticidade no site www.cte.fazenda.gov.br +
+ <%= cteData.acessKey %> +
+ COMPONENTES DE FRETE(R$) + + MERCADORIA +
+ <% expenses.forEach(expense=> { %> + + + <%= expense.expenseName %> + + + <%= expense.value %> + + +
+ <% }) %> +
+ PROD PREDOMIN + + <%= orderData.description %> + +
+ ESPECIE: + A Fazer +
+ VALOR MERCADORIA(R$) + + <%= orderData.nf_value %> + +
+ QTDE PARES/VOLUMES + + <%= orderData.amount %> + +
+ CUBAG(m3) + + <%= orderData.volume %> + +
+ PESO CALCULO (Kg) + + <%= orderData.mass %> + +
   + ICMS(R$) +
+ SITUAÇÃO TRIBUTARIA +
+ BASE CALCULO + <%= orderData.nf_value %> +
+ ALIQ DIFAL/ICMS(%) + 12.00 +
+ VALOR ICMS +
+ DIFAL ICMS ORIG/DEST +
+ CRED PRES/ICMS ST +
    + FRETE TOTAL(R$) <%= %> + + VALOR A RECEBER(R$) +
+ DESTAQUE DE TRIBUTOS (Lei 12.741/2012) - Em R$ + PIX
ICMS/ISS PIS: A FAZER COFINS 0.25 TOTAL: A FAZER
+
+ CHAVES NF-E/CT-E +
+
+
diff --git a/src/infra/services/services.module.ts b/src/infra/services/services.module.ts index 3fa0df57..4b9a8a65 100644 --- a/src/infra/services/services.module.ts +++ b/src/infra/services/services.module.ts @@ -1,8 +1,10 @@ import { Module } from '@nestjs/common'; +import { CepSearchProvider } from 'domain/providers/CepSearchProvider'; import { UploaderProvider } from 'domain/providers/UploaderProvider'; import { CloudinaryUploaderProvider } from './cloudinary/providers/CloudinaryFileUploaderProvider'; +import { ViaCepService } from './viaCep/provider/ViaCepService'; @Module({ providers: [ @@ -10,7 +12,8 @@ import { CloudinaryUploaderProvider } from './cloudinary/providers/CloudinaryFil provide: UploaderProvider, useClass: CloudinaryUploaderProvider, }, + { provide: CepSearchProvider, useClass: ViaCepService }, ], - exports: [UploaderProvider], + exports: [UploaderProvider, CepSearchProvider], }) export class ServicesModule {} diff --git a/src/infra/services/viaCep/provider/ViaCepService.ts b/src/infra/services/viaCep/provider/ViaCepService.ts new file mode 100644 index 00000000..446b1dbc --- /dev/null +++ b/src/infra/services/viaCep/provider/ViaCepService.ts @@ -0,0 +1,40 @@ +import { HttpStatus, Injectable } from '@nestjs/common'; + +import { GraphQLError } from 'graphql'; + +import { type CepSearchProviderDTO } from 'domain/dto/providers/CepSearchProviderDto'; +import { type CepSearchProvider } from 'domain/providers/CepSearchProvider'; + +@Injectable() +export class ViaCepService implements CepSearchProvider { + async getZipCodeData(zipCode: string): Promise { + const request = await fetch(`https://viacep.com.br/ws/${zipCode}/json/`); + if (!request.ok) + throw new GraphQLError(`THIS CEP ${zipCode} IS INVALID`, { + extensions: { code: HttpStatus.BAD_REQUEST }, + }); + const requestData: IRequestZipCode = + (await request.json()) as IRequestZipCode; + + return { + city: requestData.localidade, + neighborhood: requestData.bairro, + state: requestData.uf, + street: requestData.logradouro, + zipCode: requestData.cep, + complement: requestData.cep, + }; + } +} +interface IRequestZipCode { + cep: string; + logradouro: string; + complemento: string; + bairro: string; + localidade: string; + uf: string; + ibge: string; + gia: string; + ddd: string; + siafi: string; +}