Merge pull request #64 from dikstub-rssa/fix/anything-moko

Fix/anything moko
This commit is contained in:
Dwi Atmoko Purbo Sakti
2025-10-11 11:10:22 +07:00
committed by GitHub
202 changed files with 348 additions and 1276 deletions
+1
View File
@@ -27,6 +27,7 @@
"data-notFound": "data or resource can not be found",
"data-notFound-condition": "\"%v\" with %v \"%v\" can not be found",
"data-get-fail": "get data failed, %v",
"data-get-invalid-relation": "database get failed, invalid relation",
"data-update-fail": "failed to update data",
"data-delete-success": "data has been deleted",
"data-delete-fail": "failed to delete data",
+1 -1
View File
@@ -11,7 +11,7 @@ require (
github.com/jackc/pgx/v5 v5.5.5
github.com/karincake/apem v0.0.17
github.com/karincake/dodol v0.0.1
github.com/karincake/getuk v0.2.1
github.com/karincake/getuk v0.3.1
github.com/karincake/hongkue v0.0.4
github.com/karincake/lepet v0.0.1
github.com/karincake/risoles v0.0.3
+2 -2
View File
@@ -79,8 +79,8 @@ github.com/karincake/apem v0.0.17 h1:y3WXCr9GWLFFFH4Qyq/VWlWWpijHh5zpTc3Lm96twa4
github.com/karincake/apem v0.0.17/go.mod h1:cQP2sJfDrLRIiwWoaLWw/z8uAya+DWu/FpmYeinMQXM=
github.com/karincake/dodol v0.0.1 h1:jUXmJh1r0Ei4fmHPZ6IUkoplW/V9d27L63JEl6zudL0=
github.com/karincake/dodol v0.0.1/go.mod h1:2f1NcvkvY0J3GMUkwILNDYVvRUpz0W3lpPp/Ha/Ld24=
github.com/karincake/getuk v0.2.1 h1:l9qaoSE1ttwzNbGTRNGYn61EZ9/rb/V+TjdY8XPeswU=
github.com/karincake/getuk v0.2.1/go.mod h1:NVnvxSGAkQ/xuq99FzWACvY5efyKPLFla1cKB8czm7c=
github.com/karincake/getuk v0.3.1 h1:yRqBTrwpnjYcZD3gPDoSxFlsLgI9/GKCr3ZCsS4TtYQ=
github.com/karincake/getuk v0.3.1/go.mod h1:NVnvxSGAkQ/xuq99FzWACvY5efyKPLFla1cKB8czm7c=
github.com/karincake/hongkue v0.0.4 h1:oWthq6cDg5DvDm1Z3e7mCLOATQf+oAdtHxN9OPnCfA8=
github.com/karincake/hongkue v0.0.4/go.mod h1:YVi5Lyh3DE+GRHx2OSODOr7FwvLi8U4idvcPHO7yeag=
github.com/karincake/lepet v0.0.1 h1:eq/cwn5BBg0jWZ1c/MmvhFIBma0zBpVs2LwkfDOncy4=
+1 -2
View File
@@ -21,8 +21,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -13,8 +13,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -21,8 +21,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -20,8 +20,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -14,8 +14,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -20,8 +20,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -17,9 +17,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -12,9 +12,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -15,9 +15,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -16,9 +16,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -12,9 +12,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
OnlyHaveChildren bool `json:"only-have-children"`
}
@@ -16,8 +16,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -19,8 +19,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -13,8 +13,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -19,8 +19,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -33,8 +33,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -11,9 +11,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -22,9 +22,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
OnlyHaveChildren bool `json:"only-have-children"`
}
@@ -16,8 +16,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -14,9 +14,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -15,9 +15,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -14,8 +14,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -17,9 +17,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -12,8 +12,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -12,7 +12,6 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -14,8 +14,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -20,8 +20,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -18,9 +18,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -18,8 +18,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -16,8 +16,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -27,8 +27,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -14,9 +14,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -14,9 +14,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -15,9 +15,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -15,8 +15,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -13,9 +13,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -18,8 +18,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -21,8 +21,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -11,9 +11,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -11,9 +11,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -14,8 +14,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -23,9 +23,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -12,8 +12,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -16,8 +16,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -12,8 +12,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -27,8 +27,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -36,8 +36,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -12,8 +12,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -12,9 +12,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -12,9 +12,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -15,8 +15,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -25,8 +25,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -19,8 +19,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -12,9 +12,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -12,9 +12,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -15,9 +15,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -17,8 +17,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -21,8 +21,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
+1 -2
View File
@@ -24,8 +24,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -17,8 +17,7 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Includes string `json:"includes"`
Pagination ecore.Pagination
}
@@ -12,9 +12,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -12,9 +12,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -13,9 +13,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -11,9 +11,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
+2 -3
View File
@@ -15,9 +15,8 @@ type CreateDto struct {
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Sort string `json:"sort"`
Includes string `json:"includes"`
Sort string `json:"sort"`
Pagination ecore.Pagination
}
@@ -107,9 +107,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
+3 -14
View File
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ad
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Adime{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ad
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -87,9 +87,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Am
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Ambulatory{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Am
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -91,9 +91,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
+3 -14
View File
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ch
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Chemo{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ch
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -97,9 +97,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Co
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Consultation{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Co
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -58,15 +58,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Co
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -88,9 +88,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.De
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.DeviceOrderItem{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.De
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -119,9 +119,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.De
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.DeviceOrder{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.De
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -90,9 +90,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
+3 -14
View File
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.De
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Device{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.De
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -87,9 +87,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.DiagnoseSrc{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -87,9 +87,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.District{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -87,9 +87,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,15 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.DivisionPosition{}).
Preload("Division").
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -65,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -87,9 +87,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,12 +47,6 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
if input.OnlyHaveChildren {
tx = tx.Where(`
EXISTS (
@@ -65,6 +59,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
tx = tx.
Model(&e.Division{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -74,15 +69,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -87,9 +87,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Do
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.DoctorFee{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Do
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -87,9 +87,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
+3 -14
View File
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Do
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Doctor{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Do
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -87,9 +87,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Em
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Emergency{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -64,15 +59,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Em
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -82,9 +82,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}
@@ -48,14 +48,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Em
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Employee{}).
Scopes(gh.Preload(input.Includes)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
@@ -65,15 +60,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Em
if err == gorm.ErrRecordNotFound {
return nil, &meta, nil
}
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "data-get-fail",
Detail: "Database get failed",
Raw: err,
}
return nil, nil, pl.SetLogError(event, input)
return nil, nil, plh.HandleListError(input, event, err)
}
meta.Count = int(count)
meta.PageNumber = pagination.PageNumber
meta.PageSize = pagination.PageSize
@@ -159,9 +159,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
return err
}
if len(input.Includes) > 0 {
input.Preloads = pu.GetPreloads(input.Includes)
}
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
return err
}

Some files were not shown because too many files have changed in this diff Show More