Skip to content

Requirements filter by author username or search

charlie ablett requested to merge 212543-backend-requirements-filtering into master

What does this MR do?

Add filter by author username and title search.

Database query (sort + search)
SELECT "requirements".* FROM "requirements" WHERE "requirements"."project_id" = 27 AND "requirements"."author_id" = 1 AND "requirements"."title" ILIKE '%make%' AND "requirements"."title" ILIKE '%more%' AND "requirements"."title" ILIKE '%betterer%' ORDER BY "requirements"."created_at" DESC, "requirements"."id" DESC LIMIT 100

Query plan (https://explain.depesz.com/s/DVQS):

 Limit  (cost=2.18..2.19 rows=1 width=590)
   ->  Sort  (cost=2.18..2.19 rows=1 width=590)
         Sort Key: created_at DESC, id DESC
         ->  Index Scan using index_requirements_on_project_id_and_iid on requirements  (cost=0.14..2.17 rows=1 width=590)
               Index Cond: (project_id = 27)
               Filter: (((title)::text ~~* '%make%'::text) AND ((title)::text ~~* '%more%'::text) AND ((title)::text ~~* '%betterer%'::text) AND (author_id = 1))

GraphQL query:

query {
  project(fullPath: "group/project_path") {
    requirements(authorUsername: "root", sort: created_desc, search: "make it more betterer") {
      edges {
        node {
          id
          title
          state
        }
      }
    }
  }
}

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #212543 (closed)

Edited by Justin Farris

Merge request reports