Handle query query param for the fleet maintained apps list endpoint (#22501)

support the `query` query param for the `GET /fleet_maintained_apps`
endpoint
This commit is contained in:
Gabriel Hernandez 2024-09-30 17:54:14 +01:00 committed by GitHub
parent a7718b8866
commit 3e175d04cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -128,7 +128,15 @@ WHERE NOT EXISTS (
)
)`
stmtPaged, args := appendListOptionsWithCursorToSQL(stmt, []any{teamID, teamID}, &opt)
args := []any{teamID, teamID}
if match := opt.MatchQuery; match != "" {
match = likePattern(match)
stmt += ` AND (fla.name LIKE ?)`
args = append(args, match)
}
stmtPaged, args := appendListOptionsWithCursorToSQL(stmt, args, &opt)
var avail []fleet.MaintainedApp
if err := sqlx.SelectContext(ctx, ds.reader(ctx), &avail, stmtPaged, args...); err != nil {