# Search staff

**Advanced staff filtering with custom GraphQL where clauses and dynamic ordering**
Provides flexible, enterprise-grade filtering for staff directory queries with boolean logic,
relationship traversal, and multi-field ordering.
Key capabilities include boolean operators (`_and`, `_or`, `_not`), text matching (`_ilike`),
comparison operators (`_gt`, `_gte`, `_lt`, `_lte`, `_eq`, `_neq`), array operators (`_in`, `_nin`),
and nested/related filtering (e.g., by office or manager).
Real Example:

```bash
curl --location 'https://{{host}}/v1/staff/search' \
--header 'Authorization: bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
  "pageSize": 1,
  "where": {
    "_and": [
      {
        "_or": [
          {
            "firstName": {
              "_ilike": "%john%"
            }
          },
          {
            "lastName": {
              "_ilike": "%doe%"
            }
          }
        ]
      },
      {
        "active": {
          "_eq": true
        }
      },
      {
        "createdAt": {
          "_gte": "1900-01-01T00:00:00Z"
        }
      },
      {
        "deptId": {
          "_in": [
            1,
            2,
            3
          ]
        }
      }
    ]
  },
  "orderBy": [
    {
      "lastName": "asc"
    },
    {
      "firstName": "asc"
    }
  ]
}'
```

Endpoint: POST /gql/v1/staff/search
Version: 1.0.0
Security: BearerAuth

## Request fields (application/json):

  - `pageSize` (integer)
    Maximum number of staff to return
    Example: 1

  - `where` (object)
    GraphQL-style where clause for complex staff filtering
    Example: {"_and":[{"_or":[{"firstName":{"_ilike":"%john%"}},{"lastName":{"_ilike":"%doe%"}}]},{"active":{"_eq":true}},{"createdAt":{"_gte":"1900-01-01T00:00:00Z"}},{"deptId":{"_in":[1,2,3]}}]}

  - `orderBy` (array)
    Dynamic ordering specifications with multiple fields
    Example: [{"lastName":"asc"},{"firstName":"asc"}]

## Response 200 fields (application/json):

  - `staff` (array)

  - `staff.id` (integer)
    Unique staff identifier
    Example: 202

  - `staff.pmsRef` (string)
    PMS reference identifier
    Example: 2254

  - `staff.firstName` (string)
    Staff member first name
    Example: Holley

  - `staff.lastName` (string)
    Staff member last name
    Example: Abbott

  - `staff.email` (string)
    Primary email address
    Example: ena.toy@hotmail.com

  - `staff.active` (boolean)
    Whether the staff member is active
    Example: true

  - `staff.deptId` (integer)
    Department identifier
    Example: 8

  - `staff.jobTitle` (string)
    Job title of the staff member
    Example: null

  - `staff.type` (string)
    Staff member type or category
    Example: null

  - `staff.officeId` (integer)
    Office identifier where the staff member is based
    Example: 2

  - `staff.staffManagerId` (integer)
    Identifier of the staff member's manager
    Example: null

  - `total` (object)

  - `total.aggregate` (object)

  - `total.aggregate.count` (integer)
    Total number of staff records matching criteria
    Example: 1

