diff --git a/bin/templates/Makefile_ b/bin/templates/Makefile_ index a7db086..b8896c4 100644 --- a/bin/templates/Makefile_ +++ b/bin/templates/Makefile_ @@ -5,8 +5,7 @@ FILEMAIN=./cmd/$(SERVICENAME)/main.go FILEAPP=./bin/$(SERVICENAME) NEW_REPO=$(SERVICENAME) -CD_GENERATION_PROTO=cd ./api -GENERATION_PROTO=generation_code.sh +GENERATION_PROTO=cd ./api && ./generation_code.sh run: @@ -54,7 +53,6 @@ conn: init: clear go mod init gitlab.aescorp.ru/dsp_dev/claim/sync_service - $(CD_GENERATION_PROTO) $(GENERATION_PROTO) go mod tidy go mod vendor \ No newline at end of file diff --git a/bin/templates/configs_/convert_id.json b/bin/templates/configs_/convert_id.json index e12763f..bfd870e 100644 --- a/bin/templates/configs_/convert_id.json +++ b/bin/templates/configs_/convert_id.json @@ -1,14 +1,3 @@ { - "lawsuit_payments.id": "alias.PaymentId", - "lawsuit_payments.invoice_id": "alias.InvoiceId", - "lawsuit_payments.lawsuit_id": "alias.LawsuitId", - "lawsuit_payments.id": "alias.PaymentId", - "invoice_debt_type_stats.invoice_id": "alias.InvoiceId", - "invoice_debt_type_stats.lawsuit_id": "alias.LawsuitId", - "contract_black_items.contract_number": "alias.ContractNumber", - "contract_white_items.contract_number": "alias.ContractNumber", - "lawsuits.number_claim": "alias.ClaimNumber", - "lawsuits.number": "alias.LawsuitNumber", - "contracts.number": "alias.ContractNumber" } diff --git a/bin/templates/configs_/crud_functions_rename.json b/bin/templates/configs_/crud_functions_rename.json index 10c97af..7a73a41 100644 --- a/bin/templates/configs_/crud_functions_rename.json +++ b/bin/templates/configs_/crud_functions_rename.json @@ -1,8 +1,2 @@ { - "lawsuits": [ - { - "old": "create_update_ctx", - "new": "create_update_ctx_original" - } - ] } \ No newline at end of file diff --git a/bin/templates/configs_/crud_functions_rename_test.json b/bin/templates/configs_/crud_functions_rename_test.json deleted file mode 100644 index 10c97af..0000000 --- a/bin/templates/configs_/crud_functions_rename_test.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "lawsuits": [ - { - "old": "create_update_ctx", - "new": "create_update_ctx_original" - } - ] -} \ No newline at end of file diff --git a/bin/templates/configs_/model_crud_delete_functions.json b/bin/templates/configs_/model_crud_delete_functions.json index d8c0ee0..2c63c08 100644 --- a/bin/templates/configs_/model_crud_delete_functions.json +++ b/bin/templates/configs_/model_crud_delete_functions.json @@ -1,3 +1,2 @@ { - "lawsuits": "NewLawsuit,AsLawsuit,create_update_ctx" } diff --git a/bin/templates/configs_/name_replace.json b/bin/templates/configs_/name_replace.json index cab0526..7a73a41 100644 --- a/bin/templates/configs_/name_replace.json +++ b/bin/templates/configs_/name_replace.json @@ -1,19 +1,2 @@ { - "inn": "INN", - "kpp": "KPP", - "okpo": "OKPO", - "ogrn": "OGRN", - "okato": "OKATO", - "nsi_flat": "NSIFlat", - "nsi_flat_id": "NSIFlatID", - "nsi_id": "NSIID", - "www": "WWW", - "bik": "BIK", - "city_name": "City", - "edms_link": "EDMSLink", - "code_nsi": "CodeNSI", - "json_updated_at": "JSONUpdatedAt", - "pdf_updated_at": "PDFUpdatedAt", - "pdf_file_id": "PDFFileID", - "json_file_id": "JSONFileID" } \ No newline at end of file diff --git a/bin/templates/configs_/nullable.json b/bin/templates/configs_/nullable.json index 3f0a502..2c63c08 100644 --- a/bin/templates/configs_/nullable.json +++ b/bin/templates/configs_/nullable.json @@ -1,4 +1,2 @@ { - "ext_id": true, - "created_at": false } diff --git a/bin/templates/configs_/settings.txt b/bin/templates/configs_/settings.txt index 6647da1..667ff6b 100644 --- a/bin/templates/configs_/settings.txt +++ b/bin/templates/configs_/settings.txt @@ -21,15 +21,15 @@ DB_PASSWORD= INCLUDE_TABLES="" #INCLUDE_TABLES - table name ignore filter. Regular expression -EXCLUDE_TABLES="ext_" +EXCLUDE_TABLES= #---------------------Template settings--------------------- #SERVICE_REPOSITORY_URL - URL of your new service repository (Github, gitlab, etc.) -SERVICE_REPOSITORY_URL="gitlab.aescorp.ru/dsp_dev/claim/sync_service" +SERVICE_REPOSITORY_URL="gitlab.aescorp.ru/dsp_dev/claim/crud_service" #SERVICE_NAME - service name for your new service -SERVICE_NAME=sync_service +SERVICE_NAME=crud_service #TEMPLATE_SERVICE_NAME - service name in your template files TEMPLATE_SERVICE_NAME=sync_service @@ -96,7 +96,7 @@ TEXT_TEMPLATE_TABLENAME="lawsuit_status_types" USE_DEFAULT_TEMPLATE=true #HAS_IS_DELETED - fill "true" if you have "is_deleted" column, and want Delete() Restore() functions. -HAS_IS_DELETED=true +HAS_IS_DELETED=false #---------------------Create files settings--------------------- diff --git a/bin/templates/internal/app/grpc/server_grpc/server_grpc_test.go_ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_test.go_ index 3457d7b..5ad483a 100644 --- a/bin/templates/internal/app/grpc/server_grpc/server_grpc_test.go_ +++ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_test.go_ @@ -7,6 +7,7 @@ import ( "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_proto" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "testing" + "math" ) // LawsuitStatusType_ID_Test - ID таблицы для тестирования @@ -37,7 +38,7 @@ func Test_server_LawsuitStatusType_Delete(t *testing.T) { ctx := context.Background() Request := grpc_proto.RequestId{} - Request.Id = LawsuitStatusType_ID_Test + Request.Id = math.MinInt64 Request.VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion() server1 := &ServerGRPC{} diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_test.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_test.go_ index ad385b8..261d9a4 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_test.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_test.go_ @@ -4,6 +4,7 @@ import ( config "github.com/ManyakRus/starter/config_main" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" + "math" "testing" ) @@ -110,44 +111,11 @@ func TestDelete(t *testing.T) { crud := Crud_GRPC{} Otvet := lawsuit_status_types.LawsuitStatusType{} - Otvet.ID = Postgres_ID_Test - err := crud.Read(&Otvet) + Otvet.ID = math.MinInt64 + + err := crud.Delete(&Otvet) if err != nil { - t.Error("TestRead() error: ", err) - } - - if Otvet.IsDeleted == false { - err = crud.Delete(&Otvet) - if err != nil { - t.Error("TestDelete() error: ", err) - } - if Otvet.ID == 0 { - t.Error("TestDelete() error: ID =0") - } - - err = crud.Restore(&Otvet) - if err != nil { - t.Error("TestDelete() error: ", err) - } - if Otvet.ID == 0 { - t.Error("TestDelete() error: ID =0") - } - } else { - err = crud.Restore(&Otvet) - if err != nil { - t.Error("TestDelete() error: ", err) - } - if Otvet.ID == 0 { - t.Error("TestDelete() error: ID =0") - } - - err = crud.Delete(&Otvet) - if err != nil { - t.Error("TestDelete() error: ", err) - } - if Otvet.ID == 0 { - t.Error("TestDelete() error: ID =0") - } + t.Error("TestDelete() error: ", err) } } diff --git a/bin/templates/pkg/network/nrpc/nrpc_client/nrpc_client_table_test.go_ b/bin/templates/pkg/network/nrpc/nrpc_client/nrpc_client_table_test.go_ index f28599b..2a096d3 100644 --- a/bin/templates/pkg/network/nrpc/nrpc_client/nrpc_client_table_test.go_ +++ b/bin/templates/pkg/network/nrpc/nrpc_client/nrpc_client_table_test.go_ @@ -5,6 +5,7 @@ import ( "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/nrpc/nrpc_client" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "testing" + "math" ) // Postgres_ID_Test - ID таблицы для тестирования @@ -110,44 +111,10 @@ func TestDelete(t *testing.T) { crud := Crud_NRPC{} Otvet := lawsuit_status_types.LawsuitStatusType{} - Otvet.ID = Postgres_ID_Test - err := crud.Read(&Otvet) + Otvet.ID = math.MinInt64 + err := crud.Delete(&Otvet) if err != nil { - t.Error("TestRead() error: ", err) - } - - if Otvet.IsDeleted == false { - err = crud.Delete(&Otvet) - if err != nil { - t.Error("TestDelete() error: ", err) - } - if Otvet.ID == 0 { - t.Error("TestDelete() error: ID =0") - } - - err = crud.Restore(&Otvet) - if err != nil { - t.Error("TestDelete() error: ", err) - } - if Otvet.ID == 0 { - t.Error("TestDelete() error: ID =0") - } - } else { - err = crud.Restore(&Otvet) - if err != nil { - t.Error("TestDelete() error: ", err) - } - if Otvet.ID == 0 { - t.Error("TestDelete() error: ID =0") - } - - err = crud.Delete(&Otvet) - if err != nil { - t.Error("TestDelete() error: ", err) - } - if Otvet.ID == 0 { - t.Error("TestDelete() error: ID =0") - } + t.Error("TestDelete() error: ", err) } }