adjust after getuk updated

This commit is contained in:
dpurbosakti
2025-10-09 10:25:40 +07:00
parent 76614abc32
commit 496fccd249
54 changed files with 60 additions and 93 deletions
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.De
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Device{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.DiagnoseSrc{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,15 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = plh.Sort(input.Sort, tx)
tx = tx.
Model(&e.District{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination))
Scopes(gh.Paginate(input, &pagination)).
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,15 +53,13 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.DivisionPosition{}).
Preload("Division").
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,8 +53,6 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
if input.OnlyHaveChildren {
tx = tx.Where(`
EXISTS (
@@ -70,7 +68,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -47,14 +47,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Et
tx = dg.I
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Ethnic{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
+1 -3
View File
@@ -53,8 +53,6 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
if input.OnlyHaveChildren {
tx = tx.Where(`
EXISTS (
@@ -70,7 +68,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Installation{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.InsuranceCompany{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
+1 -3
View File
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.It
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Item{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -47,14 +47,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.La
tx = dg.I
}
plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Language{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ma
}
}
plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Material{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Mc
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.McuSrcCategory{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Mc
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.McuSrc{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Mc
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.McuSubSrc{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.MedicalActionSrc{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.MedicineGroup{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.MedicineMethod{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Medicine{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ph
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.PharmacyCompany{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -47,14 +47,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Pr
tx = dg.I
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.ProcedureSrc{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,12 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Pr
}
}
tx = tx.Debug().
tx = tx.
Model(&e.Province{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination))
// Scopes(gh.Sort(input.Sort))
Scopes(gh.Paginate(input, &pagination)).
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,15 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Re
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = plh.Sort(input.Sort, tx)
tx = tx.
Model(&e.Regency{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination))
Scopes(gh.Paginate(input, &pagination)).
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Sp
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Specialist{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Su
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Subspecialist{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
+1 -3
View File
@@ -53,15 +53,13 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Un
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Unit{}).
Preload("Installation").
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
+1 -3
View File
@@ -53,14 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Uo
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = tx.
Model(&e.Uom{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {
@@ -53,15 +53,12 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Vi
}
}
tx = plh.SearchCodeOrName(input.Search, tx)
tx = plh.Sort(input.Sort, tx)
tx = tx.
Model(&e.Village{}).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination))
Scopes(gh.Paginate(input, &pagination)).
Scopes(gh.Sort(input.Sort))
if err := tx.Find(&data).Error; err != nil {
if err == gorm.ErrRecordNotFound {