Merge pull request #50 from dikstub-rssa/fix/anything-moko
Fix/anything moko
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
h1:ZyLhZFZoiN0F1XdEaKvIbcFdvrYL1nLWtjK94oqn9IA=
|
h1:4thtC22CJCQMIeVkYLmcFOT5w7S+bUUWy9wHZ21OHi8=
|
||||||
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=
|
||||||
@@ -27,4 +27,4 @@ h1:ZyLhZFZoiN0F1XdEaKvIbcFdvrYL1nLWtjK94oqn9IA=
|
|||||||
20251006041122.sql h1:MlS7f21z06sutnf9dIekt5fuHJr4lgcQ4uCuCXAGsfc=
|
20251006041122.sql h1:MlS7f21z06sutnf9dIekt5fuHJr4lgcQ4uCuCXAGsfc=
|
||||||
20251006045658.sql h1:3FmGCPCzjgMPdWDRodZTsx3KVaodd9zB9ilib69aewk=
|
20251006045658.sql h1:3FmGCPCzjgMPdWDRodZTsx3KVaodd9zB9ilib69aewk=
|
||||||
20251006045928.sql h1:Z5g31PmnzNwk/OKdODcxZGm8fjJQdMFK32Xfnt3bRHg=
|
20251006045928.sql h1:Z5g31PmnzNwk/OKdODcxZGm8fjJQdMFK32Xfnt3bRHg=
|
||||||
20251007022859.sql h1:fFz0Kjuopv0QqLDiMvq+9sfq6K6PdiOs55EECWk4U+I=
|
20251007022859.sql h1:FO03zEfaNEk/aXwY81d5Lp3MoBB9kPQuXlXJ4BPiSR8=
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package infra
|
|||||||
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/item"
|
ei "simrs-vx/internal/domain/main-entities/item"
|
||||||
|
erb "simrs-vx/internal/domain/main-entities/room/base"
|
||||||
|
|
||||||
ero "simrs-vx/internal/domain/references/organization"
|
ero "simrs-vx/internal/domain/references/organization"
|
||||||
)
|
)
|
||||||
@@ -67,6 +68,7 @@ type ResponseDto struct {
|
|||||||
Childrens []Infra `json:"childrens,omitempty"`
|
Childrens []Infra `json:"childrens,omitempty"`
|
||||||
Item_Id *uint `json:"item_id"`
|
Item_Id *uint `json:"item_id"`
|
||||||
Item *ei.Item `json:"item,omitempty"`
|
Item *ei.Item `json:"item,omitempty"`
|
||||||
|
Rooms []erb.Basic `json:"rooms,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Infra) ToResponse() ResponseDto {
|
func (d Infra) ToResponse() ResponseDto {
|
||||||
@@ -79,6 +81,7 @@ func (d Infra) ToResponse() ResponseDto {
|
|||||||
Childrens: d.Childrens,
|
Childrens: d.Childrens,
|
||||||
Item_Id: d.Item_Id,
|
Item_Id: d.Item_Id,
|
||||||
Item: d.Item,
|
Item: d.Item,
|
||||||
|
Rooms: d.Rooms,
|
||||||
}
|
}
|
||||||
resp.SmallMain = d.SmallMain
|
resp.SmallMain = d.SmallMain
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package infra
|
|||||||
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/item"
|
ei "simrs-vx/internal/domain/main-entities/item"
|
||||||
|
erb "simrs-vx/internal/domain/main-entities/room/base"
|
||||||
|
|
||||||
ero "simrs-vx/internal/domain/references/organization"
|
ero "simrs-vx/internal/domain/references/organization"
|
||||||
)
|
)
|
||||||
@@ -17,4 +18,5 @@ type Infra struct {
|
|||||||
Childrens []Infra `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self
|
Childrens []Infra `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self
|
||||||
Item_Id *uint `json:"item_id"`
|
Item_Id *uint `json:"item_id"`
|
||||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||||
|
Rooms []erb.Basic `json:"rooms" gorm:"foreignKey:Infra_Id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,17 @@ type CreateDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadListDto struct {
|
type ReadListDto struct {
|
||||||
|
FilterDto
|
||||||
|
Includes string `json:"includes"`
|
||||||
|
Preloads []string `json:"-"`
|
||||||
|
Search string `json:"search"`
|
||||||
|
Pagination ecore.Pagination
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterDto struct {
|
||||||
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"`
|
||||||
Pagination ecore.Pagination
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Basic struct {
|
||||||
|
ecore.SmallMain // adjust this according to the needs
|
||||||
|
Infra_Id *uint16 `json:"infra_id"`
|
||||||
|
Unit_Id *uint16 `json:"unit_id"`
|
||||||
|
Specialist_Id *uint16 `json:"specialist_id"`
|
||||||
|
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Basic) TableName() string {
|
||||||
|
return "Room"
|
||||||
|
}
|
||||||
@@ -1,21 +1,17 @@
|
|||||||
package room
|
package room
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
||||||
ei "simrs-vx/internal/domain/main-entities/infra"
|
ei "simrs-vx/internal/domain/main-entities/infra"
|
||||||
|
ebase "simrs-vx/internal/domain/main-entities/room/base"
|
||||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Room struct {
|
type Room struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
ebase.Basic
|
||||||
Infra_Id *uint16 `json:"infra_id"`
|
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id"`
|
||||||
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id"`
|
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"`
|
||||||
Unit_Id *uint16 `json:"unit_id"`
|
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"`
|
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
|
||||||
Specialist_Id *uint16 `json:"specialist_id"`
|
|
||||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
|
||||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
|
||||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(input.Includes) > 0 {
|
||||||
|
input.Preloads = pu.GetPreloads(input.Includes)
|
||||||
|
}
|
||||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,9 +47,17 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
|
|||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(input.Preloads) > 0 {
|
||||||
|
for _, preload := range input.Preloads {
|
||||||
|
tx = tx.Preload(preload)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plh.SearchCodeOrName(input.Search, tx)
|
||||||
|
|
||||||
tx = tx.
|
tx = tx.
|
||||||
Model(&e.Installation{}).
|
Model(&e.Installation{}).
|
||||||
Scopes(gh.Filter(input)).
|
Scopes(gh.Filter(input.FilterDto)).
|
||||||
Count(&count).
|
Count(&count).
|
||||||
Scopes(gh.Paginate(input, &pagination)).
|
Scopes(gh.Paginate(input, &pagination)).
|
||||||
Order("\"CreatedAt\" DESC")
|
Order("\"CreatedAt\" DESC")
|
||||||
|
|||||||
Reference in New Issue
Block a user