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_/convert_id_rapira.json b/bin/templates/configs_/convert_id_rapira.json new file mode 100644 index 0000000..e12763f --- /dev/null +++ b/bin/templates/configs_/convert_id_rapira.json @@ -0,0 +1,14 @@ +{ + "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_rapira.json b/bin/templates/configs_/crud_functions_rename_rapira.json new file mode 100644 index 0000000..10c97af --- /dev/null +++ b/bin/templates/configs_/crud_functions_rename_rapira.json @@ -0,0 +1,8 @@ +{ + "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_/model_crud_delete_functions_rapira.json b/bin/templates/configs_/model_crud_delete_functions_rapira.json new file mode 100644 index 0000000..d8c0ee0 --- /dev/null +++ b/bin/templates/configs_/model_crud_delete_functions_rapira.json @@ -0,0 +1,3 @@ +{ + "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_/name_replace_rapira.json b/bin/templates/configs_/name_replace_rapira.json new file mode 100644 index 0000000..cab0526 --- /dev/null +++ b/bin/templates/configs_/name_replace_rapira.json @@ -0,0 +1,19 @@ +{ + "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..85b8458 100644 --- a/bin/templates/configs_/nullable.json +++ b/bin/templates/configs_/nullable.json @@ -1,4 +1,3 @@ { - "ext_id": true, "created_at": false } diff --git a/bin/templates/configs_/nullable_rapira.json b/bin/templates/configs_/nullable_rapira.json new file mode 100644 index 0000000..3f0a502 --- /dev/null +++ b/bin/templates/configs_/nullable_rapira.json @@ -0,0 +1,4 @@ +{ + "ext_id": true, + "created_at": false +} diff --git a/bin/templates/configs_/settings.txt b/bin/templates/configs_/settings.txt index cffd8ea..45f1899 100644 --- a/bin/templates/configs_/settings.txt +++ b/bin/templates/configs_/settings.txt @@ -179,4 +179,19 @@ NEED_CREATE_UPDATE_EVERY_COLUMN=true TEMPLATES_CRUD_TABLE_UPDATE_FUNC_FILENAME="crud_table_update_func.go_" #TEMPLATES_CRUD_TABLE_UPDATE_FUNC_TEST_FILENAME - short filename of "crud_table_update_func_test.go_" file -TEMPLATES_CRUD_TABLE_UPDATE_FUNC_TEST_FILENAME="crud_table_update_func_test.go_" \ No newline at end of file +TEMPLATES_CRUD_TABLE_UPDATE_FUNC_TEST_FILENAME="crud_table_update_func_test.go_" + +#TEMPLATES_CONVERT_ID_FILENAME - short filename of "convert_id.json" file +TEMPLATES_CONVERT_ID_FILENAME="convert_id.json" + +#TEMPLATES_CRUD_FUNCTIONS_RENAME_FILENAME - short filename of "crud_functions_rename.json" file +TEMPLATES_CRUD_FUNCTIONS_RENAME_FILENAME="crud_functions_rename.json" + +#TEMPLATES_MODEL_CRUD_DELETE_FUNCTIONS_FILENAME - short filename of "model_crud_delete_functions.json" file +TEMPLATES_MODEL_CRUD_DELETE_FUNCTIONS_FILENAME="model_crud_delete_functions.json" + +#TEMPLATES_NAME_REPLACE_FILENAME - short filename of "name_replace.json" file +TEMPLATES_NAME_REPLACE_FILENAME="name_replace.json" + +#TEMPLATES_NULLABLE_FILENAME - short filename of "nullable.json" file +TEMPLATES_NULLABLE_FILENAME="nullable.json" \ No newline at end of file diff --git a/internal/config/config.go b/internal/config/config.go index 0442e98..6bdffa3 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -41,6 +41,11 @@ type SettingsINI struct { TEMPLATES_ALIAS_FILENAME string TEMPLATES_CRUD_TABLE_UPDATE_FUNC_FILENAME string TEMPLATES_CRUD_TABLE_UPDATE_FUNC_TEST_FILENAME string + TEMPLATES_CONVERT_ID_FILENAME string + TEMPLATES_CRUD_FUNCTIONS_RENAME_FILENAME string + TEMPLATES_MODEL_CRUD_DELETE_FUNCTIONS_FILENAME string + TEMPLATES_NAME_REPLACE_FILENAME string + TEMPLATES_NULLABLE_FILENAME string NEED_CREATE_MODEL_STRUCT bool NEED_CREATE_MODEL_CRUD bool NEED_CREATE_DB bool @@ -185,7 +190,11 @@ func FillSettings() { Settings.PREFIX_CLIENT_GRPC = os.Getenv("PREFIX_CLIENT_GRPC") Settings.TEMPLATES_CRUD_TABLE_UPDATE_FUNC_FILENAME = os.Getenv("TEMPLATES_CRUD_TABLE_UPDATE_FUNC_FILENAME") Settings.TEMPLATES_CRUD_TABLE_UPDATE_FUNC_TEST_FILENAME = os.Getenv("TEMPLATES_CRUD_TABLE_UPDATE_FUNC_TEST_FILENAME") - + Settings.TEMPLATES_CONVERT_ID_FILENAME = os.Getenv("TEMPLATES_CONVERT_ID_FILENAME") + Settings.TEMPLATES_CRUD_FUNCTIONS_RENAME_FILENAME = os.Getenv("TEMPLATES_CRUD_FUNCTIONS_RENAME_FILENAME") + Settings.TEMPLATES_MODEL_CRUD_DELETE_FUNCTIONS_FILENAME = os.Getenv("TEMPLATES_MODEL_CRUD_DELETE_FUNCTIONS_FILENAME") + Settings.TEMPLATES_NAME_REPLACE_FILENAME = os.Getenv("TEMPLATES_NAME_REPLACE_FILENAME") + Settings.TEMPLATES_NULLABLE_FILENAME = os.Getenv("TEMPLATES_NULLABLE_FILENAME") } // CurrentDirectory - возвращает текущую директорию ОС diff --git a/internal/load_configs/load_configs.go b/internal/load_configs/load_configs.go index ce40668..8559d8f 100644 --- a/internal/load_configs/load_configs.go +++ b/internal/load_configs/load_configs.go @@ -38,7 +38,7 @@ func LoadMappings() { // LoadNameReplace - загружает маппинг ТипБД = ТипGolang, из файла .json func LoadNameReplace() { dir := micro.ProgramDir_bin() - FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + "name_replace.json" + FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + config.Settings.TEMPLATES_NAME_REPLACE_FILENAME var err error @@ -61,7 +61,7 @@ func LoadNameReplace() { // LoadNullable - загружает список полей которые могут быть null func LoadNullable() { dir := micro.ProgramDir_bin() - FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + "nullable.json" + FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + config.Settings.TEMPLATES_NULLABLE_FILENAME var err error @@ -120,7 +120,7 @@ func Load_TEXT_DB_IS_DELETED() { // LoadConvertID - загружает map: ИмяТаблицы:Тип func LoadConvertID() { dir := micro.ProgramDir_bin() - FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + "convert_id.json" + FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + config.Settings.TEMPLATES_CONVERT_ID_FILENAME var err error @@ -143,7 +143,7 @@ func LoadConvertID() { // LoadMapModelCrudDeleteFunctions - загружает map ИмяТаблицыPostgres:ИмяФункцииGolang func LoadMapModelCrudDeleteFunctions() { dir := micro.ProgramDir_bin() - FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + "model_crud_delete_functions.json" + FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + config.Settings.TEMPLATES_MODEL_CRUD_DELETE_FUNCTIONS_FILENAME var err error @@ -184,7 +184,7 @@ func Load_TEXT_DB_CREATED_AT() { // LoadCrudFunctionsRename - загружает маппинг ИмяТаблицы:{old:"",new:""} func LoadCrudFunctionsRename() { dir := micro.ProgramDir_bin() - FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + "crud_functions_rename.json" + FileName := dir + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + constants.CONFIG_FOLDER_NAME + micro.SeparatorFile() + config.Settings.TEMPLATES_CRUD_FUNCTIONS_RENAME_FILENAME var err error