adjust after getuk updated

This commit is contained in:
dpurbosakti
2025-10-11 10:34:52 +07:00
parent 5f88e912c8
commit 1e77a82866
201 changed files with 347 additions and 1275 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",
+2 -2
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
@@ -61,4 +61,4 @@ require (
gorm.io/driver/postgres v1.5.11 // indirect
gorm.io/driver/sqlite v1.5.7 // indirect
gorm.io/driver/sqlserver v1.5.4 // indirect
)
)
+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
}
@@ -47,14 +47,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Encounter{}).
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.En
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

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