Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions api/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"

"github.com/gin-gonic/gin"
qf "github.com/konveyor/tackle2-hub/api/filter"
"github.com/konveyor/tackle2-hub/api/jsd"
"github.com/konveyor/tackle2-hub/assessment"
"github.com/konveyor/tackle2-hub/metrics"
Expand Down Expand Up @@ -145,6 +146,8 @@ func (h ApplicationHandler) Get(ctx *gin.Context) {
// List godoc
// @summary List all applications.
// @description List all applications.
// @description filters:
// @description - platform.id
// @tags applications
// @produce json
// @success 200 {object} []api.Application
Expand Down Expand Up @@ -173,6 +176,16 @@ func (h ApplicationHandler) List(ctx *gin.Context) {
return
}

filter, err := qf.New(ctx,
[]qf.Assert{
{Field: "platform.id", Kind: qf.LITERAL},
})
if err != nil {
_ = ctx.Error(err)
return
}
filter = filter.Renamed("platform.id", "PlatformId")

type M struct {
*model.Application
IdentityId uint
Expand Down Expand Up @@ -227,6 +240,7 @@ func (h ApplicationHandler) List(ctx *gin.Context) {
db = db.Joins("LEFT JOIN Assessment at ON at.ApplicationID = a.ID")
db = db.Joins("LEFT JOIN Analysis an ON an.ApplicationID = a.ID")
db = db.Order("a.ID")
db = filter.Where(db)
page := Page{}
page.With(ctx)
cursor := Cursor{}
Expand Down
Loading