feat (infra): add rooms relation

This commit is contained in:
dpurbosakti
2025-10-07 16:02:12 +07:00
parent 3e25addf0a
commit 6efffc9056
2 changed files with 7 additions and 0 deletions
@@ -3,6 +3,7 @@ package infra
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ei "simrs-vx/internal/domain/main-entities/item"
erb "simrs-vx/internal/domain/main-entities/room/base"
ero "simrs-vx/internal/domain/references/organization"
)
@@ -67,6 +68,7 @@ type ResponseDto struct {
Childrens []Infra `json:"childrens,omitempty"`
Item_Id *uint `json:"item_id"`
Item *ei.Item `json:"item,omitempty"`
Rooms []erb.Basic `json:"rooms,omitempty"`
}
func (d Infra) ToResponse() ResponseDto {
@@ -79,6 +81,7 @@ func (d Infra) ToResponse() ResponseDto {
Childrens: d.Childrens,
Item_Id: d.Item_Id,
Item: d.Item,
Rooms: d.Rooms,
}
resp.SmallMain = d.SmallMain
return resp
@@ -17,3 +17,7 @@ type Basic struct {
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
}
func (Basic) TableName() string {
return "Room"
}