Merge pull request #109 from dikstub-rssa/feat/functional-position-100
Feat/functional position 100
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
-- Modify "Employee" table
|
||||||
|
ALTER TABLE "public"."Employee" DROP COLUMN "Division_Code";
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
h1:iDCRTkq1AjDg/YtmmPXwu6TAXJeoXQuXfDZG99Pi6cY=
|
h1:ieMeKh35/dro1YBBO11ZP0nZan9aJ5aFSqnEAi+T+WQ=
|
||||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||||
@@ -56,4 +56,5 @@ h1:iDCRTkq1AjDg/YtmmPXwu6TAXJeoXQuXfDZG99Pi6cY=
|
|||||||
20251021041042.sql h1:wMgSivBV2A0NDcsLmKGIp0kMcVh2IODSG9b4dgzCaOM=
|
20251021041042.sql h1:wMgSivBV2A0NDcsLmKGIp0kMcVh2IODSG9b4dgzCaOM=
|
||||||
20251021075552.sql h1:8gfSMAglflNO6L0sSzxFNEubYN8/O4thT7OQT+WH+3M=
|
20251021075552.sql h1:8gfSMAglflNO6L0sSzxFNEubYN8/O4thT7OQT+WH+3M=
|
||||||
20251023044432.sql h1:MkvajJs3bfk9+wHvQ43/ccAluJEBARm1gWr1u92ccLA=
|
20251023044432.sql h1:MkvajJs3bfk9+wHvQ43/ccAluJEBARm1gWr1u92ccLA=
|
||||||
20251024034832.sql h1:SoqYFfkaTTiY18PWY+l8+dqUlZtCUjSsbC0L1swsD3s=
|
20251024034832.sql h1:x3s3VEVYLOSKLAFxJGb2+c1FyTMMvPE+9k4Ew7rKQaI=
|
||||||
|
20251024074315.sql h1:EjAjelgi5qAfcRq/8vPTlGGYHvAKxNTllm8f0SzZDns=
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Basic struct {
|
||||||
|
ecore.SmallMain // adjust this according to the needs
|
||||||
|
Division_Id *uint16 `json:"division_id"`
|
||||||
|
Code string `json:"code" gorm:"unique;size:10"`
|
||||||
|
Name string `json:"name" gorm:"size:50"`
|
||||||
|
HeadStatus bool `json:"headStatus"`
|
||||||
|
Employee_Id *uint `json:"employee_id"`
|
||||||
|
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Basic) TableName() string {
|
||||||
|
return "DivisionPosition"
|
||||||
|
}
|
||||||
@@ -1,18 +1,11 @@
|
|||||||
package divisionposition
|
package divisionposition
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
||||||
ed "simrs-vx/internal/domain/main-entities/division"
|
ed "simrs-vx/internal/domain/main-entities/division"
|
||||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
eb "simrs-vx/internal/domain/main-entities/division-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DivisionPosition struct {
|
type DivisionPosition struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
eb.Basic
|
||||||
Division_Id *uint16 `json:"division_id"`
|
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"`
|
||||||
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"`
|
|
||||||
Code string `json:"code" gorm:"unique;size:10"`
|
|
||||||
Name string `json:"name" gorm:"size:50"`
|
|
||||||
HeadStatus bool `json:"headStatus"`
|
|
||||||
Employee_Id *uint `json:"employee_id"`
|
|
||||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package division
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
edpb "simrs-vx/internal/domain/main-entities/division-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
@@ -26,8 +27,9 @@ type FilterDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint16 `json:"id"`
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
@@ -47,20 +49,22 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.SmallMain
|
ecore.SmallMain
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Parent_Id *uint16 `json:"parent_id"`
|
Parent_Id *uint16 `json:"parent_id"`
|
||||||
Parent *Division `json:"parent,omitempty"`
|
Parent *Division `json:"parent,omitempty"`
|
||||||
Childrens []Division `json:"childrens,omitempty"`
|
Childrens []Division `json:"childrens,omitempty"`
|
||||||
|
DivisionPosition []edpb.Basic `json:"divisionPositions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Division) ToResponse() ResponseDto {
|
func (d Division) ToResponse() ResponseDto {
|
||||||
resp := ResponseDto{
|
resp := ResponseDto{
|
||||||
Code: d.Code,
|
Code: d.Code,
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
Parent_Id: d.Parent_Id,
|
Parent_Id: d.Parent_Id,
|
||||||
Parent: d.Parent,
|
Parent: d.Parent,
|
||||||
Childrens: d.Childrens,
|
Childrens: d.Childrens,
|
||||||
|
DivisionPosition: d.DivisionPositions,
|
||||||
}
|
}
|
||||||
resp.SmallMain = d.SmallMain
|
resp.SmallMain = d.SmallMain
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ package division
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
edpb "simrs-vx/internal/domain/main-entities/division-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Division struct {
|
type Division struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Code string `json:"code" gorm:"unique;size:10"`
|
Code string `json:"code" gorm:"unique;size:10"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
Parent_Id *uint16 `json:"parent_id"`
|
Parent_Id *uint16 `json:"parent_id"`
|
||||||
Parent *Division `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"`
|
Parent *Division `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"`
|
||||||
Childrens []Division `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self
|
Childrens []Division `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self
|
||||||
|
DivisionPositions []edpb.Basic `json:"divisionPositions,omitempty" gorm:"foreignKey:Division_Id;references:Id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,16 @@ package employee
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
ed "simrs-vx/internal/domain/main-entities/division"
|
|
||||||
ep "simrs-vx/internal/domain/main-entities/person"
|
ep "simrs-vx/internal/domain/main-entities/person"
|
||||||
eu "simrs-vx/internal/domain/main-entities/user"
|
eu "simrs-vx/internal/domain/main-entities/user"
|
||||||
erg "simrs-vx/internal/domain/references/organization"
|
|
||||||
|
|
||||||
erc "simrs-vx/internal/domain/references/common"
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
erg "simrs-vx/internal/domain/references/organization"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
User_Id *uint `json:"user_id"`
|
User_Id *uint `json:"user_id"`
|
||||||
Person_Id *uint `json:"person_id"`
|
Person_Id *uint `json:"person_id"`
|
||||||
Division_Code *string `json:"division_code"`
|
|
||||||
Number *string `json:"number" validate:"maxLength=20"`
|
Number *string `json:"number" validate:"maxLength=20"`
|
||||||
Status_Code erc.ActiveStatusCode `json:"status_code" validate:"maxLength=10"`
|
Status_Code erc.ActiveStatusCode `json:"status_code" validate:"maxLength=10"`
|
||||||
Position_Code *erg.EmployeePositionCode `json:"position_code"`
|
Position_Code *erg.EmployeePositionCode `json:"position_code"`
|
||||||
@@ -28,7 +26,6 @@ type ReadListDto struct {
|
|||||||
type FilterDto struct {
|
type FilterDto struct {
|
||||||
User_Id *uint `json:"user-id"`
|
User_Id *uint `json:"user-id"`
|
||||||
Person_Id *uint `json:"person-id"`
|
Person_Id *uint `json:"person-id"`
|
||||||
Division_Code *string `json:"division-code"`
|
|
||||||
Position_Code *string `json:"position-code"`
|
Position_Code *string `json:"position-code"`
|
||||||
Number *string `json:"number"`
|
Number *string `json:"number"`
|
||||||
Status_Code erc.ActiveStatusCode `json:"status-code"`
|
Status_Code erc.ActiveStatusCode `json:"status-code"`
|
||||||
@@ -58,28 +55,22 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.Main
|
ecore.Main
|
||||||
User_Id *uint `json:"user_id"`
|
User_Id *uint `json:"user_id"`
|
||||||
User *eu.User `json:"user,omitempty"`
|
User *eu.User `json:"user,omitempty"`
|
||||||
Person_Id *uint `json:"person_id"`
|
Person_Id *uint `json:"person_id"`
|
||||||
Person *ep.Person `json:"person,omitempty"`
|
Person *ep.Person `json:"person,omitempty"`
|
||||||
Division_Code *string `json:"division_code"`
|
Number *string `json:"number"`
|
||||||
Division *ed.Division `json:"division,omitempty"`
|
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
||||||
Position_Code *erg.EmployeePositionCode `json:"position_code"`
|
|
||||||
Number *string `json:"number"`
|
|
||||||
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Employee) ToResponse() ResponseDto {
|
func (d Employee) ToResponse() ResponseDto {
|
||||||
resp := ResponseDto{
|
resp := ResponseDto{
|
||||||
User_Id: d.User_Id,
|
User_Id: d.User_Id,
|
||||||
User: d.User,
|
User: d.User,
|
||||||
Person_Id: d.Person_Id,
|
Person_Id: d.Person_Id,
|
||||||
Person: d.Person,
|
Person: d.Person,
|
||||||
Division_Code: d.Division_Code,
|
Number: d.Number,
|
||||||
Division: d.Division,
|
Status_Code: d.Status_Code,
|
||||||
Number: d.Number,
|
|
||||||
Status_Code: d.Status_Code,
|
|
||||||
Position_Code: d.Position_Code,
|
|
||||||
}
|
}
|
||||||
resp.Main = d.Main
|
resp.Main = d.Main
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package employee
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
ed "simrs-vx/internal/domain/main-entities/division"
|
|
||||||
ep "simrs-vx/internal/domain/main-entities/person"
|
ep "simrs-vx/internal/domain/main-entities/person"
|
||||||
eu "simrs-vx/internal/domain/main-entities/user"
|
eu "simrs-vx/internal/domain/main-entities/user"
|
||||||
erc "simrs-vx/internal/domain/references/common"
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
@@ -16,8 +15,6 @@ type Employee struct {
|
|||||||
Person_Id *uint `json:"person_id"`
|
Person_Id *uint `json:"person_id"`
|
||||||
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
|
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
|
||||||
Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"`
|
Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"`
|
||||||
Division_Code *string `json:"division_code"`
|
|
||||||
Division *ed.Division `json:"division,omitempty" gorm:"foreignKey:Division_Code;references:Code"`
|
|
||||||
Number *string `json:"number" gorm:"size:20"`
|
Number *string `json:"number" gorm:"size:20"`
|
||||||
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
|
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Basic struct {
|
||||||
|
ecore.SmallMain // adjust this according to the needs
|
||||||
|
Installation_Id *uint16 `json:"installation_id" gorm:"not null"`
|
||||||
|
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||||
|
Name string `json:"name" gorm:"size:30;not null"`
|
||||||
|
HeadStatus bool `json:"headStatus"`
|
||||||
|
Employee_Id *uint `json:"employee_id"`
|
||||||
|
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Basic) TableName() string {
|
||||||
|
return "InstallationPosition"
|
||||||
|
}
|
||||||
@@ -1,18 +1,11 @@
|
|||||||
package installation_position
|
package installation_position
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
||||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
|
||||||
ei "simrs-vx/internal/domain/main-entities/installation"
|
ei "simrs-vx/internal/domain/main-entities/installation"
|
||||||
|
eib "simrs-vx/internal/domain/main-entities/installation-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InstallationPosition struct {
|
type InstallationPosition struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
eib.Basic // adjust this according to the needs
|
||||||
Installation_Id *uint16 `json:"installation_id" gorm:"not null"`
|
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
||||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
|
||||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
|
||||||
Name string `json:"name" gorm:"size:30;not null"`
|
|
||||||
HeadStatus bool `json:"headStatus"`
|
|
||||||
Employee_Id *uint `json:"employee_id"`
|
|
||||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package installation
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
eipb "simrs-vx/internal/domain/main-entities/installation-position/base"
|
||||||
|
|
||||||
ere "simrs-vx/internal/domain/references/encounter"
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
)
|
)
|
||||||
@@ -27,8 +28,9 @@ type FilterDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint16 `json:"id"`
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
@@ -48,16 +50,18 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.SmallMain
|
ecore.SmallMain
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"`
|
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"`
|
||||||
|
InstallationPositions []eipb.Basic `json:"installationPositions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Installation) ToResponse() ResponseDto {
|
func (d Installation) ToResponse() ResponseDto {
|
||||||
resp := ResponseDto{
|
resp := ResponseDto{
|
||||||
Code: d.Code,
|
Code: d.Code,
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
EncounterClass_Code: d.EncounterClass_Code,
|
EncounterClass_Code: d.EncounterClass_Code,
|
||||||
|
InstallationPositions: d.InstallationPositions,
|
||||||
}
|
}
|
||||||
resp.SmallMain = d.SmallMain
|
resp.SmallMain = d.SmallMain
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package installation
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
eipb "simrs-vx/internal/domain/main-entities/installation-position/base"
|
||||||
ere "simrs-vx/internal/domain/references/encounter"
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Installation struct {
|
type Installation struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Code string `json:"code" gorm:"unique;size:10"`
|
Code string `json:"code" gorm:"unique;size:10"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"`
|
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"`
|
||||||
|
InstallationPositions []eipb.Basic `json:"installationPositions,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Basic struct {
|
||||||
|
ecore.SmallMain // adjust this according to the needs
|
||||||
|
Specialist_Id *uint16 `json:"specialist_id" gorm:"not null"`
|
||||||
|
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||||
|
Name string `json:"name" gorm:"size:30;not null"`
|
||||||
|
HeadStatus bool `json:"headStatus"`
|
||||||
|
Employee_Id *uint `json:"employee_id"`
|
||||||
|
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Basic) TableName() string {
|
||||||
|
return "SpecialistPosition"
|
||||||
|
}
|
||||||
@@ -1,18 +1,11 @@
|
|||||||
package specialist_position
|
package specialist_position
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
||||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
|
||||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
|
esb "simrs-vx/internal/domain/main-entities/specialist-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SpecialistPosition struct {
|
type SpecialistPosition struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
esb.Basic
|
||||||
Specialist_Id *uint16 `json:"specialist_id" gorm:"not null"`
|
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
|
||||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
|
||||||
Name string `json:"name" gorm:"size:30;not null"`
|
|
||||||
HeadStatus bool `json:"headStatus"`
|
|
||||||
Employee_Id *uint `json:"employee_id"`
|
|
||||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package specialist
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
espb "simrs-vx/internal/domain/main-entities/specialist-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
@@ -25,8 +26,9 @@ type FilterDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint16 `json:"id"`
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
@@ -46,16 +48,18 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.SmallMain
|
ecore.SmallMain
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Unit_Id *uint16 `json:"unit_id"`
|
Unit_Id *uint16 `json:"unit_id"`
|
||||||
|
SpecialistPositions []espb.Basic `json:"specialistPositions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Specialist) ToResponse() ResponseDto {
|
func (d Specialist) ToResponse() ResponseDto {
|
||||||
resp := ResponseDto{
|
resp := ResponseDto{
|
||||||
Code: d.Code,
|
Code: d.Code,
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
Unit_Id: d.Unit_Id,
|
Unit_Id: d.Unit_Id,
|
||||||
|
SpecialistPositions: d.SpecialistPositions,
|
||||||
}
|
}
|
||||||
resp.SmallMain = d.SmallMain
|
resp.SmallMain = d.SmallMain
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ package specialist
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
eub "simrs-vx/internal/domain/main-entities/specialist-position/base"
|
||||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Specialist struct {
|
type Specialist struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Code string `json:"code" gorm:"unique;size:10"`
|
Code string `json:"code" gorm:"unique;size:10"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
Unit_Id *uint16 `json:"unit_id"`
|
Unit_Id *uint16 `json:"unit_id"`
|
||||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"`
|
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"`
|
||||||
|
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Basic struct {
|
||||||
|
ecore.SmallMain // adjust this according to the needs
|
||||||
|
Subspecialist_Id *uint16 `json:"subspecialist_id" gorm:"not null"`
|
||||||
|
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||||
|
Name string `json:"name" gorm:"size:30;not null"`
|
||||||
|
HeadStatus bool `json:"headStatus"`
|
||||||
|
Employee_Id *uint `json:"employee_id"`
|
||||||
|
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Basic) TableName() string {
|
||||||
|
return "SubspecialistPosition"
|
||||||
|
}
|
||||||
@@ -1,18 +1,11 @@
|
|||||||
package subspecialist_position
|
package subspecialist_position
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
||||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
|
||||||
es "simrs-vx/internal/domain/main-entities/subspecialist"
|
es "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||||
|
esb "simrs-vx/internal/domain/main-entities/subspecialist-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SubspecialistPosition struct {
|
type SubspecialistPosition struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
esb.Basic
|
||||||
Subspecialist_Id *uint16 `json:"subspecialist_id" gorm:"not null"`
|
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
|
||||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
|
||||||
Name string `json:"name" gorm:"size:30;not null"`
|
|
||||||
HeadStatus bool `json:"headStatus"`
|
|
||||||
Employee_Id *uint `json:"employee_id"`
|
|
||||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package subspecialist
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
espb "simrs-vx/internal/domain/main-entities/subspecialist-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
@@ -25,8 +26,9 @@ type FilterDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint16 `json:"id"`
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
@@ -46,9 +48,10 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.SmallMain
|
ecore.SmallMain
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Specialist_Id *uint16 `json:"specialist_id"`
|
Specialist_Id *uint16 `json:"specialist_id"`
|
||||||
|
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Subspecialist) ToResponse() ResponseDto {
|
func (d Subspecialist) ToResponse() ResponseDto {
|
||||||
@@ -56,6 +59,7 @@ func (d Subspecialist) ToResponse() ResponseDto {
|
|||||||
Code: d.Code,
|
Code: d.Code,
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
Specialist_Id: d.Specialist_Id,
|
Specialist_Id: d.Specialist_Id,
|
||||||
|
Subspecialist: d.SubspecialistPositions,
|
||||||
}
|
}
|
||||||
resp.SmallMain = d.SmallMain
|
resp.SmallMain = d.SmallMain
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package subspecialist
|
|||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
|
espb "simrs-vx/internal/domain/main-entities/subspecialist-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Subspecialist struct {
|
type Subspecialist struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Code string `json:"code" gorm:"unique;size:10"`
|
Code string `json:"code" gorm:"unique;size:10"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
Specialist_Id *uint16 `json:"specialist_id"`
|
Specialist_Id *uint16 `json:"specialist_id"`
|
||||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||||
|
SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Basic struct {
|
||||||
|
ecore.SmallMain // adjust this according to the needs
|
||||||
|
Unit_Id *uint16 `json:"unit_id" gorm:"not null"`
|
||||||
|
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||||
|
Name string `json:"name" gorm:"size:30;not null"`
|
||||||
|
HeadStatus bool `json:"headStatus"`
|
||||||
|
Employee_Id *uint `json:"employee_id"`
|
||||||
|
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Basic) TableName() string {
|
||||||
|
return "UnitPosition"
|
||||||
|
}
|
||||||
@@ -1,18 +1,11 @@
|
|||||||
package unit_position
|
package unit_position
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
||||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
|
||||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||||
|
eub "simrs-vx/internal/domain/main-entities/unit-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UnitPosition struct {
|
type UnitPosition struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
eub.Basic
|
||||||
Unit_Id *uint16 `json:"unit_id" gorm:"not null"`
|
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
|
||||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
|
||||||
Name string `json:"name" gorm:"size:30;not null"`
|
|
||||||
HeadStatus bool `json:"headStatus"`
|
|
||||||
Employee_Id *uint `json:"employee_id"`
|
|
||||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package unit
|
|||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
ei "simrs-vx/internal/domain/main-entities/installation"
|
ei "simrs-vx/internal/domain/main-entities/installation"
|
||||||
|
eipb "simrs-vx/internal/domain/main-entities/unit-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
@@ -29,6 +30,7 @@ type ReadDetailDto struct {
|
|||||||
Id uint16 `json:"id"`
|
Id uint16 `json:"id"`
|
||||||
Installation_Id *uint16 `json:"installation_id"`
|
Installation_Id *uint16 `json:"installation_id"`
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
@@ -50,8 +52,9 @@ type ResponseDto struct {
|
|||||||
ecore.SmallMain
|
ecore.SmallMain
|
||||||
Installation_Id *uint16 `json:"installation_id"`
|
Installation_Id *uint16 `json:"installation_id"`
|
||||||
Installation *ei.Installation
|
Installation *ei.Installation
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
UnitPositions []eipb.Basic `json:"unitPositions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Unit) ToResponse() ResponseDto {
|
func (d Unit) ToResponse() ResponseDto {
|
||||||
@@ -59,6 +62,7 @@ func (d Unit) ToResponse() ResponseDto {
|
|||||||
Installation_Id: d.Installation_Id,
|
Installation_Id: d.Installation_Id,
|
||||||
Code: d.Code,
|
Code: d.Code,
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
|
UnitPositions: d.UnitPositions,
|
||||||
}
|
}
|
||||||
resp.SmallMain = d.SmallMain
|
resp.SmallMain = d.SmallMain
|
||||||
if d.Installation != nil {
|
if d.Installation != nil {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package unit
|
|||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
ei "simrs-vx/internal/domain/main-entities/installation"
|
ei "simrs-vx/internal/domain/main-entities/installation"
|
||||||
|
eub "simrs-vx/internal/domain/main-entities/unit-position/base"
|
||||||
ero "simrs-vx/internal/domain/references/organization"
|
ero "simrs-vx/internal/domain/references/organization"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -13,4 +14,5 @@ type Unit struct {
|
|||||||
Code string `json:"code" gorm:"unique;size:10"`
|
Code string `json:"code" gorm:"unique;size:10"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
Type_Code *ero.UnitTypeCode `json:"type_code"`
|
Type_Code *ero.UnitTypeCode `json:"type_code"`
|
||||||
|
UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
CSCSys ContractPositionCode = "system" // System
|
||||||
CSCEmp ContractPositionCode = "employee" // Pegawai
|
CSCEmp ContractPositionCode = "employee" // Pegawai
|
||||||
CSCInt ContractPositionCode = "intern" // PPDS
|
CSCInt ContractPositionCode = "intern" // PPDS
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
if id <= 0 {
|
if id <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint16(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
|
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint16(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
|
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint16(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
|
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint16(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
|
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint16(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
|
|||||||
@@ -120,10 +120,10 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
|||||||
outputData["employee_id"] = employee.Id
|
outputData["employee_id"] = employee.Id
|
||||||
role = append(role, "emp-"+string(*employee.Position_Code))
|
role = append(role, "emp-"+string(*employee.Position_Code))
|
||||||
|
|
||||||
if employee.Division_Code != nil {
|
//if employee.Division_Code != nil {
|
||||||
atClaims["employee_division_code"] = employee.Division_Code
|
// atClaims["employee_division_code"] = employee.Division_Code
|
||||||
outputData["employee_division_code"] = employee.Division_Code
|
// outputData["employee_division_code"] = employee.Division_Code
|
||||||
}
|
//}
|
||||||
|
|
||||||
// employee position
|
// employee position
|
||||||
if employee.Id > 0 && employee.Position_Code != nil {
|
if employee.Id > 0 && employee.Position_Code != nil {
|
||||||
@@ -159,7 +159,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
|||||||
errorGetPosition := d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: el.GenMessage("auth-getData-failed")}}
|
errorGetPosition := d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: el.GenMessage("auth-getData-failed")}}
|
||||||
|
|
||||||
// division position
|
// division position
|
||||||
divsionPositions, err := getDivisionPosition(employee.Id)
|
divisionPositions, err := getDivisionPosition(employee.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errorGetPosition
|
return nil, errorGetPosition
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
|||||||
return nil, errorGetPosition
|
return nil, errorGetPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
role = append(role, divsionPositions...)
|
role = append(role, divisionPositions...)
|
||||||
role = append(role, installationPositions...)
|
role = append(role, installationPositions...)
|
||||||
role = append(role, unitPositions...)
|
role = append(role, unitPositions...)
|
||||||
role = append(role, specialistPositions...)
|
role = append(role, specialistPositions...)
|
||||||
|
|||||||
@@ -91,7 +91,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
|||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
if err := tx.
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
First(&data, input.Id).Error; err != nil {
|
||||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
return nil, processedErr
|
return nil, processedErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Employee) {
|
|||||||
|
|
||||||
data.User_Id = inputSrc.User_Id
|
data.User_Id = inputSrc.User_Id
|
||||||
data.Person_Id = inputSrc.Person_Id
|
data.Person_Id = inputSrc.Person_Id
|
||||||
data.Division_Code = inputSrc.Division_Code
|
|
||||||
data.Number = inputSrc.Number
|
data.Number = inputSrc.Number
|
||||||
data.Status_Code = inputSrc.Status_Code
|
data.Status_Code = inputSrc.Status_Code
|
||||||
data.Position_Code = inputSrc.Position_Code
|
data.Position_Code = inputSrc.Position_Code
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
|||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
if err := tx.
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
First(&data, input.Id).Error; err != nil {
|
||||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
return nil, processedErr
|
return nil, processedErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
|||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
if err := tx.
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
First(&data, input.Id).Error; err != nil {
|
||||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
return nil, processedErr
|
return nil, processedErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
|||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
if err := tx.
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
First(&data, input.Id).Error; err != nil {
|
||||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
return nil, processedErr
|
return nil, processedErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
|||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
if err := tx.
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
First(&data, input.Id).Error; err != nil {
|
||||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
return nil, processedErr
|
return nil, processedErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ func setDataEmployeeUpdate(src e.EmployeUpdateDto) ee.UpdateDto {
|
|||||||
CreateDto: ee.CreateDto{
|
CreateDto: ee.CreateDto{
|
||||||
User_Id: src.User_Id,
|
User_Id: src.User_Id,
|
||||||
Person_Id: src.Person_Id,
|
Person_Id: src.Person_Id,
|
||||||
Division_Code: src.Division_Code,
|
|
||||||
Number: src.Number,
|
Number: src.Number,
|
||||||
Status_Code: src.Status_Code,
|
Status_Code: src.Status_Code,
|
||||||
Position_Code: &src.Position_Code,
|
Position_Code: &src.Position_Code,
|
||||||
|
|||||||
Reference in New Issue
Block a user