Merge branch 'migration' of github.com:dikstub-rssa/simrs-be into feat/crud
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package ethnic
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
NoPagination int `json:"no_pagination"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
PageNumber int `json:"page_number"`
|
||||
PageSize int `json:"page_size"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (d Ethnic) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []Ethnic) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package ethnic
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
|
||||
type Ethnic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package insurancecompany
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
er "simrs-vx/internal/domain/main-entities/regency"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Regency_Code *string `json:"regency_code"`
|
||||
Address string `json:"address"`
|
||||
PhoneNumber string `json:"phoneNumber"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Regency_Code *string `json:"regency_code"`
|
||||
Address string `json:"address"`
|
||||
PhoneNumber string `json:"phoneNumber"`
|
||||
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
NoPagination int `json:"no_pagination"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Regency_Code *string `json:"regency_code"`
|
||||
Address string `json:"address"`
|
||||
PhoneNumber string `json:"phoneNumber"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
PageNumber int `json:"page_number"`
|
||||
PageSize int `json:"page_size"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Regency_Code *string `json:"regency_code"`
|
||||
Regency *er.Regency `json:"regency,omitempty"`
|
||||
Address string `json:"address"`
|
||||
PhoneNumber string `json:"phoneNumber"`
|
||||
}
|
||||
|
||||
func (d InsuranceCompany) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Regency_Code: d.Regency_Code,
|
||||
Regency: d.Regency,
|
||||
Address: d.Address,
|
||||
PhoneNumber: d.PhoneNumber,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []InsuranceCompany) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package insurancecompany
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
er "simrs-vx/internal/domain/main-entities/regency"
|
||||
)
|
||||
|
||||
type InsuranceCompany struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Regency_Code *string `json:"regency_code" gorm:"size:4"`
|
||||
Regency *er.Regency `json:"regency,omitempty" gorm:"foreignKey:Regency_Code;references:Code"`
|
||||
Address string `json:"address" gorm:"size:100"`
|
||||
PhoneNumber string `json:"phoneNumber" gorm:"size:20"`
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package person
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/ethnic"
|
||||
epa "simrs-vx/internal/domain/main-entities/person-address"
|
||||
epc "simrs-vx/internal/domain/main-entities/person-contact"
|
||||
erp "simrs-vx/internal/domain/references/person"
|
||||
@@ -18,7 +19,7 @@ type CreateDto struct {
|
||||
Education_Code *erp.EducationCode `json:"education_code"`
|
||||
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
|
||||
Ocupation_Name *string `json:"occupation_name"`
|
||||
Ethnic_Code *erp.EthnicCode `json:"ethnic_code"`
|
||||
Ethnic_Code *string `json:"ethnic_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -38,7 +39,7 @@ type ReadDetailDto struct {
|
||||
Education_Code *erp.EducationCode `json:"education_code"`
|
||||
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
|
||||
Ocupation_Name *string `json:"occupation_name"`
|
||||
Ethnic_Code *erp.EthnicCode `json:"ethnic_code"`
|
||||
Ethnic_Code *string `json:"ethnic_code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -67,7 +68,8 @@ type ResponseDto struct {
|
||||
Education_Code *erp.EducationCode `json:"education_code"`
|
||||
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
|
||||
Ocupation_Name *string `json:"occupation_name"`
|
||||
Ethnic_Code *erp.EthnicCode `json:"ethnic_code"`
|
||||
Ethnic_Code *string `json:"ethnic_code"`
|
||||
Ethnic *ee.Ethnic `json:"ethnic,omitempty"`
|
||||
Addresses *[]epa.PersonAddress `json:"addresses,omitempty"`
|
||||
Contacts *[]epc.PersonContact `json:"contacts,omitempty"`
|
||||
}
|
||||
@@ -84,6 +86,7 @@ func (d *Person) ToResponse() ResponseDto {
|
||||
Ocupation_Code: d.Ocupation_Code,
|
||||
Ocupation_Name: d.Ocupation_Name,
|
||||
Ethnic_Code: d.Ethnic_Code,
|
||||
Ethnic: d.Ethnic,
|
||||
Addresses: d.Addresses,
|
||||
Contacts: d.Contacts,
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package person
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/ethnic"
|
||||
epa "simrs-vx/internal/domain/main-entities/person-address"
|
||||
epc "simrs-vx/internal/domain/main-entities/person-contact"
|
||||
erp "simrs-vx/internal/domain/references/person"
|
||||
@@ -20,7 +21,8 @@ type Person struct {
|
||||
Education_Code *erp.EducationCode `json:"education_code" gorm:"size:10"`
|
||||
Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"`
|
||||
Ocupation_Name *string `json:"occupation_name" gorm:"size:50"`
|
||||
Ethnic_Code *erp.EthnicCode `json:"ethnic_code" gorm:"size:15"`
|
||||
Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"`
|
||||
Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"`
|
||||
Addresses *[]epa.PersonAddress `json:"addresses" gorm:"foreignKey:Person_Id"`
|
||||
Contacts *[]epc.PersonContact `json:"contacts" gorm:"foreignKey:Person_Id"`
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ type (
|
||||
AgeGroupForMedicineCode string
|
||||
RelativeCode string
|
||||
ContactTypeCode string
|
||||
EthnicCode string
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -12,9 +12,11 @@ import (
|
||||
divisionposition "simrs-vx/internal/domain/main-entities/division-position"
|
||||
doctor "simrs-vx/internal/domain/main-entities/doctor"
|
||||
employee "simrs-vx/internal/domain/main-entities/employee"
|
||||
ethnic "simrs-vx/internal/domain/main-entities/ethnic"
|
||||
infra "simrs-vx/internal/domain/main-entities/infra"
|
||||
infragroup "simrs-vx/internal/domain/main-entities/infra-group"
|
||||
installation "simrs-vx/internal/domain/main-entities/installation"
|
||||
insurancecompany "simrs-vx/internal/domain/main-entities/insurance-company"
|
||||
item "simrs-vx/internal/domain/main-entities/item"
|
||||
itemgroup "simrs-vx/internal/domain/main-entities/item-group"
|
||||
itemprice "simrs-vx/internal/domain/main-entities/item-price"
|
||||
@@ -103,6 +105,8 @@ func GetEntities() []any {
|
||||
&medicinemethod.MedicineMethod{},
|
||||
&mcusrccategory.McuSrcCategory{},
|
||||
&mcusrc.McuSrc{},
|
||||
ðnic.Ethnic{},
|
||||
&insurancecompany.InsuranceCompany{},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user