adjust after references fixed

This commit is contained in:
dpurbosakti
2025-08-29 14:59:19 +07:00
parent 0fa7e8ccde
commit 2fa3de8c53
28 changed files with 134 additions and 1669 deletions

No files matched your search

@@ -1,68 +0,0 @@
package infragroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Level uint8 `json:"level"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Level uint8 `json:"level"`
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"`
Level uint8 `json:"level"`
}
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.Main
Code string `json:"code"`
Name string `json:"name"`
Level uint8 `json:"level"`
}
func (d InfraGroup) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Level: d.Level,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []InfraGroup) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -1,12 +0,0 @@
package infragroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type InfraGroup struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
Level uint8 `json:"level"`
}
+24 -25
View File
@@ -2,24 +2,25 @@ package infra
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eig "simrs-vx/internal/domain/main-entities/infra-group"
ei "simrs-vx/internal/domain/main-entities/item"
ero "simrs-vx/internal/domain/references/organization"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *string `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *ero.InfraGroupCode `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *string `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *ero.InfraGroupCode `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
@@ -27,12 +28,12 @@ type ReadListDto struct {
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *string `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *ero.InfraGroupCode `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
}
type UpdateDto struct {
@@ -52,13 +53,12 @@ type MetaDto struct {
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *string `json:"infraGroup_code"`
InfraGroup *eig.InfraGroup `json:"infraGroup,omitempty"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code *ero.InfraGroupCode `json:"infraGroup_code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
}
func (d Infra) ToResponse() ResponseDto {
@@ -66,7 +66,6 @@ func (d Infra) ToResponse() ResponseDto {
Code: d.Code,
Name: d.Name,
InfraGroup_Code: d.InfraGroup_Code,
InfraGroup: d.InfraGroup,
Parent_Id: d.Parent_Id,
Item_Id: d.Item_Id,
Item: d.Item,
@@ -2,17 +2,17 @@ package infra
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eig "simrs-vx/internal/domain/main-entities/infra-group"
ei "simrs-vx/internal/domain/main-entities/item"
ero "simrs-vx/internal/domain/references/organization"
)
type Infra struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
InfraGroup_Code *string `json:"infraGroup_code" gorm:"size:10"`
InfraGroup *eig.InfraGroup `json:"infraGroup,omitempty" gorm:"foreignKey:InfraGroup_Code;references:Code"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
InfraGroup_Code *ero.InfraGroupCode `json:"infraGroup_code" gorm:"size:10"`
Parent_Id *int16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
}
@@ -1,63 +0,0 @@
package itemgroup
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.Main
Code string `json:"code"`
Name string `json:"name"`
}
func (d ItemGroup) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []ItemGroup) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -1,11 +0,0 @@
package itemgroup
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type ItemGroup struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"size:100"`
}
+27 -29
View File
@@ -2,26 +2,26 @@ package item
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eig "simrs-vx/internal/domain/main-entities/item-group"
eu "simrs-vx/internal/domain/main-entities/uom"
ero "simrs-vx/internal/domain/references/organization"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *string `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *ero.ItemGroupCode `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *string `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *ero.ItemGroupCode `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
Page int `json:"page"`
PageSize int `json:"page_size"`
@@ -29,13 +29,13 @@ type ReadListDto struct {
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *string `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *int16 `json:"infra_id"`
Stock *int `json:"stock"`
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *ero.ItemGroupCode `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *int16 `json:"infra_id"`
Stock *int `json:"stock"`
}
type UpdateDto struct {
@@ -55,14 +55,13 @@ type MetaDto struct {
type ResponseDto struct {
ecore.Main
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *string `json:"itemGroup_code"`
ItemGroup *eig.ItemGroup `json:"itemGroup,omitempty"`
Uom_Code *string `json:"uom_code"`
Uom *eu.Uom `json:"uom,omitempty"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code *ero.ItemGroupCode `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Uom *eu.Uom `json:"uom,omitempty"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
}
func (d Item) ToResponse() ResponseDto {
@@ -70,7 +69,6 @@ func (d Item) ToResponse() ResponseDto {
Code: d.Code,
Name: d.Name,
ItemGroup_Code: d.ItemGroup_Code,
ItemGroup: d.ItemGroup,
Uom_Code: d.Uom_Code,
Uom: d.Uom,
Infra_Id: d.Infra_Id,
+10 -10
View File
@@ -2,18 +2,18 @@ package item
import (
ecore "simrs-vx/internal/domain/base-entities/core"
eig "simrs-vx/internal/domain/main-entities/item-group"
eu "simrs-vx/internal/domain/main-entities/uom"
ero "simrs-vx/internal/domain/references/organization"
)
type Item struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"size:100"`
ItemGroup_Code *string `json:"itemGroup_code" gorm:"size:10"`
ItemGroup *eig.ItemGroup `json:"itemGroup,omitempty" gorm:"foreignKey:ItemGroup_Code;references:Code"`
Uom_Code *string `json:"uom_code" gorm:"size:10"`
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"size:100"`
ItemGroup_Code *ero.ItemGroupCode `json:"itemGroup_code" gorm:"size:10"`
Uom_Code *string `json:"uom_code" gorm:"size:10"`
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
Infra_Id *uint16 `json:"infra_id"`
Stock *int `json:"stock"`
}
@@ -2,7 +2,7 @@ package organization
type (
EmployeePosisitionCode string
ItemGroupCoode string
ItemGroupCode string
InfraGroupCode string
UnitTypeCode string
DoctorFeeTypeCode string
@@ -18,12 +18,12 @@ const (
EPCPav EmployeePosisitionCode = "payment-verificator" // Konfirmasi pembayaran
EPCMan EmployeePosisitionCode = "management" // Manajemen
ITGCInfra ItemGroupCoode = "infra"
ITGCMedicine ItemGroupCoode = "medicine"
ITGCDevice ItemGroupCoode = "device"
ITGCMaterial ItemGroupCoode = "material"
ITGCEmpFee ItemGroupCoode = "employee-fee"
ITGCDocFee ItemGroupCoode = "doctor-fee"
ITGCInfra ItemGroupCode = "infra"
ITGCMedicine ItemGroupCode = "medicine"
ITGCDevice ItemGroupCode = "device"
ITGCMaterial ItemGroupCode = "material"
ITGCEmpFee ItemGroupCode = "employee-fee"
ITGCDocFee ItemGroupCode = "doctor-fee"
IFGCBuilding InfraGroupCode = "building"
IFGCFloor InfraGroupCode = "floor"