unit, unit-position,installation-position removes ids
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Installation_Id *uint16 `json:"installation_id" gorm:"not null"`
|
||||
Installation_Code *string `json:"installation_code" gorm:"size:10"`
|
||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:30;not null"`
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Installation_Id *uint16 `json:"installation_id" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Installation_Code *string `json:"installation_code" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,26 +22,27 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Installation_Id *uint16 `json:"installation-id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Installation_Code *string `json:"installation-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -52,24 +53,24 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Installation *ei.Installation `json:"installation,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
Installation_Code *string `json:"installation_code"`
|
||||
Installation *ei.Installation `json:"installation,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
}
|
||||
|
||||
func (d InstallationPosition) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Installation_Id: d.Installation_Id,
|
||||
Installation: d.Installation,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
Installation_Code: d.Installation_Code,
|
||||
Installation: d.Installation,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
type InstallationPosition struct {
|
||||
eib.Basic // adjust this according to the needs
|
||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -11,5 +11,5 @@ type Installation struct {
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"`
|
||||
InstallationPositions []eipb.Basic `json:"installationPositions,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
||||
InstallationPositions []eipb.Basic `json:"installationPositions,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Unit_Id *uint16 `json:"unit_id" gorm:"not null"`
|
||||
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:30;not null"`
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Unit_Id *uint16 `json:"unit_id" validate:"required"`
|
||||
Unit_Code *string `json:"unit_code" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
@@ -22,7 +22,7 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Unit_Id *uint16 `json:"unit-id"`
|
||||
Unit_Code *string `json:"unit-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
@@ -31,17 +31,18 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -52,7 +53,7 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
@@ -63,7 +64,7 @@ type ResponseDto struct {
|
||||
|
||||
func (d UnitPosition) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit_Code: d.Unit_Code,
|
||||
Unit: d.Unit,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Installation_Code *string `json:"installation_code"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -20,26 +20,27 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Installation_Id *uint16 `json:"installation-id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Installation_Code *string `json:"installation-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
Id *uint16 `json:"id"`
|
||||
Installation_Code *string `json:"installation_code"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -50,19 +51,19 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Installation *ei.Installation `json:"installation,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
UnitPositions []eipb.Basic `json:"unitPositions,omitempty"`
|
||||
Installation_Code *string `json:"installation_code"`
|
||||
Installation *ei.Installation `json:"installation,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
UnitPositions []eipb.Basic `json:"unitPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Unit) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Installation_Id: d.Installation_Id,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
UnitPositions: d.UnitPositions,
|
||||
Installation_Code: d.Installation_Code,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
UnitPositions: d.UnitPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
if d.Installation != nil {
|
||||
|
||||
@@ -9,11 +9,10 @@ import (
|
||||
|
||||
type Unit struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Installation_Code *string `json:"installation_code" gorm:"size:10"`
|
||||
Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Id"`
|
||||
Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Code;references:Code"`
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Type_Code *ero.UnitTypeCode `json:"type_code"`
|
||||
UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user