1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-22 00:36:41 +02:00

сделал ./crud_functions_rename.json

This commit is contained in:
Nikitin Aleksandr 2024-01-09 13:49:05 +03:00
parent 1965956ffa
commit 5c6452cd6d
11 changed files with 16 additions and 127 deletions

View File

@ -5,8 +5,7 @@ FILEMAIN=./cmd/$(SERVICENAME)/main.go
FILEAPP=./bin/$(SERVICENAME) FILEAPP=./bin/$(SERVICENAME)
NEW_REPO=$(SERVICENAME) NEW_REPO=$(SERVICENAME)
CD_GENERATION_PROTO=cd ./api GENERATION_PROTO=cd ./api && ./generation_code.sh
GENERATION_PROTO=generation_code.sh
run: run:
@ -54,7 +53,6 @@ conn:
init: init:
clear clear
go mod init gitlab.aescorp.ru/dsp_dev/claim/sync_service go mod init gitlab.aescorp.ru/dsp_dev/claim/sync_service
$(CD_GENERATION_PROTO)
$(GENERATION_PROTO) $(GENERATION_PROTO)
go mod tidy go mod tidy
go mod vendor go mod vendor

View File

@ -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"
} }

View File

@ -1,8 +1,2 @@
{ {
"lawsuits": [
{
"old": "create_update_ctx",
"new": "create_update_ctx_original"
}
]
} }

View File

@ -1,8 +0,0 @@
{
"lawsuits": [
{
"old": "create_update_ctx",
"new": "create_update_ctx_original"
}
]
}

View File

@ -1,3 +1,2 @@
{ {
"lawsuits": "NewLawsuit,AsLawsuit,create_update_ctx"
} }

View File

@ -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"
} }

View File

@ -1,4 +1,2 @@
{ {
"ext_id": true,
"created_at": false
} }

View File

@ -21,15 +21,15 @@ DB_PASSWORD=
INCLUDE_TABLES="" INCLUDE_TABLES=""
#INCLUDE_TABLES - table name ignore filter. Regular expression #INCLUDE_TABLES - table name ignore filter. Regular expression
EXCLUDE_TABLES="ext_" EXCLUDE_TABLES=
#---------------------Template settings--------------------- #---------------------Template settings---------------------
#SERVICE_REPOSITORY_URL - URL of your new service repository (Github, gitlab, etc.) #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 - 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 - service name in your template files
TEMPLATE_SERVICE_NAME=sync_service TEMPLATE_SERVICE_NAME=sync_service
@ -96,7 +96,7 @@ TEXT_TEMPLATE_TABLENAME="lawsuit_status_types"
USE_DEFAULT_TEMPLATE=true USE_DEFAULT_TEMPLATE=true
#HAS_IS_DELETED - fill "true" if you have "is_deleted" column, and want Delete() Restore() functions. #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--------------------- #---------------------Create files settings---------------------

View File

@ -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/network/grpc/grpc_proto"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
"testing" "testing"
"math"
) )
// LawsuitStatusType_ID_Test - ID таблицы для тестирования // LawsuitStatusType_ID_Test - ID таблицы для тестирования
@ -37,7 +38,7 @@ func Test_server_LawsuitStatusType_Delete(t *testing.T) {
ctx := context.Background() ctx := context.Background()
Request := grpc_proto.RequestId{} Request := grpc_proto.RequestId{}
Request.Id = LawsuitStatusType_ID_Test Request.Id = math.MinInt64
Request.VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion() Request.VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion()
server1 := &ServerGRPC{} server1 := &ServerGRPC{}

View File

@ -4,6 +4,7 @@ import (
config "github.com/ManyakRus/starter/config_main" 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/network/grpc/grpc_client"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
"math"
"testing" "testing"
) )
@ -110,45 +111,12 @@ func TestDelete(t *testing.T) {
crud := Crud_GRPC{} crud := Crud_GRPC{}
Otvet := lawsuit_status_types.LawsuitStatusType{} Otvet := lawsuit_status_types.LawsuitStatusType{}
Otvet.ID = Postgres_ID_Test Otvet.ID = math.MinInt64
err := crud.Read(&Otvet)
if err != nil {
t.Error("TestRead() error: ", err)
}
if Otvet.IsDeleted == false { err := crud.Delete(&Otvet)
err = crud.Delete(&Otvet)
if err != nil { if err != nil {
t.Error("TestDelete() error: ", err) 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")
}
}
} }
func TestFindByExtID(t *testing.T) { func TestFindByExtID(t *testing.T) {

View File

@ -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/network/nrpc/nrpc_client"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
"testing" "testing"
"math"
) )
// Postgres_ID_Test - ID таблицы для тестирования // Postgres_ID_Test - ID таблицы для тестирования
@ -110,45 +111,11 @@ func TestDelete(t *testing.T) {
crud := Crud_NRPC{} crud := Crud_NRPC{}
Otvet := lawsuit_status_types.LawsuitStatusType{} Otvet := lawsuit_status_types.LawsuitStatusType{}
Otvet.ID = Postgres_ID_Test Otvet.ID = math.MinInt64
err := crud.Read(&Otvet) err := crud.Delete(&Otvet)
if err != nil {
t.Error("TestRead() error: ", err)
}
if Otvet.IsDeleted == false {
err = crud.Delete(&Otvet)
if err != nil { if err != nil {
t.Error("TestDelete() error: ", err) 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")
}
}
} }
func TestFindByExtID(t *testing.T) { func TestFindByExtID(t *testing.T) {