Skip to content

Commit

Permalink
feat(resource): search query by resource name on appeals and approvals
Browse files Browse the repository at this point in the history
  • Loading branch information
idilhaq committed Nov 8, 2024
1 parent 62383b1 commit aea5fe5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/store/postgres/appeal_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ func applyAppealFilter(db *gorm.DB, filters *domain.ListAppealsFilter) (*gorm.DB
db = db.Where(db.
Where(`"appeals"."account_id" LIKE ?`, fmt.Sprintf("%%%s%%", filters.Q)).
Or(`"appeals"."role" LIKE ?`, fmt.Sprintf("%%%s%%", filters.Q)).
Or(`"resources"."urn" LIKE ?`, fmt.Sprintf("%%%s%%", filters.Q)),
Or(`"resources"."urn" LIKE ?`, fmt.Sprintf("%%%s%%", filters.Q)).
Or(`"resources"."name" LIKE ?`, fmt.Sprintf("%%%s%%", filters.Q)),
)
}
if filters.Statuses != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/store/postgres/approval_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ func applyFilter(db *gorm.DB, filter *domain.ListApprovalsFilter) (*gorm.DB, err
db = db.Where(db.
Where(`"Appeal"."account_id" LIKE ?`, fmt.Sprintf("%%%s%%", filter.Q)).
Or(`"Appeal"."role" LIKE ?`, fmt.Sprintf("%%%s%%", filter.Q)).
Or(`"Appeal__Resource"."urn" LIKE ?`, fmt.Sprintf("%%%s%%", filter.Q)),
Or(`"Appeal__Resource"."urn" LIKE ?`, fmt.Sprintf("%%%s%%", filter.Q)).
Or(`"Appeal__Resource"."name" LIKE ?`, fmt.Sprintf("%%%s%%", filter.Q)),
)
}
if filter.CreatedBy != "" {
Expand Down

0 comments on commit aea5fe5

Please sign in to comment.