diff --git a/api/application.go b/api/application.go index f4d0a927..ff69616a 100644 --- a/api/application.go +++ b/api/application.go @@ -120,7 +120,7 @@ func (h ApplicationHandler) Get(ctx *gin.Context) { // @router /applications [get] func (h ApplicationHandler) List(ctx *gin.Context) { var list []model.Application - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/bucket.go b/api/bucket.go index c2325006..c4572305 100644 --- a/api/bucket.go +++ b/api/bucket.go @@ -65,7 +65,7 @@ func (h BucketHandler) AddRoutes(e *gin.Engine) { // @router /buckets [get] func (h BucketHandler) List(ctx *gin.Context) { var list []model.Bucket - result := h.DB(ctx).Find(&list) + result := h.Paginated(ctx).Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) return diff --git a/api/businessservice.go b/api/businessservice.go index 0a66c027..d3b2fec5 100644 --- a/api/businessservice.go +++ b/api/businessservice.go @@ -65,7 +65,7 @@ func (h BusinessServiceHandler) Get(ctx *gin.Context) { // @router /businessservices [get] func (h BusinessServiceHandler) List(ctx *gin.Context) { var list []model.BusinessService - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/dependency.go b/api/dependency.go index 6069e66c..5e9dbaed 100644 --- a/api/dependency.go +++ b/api/dependency.go @@ -66,7 +66,7 @@ func (h DependencyHandler) Get(ctx *gin.Context) { func (h DependencyHandler) List(ctx *gin.Context) { var list []model.Dependency - db := h.DB(ctx) + db := h.Paginated(ctx) to := ctx.Query("to.id") from := ctx.Query("from.id") if to != "" { diff --git a/api/file.go b/api/file.go index c78adb4e..291f7315 100644 --- a/api/file.go +++ b/api/file.go @@ -46,7 +46,7 @@ func (h FileHandler) AddRoutes(e *gin.Engine) { // @router /files [get] func (h FileHandler) List(ctx *gin.Context) { var list []model.File - result := h.DB(ctx).Find(&list) + result := h.Paginated(ctx).Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) return diff --git a/api/group.go b/api/group.go index b721d967..f60d1d8d 100644 --- a/api/group.go +++ b/api/group.go @@ -65,7 +65,7 @@ func (h StakeholderGroupHandler) Get(ctx *gin.Context) { // @router /stakeholdergroups [get] func (h StakeholderGroupHandler) List(ctx *gin.Context) { var list []model.StakeholderGroup - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/identity.go b/api/identity.go index 733f85b0..355657eb 100644 --- a/api/identity.go +++ b/api/identity.go @@ -79,7 +79,7 @@ func (h IdentityHandler) List(ctx *gin.Context) { var list []model.Identity appId := ctx.Query(AppId) kind := ctx.Query(Kind) - db := h.DB(ctx) + db := h.Paginated(ctx) if appId != "" { db = db.Where( "id IN (SELECT identityID from ApplicationIdentity WHERE applicationID = ?)", diff --git a/api/jobfunction.go b/api/jobfunction.go index 9487705a..0b50fff9 100644 --- a/api/jobfunction.go +++ b/api/jobfunction.go @@ -65,7 +65,7 @@ func (h JobFunctionHandler) Get(ctx *gin.Context) { // @router /jobfunctions [get] func (h JobFunctionHandler) List(ctx *gin.Context) { var list []model.JobFunction - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/migrationwave.go b/api/migrationwave.go index 64870dc3..ca092462 100644 --- a/api/migrationwave.go +++ b/api/migrationwave.go @@ -66,7 +66,7 @@ func (h MigrationWaveHandler) Get(ctx *gin.Context) { // @router /migrationwaves [get] func (h MigrationWaveHandler) List(ctx *gin.Context) { var list []model.MigrationWave - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/proxy.go b/api/proxy.go index 9f4488de..f68ddd8c 100644 --- a/api/proxy.go +++ b/api/proxy.go @@ -69,7 +69,7 @@ func (h ProxyHandler) Get(ctx *gin.Context) { func (h ProxyHandler) List(ctx *gin.Context) { var list []model.Proxy kind := ctx.Query(Kind) - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) if kind != "" { db = db.Where(Kind, kind) } diff --git a/api/review.go b/api/review.go index d4aa3a80..71c8b389 100644 --- a/api/review.go +++ b/api/review.go @@ -67,7 +67,7 @@ func (h ReviewHandler) Get(ctx *gin.Context) { // @router /reviews [get] func (h ReviewHandler) List(ctx *gin.Context) { var list []model.Review - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/rulebundle.go b/api/rulebundle.go index 2c6fb4f8..8c9def65 100644 --- a/api/rulebundle.go +++ b/api/rulebundle.go @@ -68,7 +68,7 @@ func (h RuleBundleHandler) Get(ctx *gin.Context) { func (h RuleBundleHandler) List(ctx *gin.Context) { var list []model.RuleBundle db := h.preLoad( - h.DB(ctx), + h.Paginated(ctx), clause.Associations, "RuleSets.File") result := db.Find(&list) diff --git a/api/setting.go b/api/setting.go index a632398f..0dc85b69 100644 --- a/api/setting.go +++ b/api/setting.go @@ -67,7 +67,7 @@ func (h SettingHandler) Get(ctx *gin.Context) { // @router /settings [get] func (h SettingHandler) List(ctx *gin.Context) { var list []model.Setting - result := h.DB(ctx).Find(&list) + result := h.Paginated(ctx).Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) return diff --git a/api/stakeholder.go b/api/stakeholder.go index 768cd9db..c097c752 100644 --- a/api/stakeholder.go +++ b/api/stakeholder.go @@ -65,7 +65,7 @@ func (h StakeholderHandler) Get(ctx *gin.Context) { // @router /stakeholders [get] func (h StakeholderHandler) List(ctx *gin.Context) { var list []model.Stakeholder - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/tag.go b/api/tag.go index 1c4d25a9..8facb46b 100644 --- a/api/tag.go +++ b/api/tag.go @@ -65,7 +65,7 @@ func (h TagHandler) Get(ctx *gin.Context) { // @router /tags [get] func (h TagHandler) List(ctx *gin.Context) { var list []model.Tag - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/tagcategory.go b/api/tagcategory.go index 236faafb..d954523c 100644 --- a/api/tagcategory.go +++ b/api/tagcategory.go @@ -69,7 +69,7 @@ func (h TagCategoryHandler) Get(ctx *gin.Context) { // @param name query string false "Optional category name filter" func (h TagCategoryHandler) List(ctx *gin.Context) { var list []model.TagCategory - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) if name, found := ctx.GetQuery(Name); found { db = db.Where("name = ?", name) } diff --git a/api/task.go b/api/task.go index 5a6a9da6..90429940 100644 --- a/api/task.go +++ b/api/task.go @@ -96,7 +96,7 @@ func (h TaskHandler) Get(ctx *gin.Context) { // @router /tasks [get] func (h TaskHandler) List(ctx *gin.Context) { var list []model.Task - db := h.DB(ctx) + db := h.Paginated(ctx) locator := ctx.Query(LocatorParam) if locator != "" { db = db.Where("locator", locator) diff --git a/api/taskgroup.go b/api/taskgroup.go index b58e857c..ec45b419 100644 --- a/api/taskgroup.go +++ b/api/taskgroup.go @@ -80,7 +80,7 @@ func (h TaskGroupHandler) Get(ctx *gin.Context) { // @router /taskgroups [get] func (h TaskGroupHandler) List(ctx *gin.Context) { var list []model.TaskGroup - db := h.DB(ctx).Preload(clause.Associations) + db := h.Paginated(ctx).Preload(clause.Associations) result := db.Find(&list) if result.Error != nil { _ = ctx.Error(result.Error) diff --git a/api/ticket.go b/api/ticket.go index 7168d69a..50537f5b 100644 --- a/api/ticket.go +++ b/api/ticket.go @@ -70,7 +70,7 @@ func (h TicketHandler) List(ctx *gin.Context) { var list []model.Ticket appId := ctx.Query(AppId) trackerId := ctx.Query(TrackerId) - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) if appId != "" { db = db.Where("ApplicationID = ?", appId) } diff --git a/api/tracker.go b/api/tracker.go index e289c1f9..e8d7b090 100644 --- a/api/tracker.go +++ b/api/tracker.go @@ -70,7 +70,7 @@ func (h TrackerHandler) Get(ctx *gin.Context) { // @router /trackers [get] func (h TrackerHandler) List(ctx *gin.Context) { var list []model.Tracker - db := h.preLoad(h.DB(ctx), clause.Associations) + db := h.preLoad(h.Paginated(ctx), clause.Associations) kind := ctx.Query(Kind) if kind != "" { db = db.Where(Kind, kind)