> ## Documentation Index
> Fetch the complete documentation index at: https://nestjs-query.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# v0.23.x to v0.24.x

## Removed Public ConnectionType and SortType function.[​](#removed-public-connectiontype-and-sorttype-function "Direct link to Removed Public ConnectionType and SortType function.")

In versions prior to `v0.24.0` the `ConnectionType` and `SortType` functions could be used to get a reference to a `Connection` and `Sort` graphql implementation. In `v0.24.0` there public methods were removed in favor of pulling them off of the `QueryArgs`.

This change was made to remove possibility of creating ConnectionTypes and SortTypes that are incompatible with the QueryArgsType.

### Old[​](#old "Direct link to Old")

```ts theme={null}
import { ConnectionType, SortType } from '@ptc-org/nestjs-query-graphql'
import { TodoItemDTO } from './dto/todo-item.dto'

export const TodoItemConnection = ConnectionType(TodoItemDTO)
export const TodoItemSort = SortType(TodoItemDTO)
```

### New[​](#new "Direct link to New")

```ts theme={null}
import { QueryArgsType } from '@ptc-org/nestjs-query-graphql'
import { TodoItemDTO } from './dto/todo-item.dto'

export const TodoItemQueryArgs = QueryArgsType(TodoItemDTO)
export const TodoItemConnection = TodoItemQueryArgs.ConnectionType
export const TodoItemSort = TodoItemQueryArgs.SortType
```

## `@QueryOptions` Decorator[​](#queryoptions-decorator "Direct link to queryoptions-decorator")

In previous versions you had to specify options for querying and connections in your resolver. In `v0.24.0` a new `@QueryOptions` decorator was introduced to allow specifying all query related options along side the DTO, instead of splitting the configuration between the resolver and `DTO`. The new `@QueryOptions` provides a few benefits.

* Better re-use across types by avoiding passing configuration options all the way through the code to each piece that may need them.
* Decoupling query options from the resolver. This puts us in a better position to decouple the DTO definition from the transport layer (e.g. graphql)
* Keeps DTO configuration options closer to the source.

### Old[​](#old-1 "Direct link to Old")

todo-item.module.ts

```ts theme={null}
import { NestjsQueryGraphQLModule } from '@ptc-org/nestjs-query-graphql'
import { NestjsQueryTypeOrmModule } from '@ptc-org/nestjs-query-typeorm'
import { Module } from '@nestjs/common'
import { TodoItemDTO } from './todo-item.dto'
import { TodoItemEntity } from './todo-item.entity'

@Module({
  imports: [
    NestjsQueryGraphQLModule.forFeature({
      imports: [NestjsQueryTypeOrmModule.forFeature([TodoItemEntity])],
      resolvers: [
        {
          DTOClass: TodoItemDTO,
          EntityClass: TodoItemEntity,
          pagingStrategy: PagingStrategies.OFFSET,
          enableTotalCount: true,
          defaultResultSize: 5,
          maxResultSize: 100,
          defaultFilter: { completed: { is: true } },
          defaultSort: [{ field: 'title', direction: SortDirection.ASC }]
        }
      ]
    })
  ]
})
export class TodoItemModule {}
```

### New[​](#new-1 "Direct link to New")

todo-item.dto.ts

```ts theme={null}
import { FilterableField, QueryOptions, PagingStrategies } from '@ptc-org/nestjs-query-graphql'
import { ObjectType, ID, GraphQLISODateTime, Field } from '@nestjs/graphql'

@ObjectType('TodoItem')
@QueryOptions({
  pagingStrategy: PagingStrategies.OFFSET, // use offset based paging for this DTO
  enableTotalCount: true, // enable querying for totalCount
  defaultResultSize: 5, // return 5 records by default
  maxResultSize: 100, // do not allow querying for more than 100 records at a time
  defaultFilter: { completed: { is: true } }, // default filter when one is not provided
  defaultSort: [{ field: 'title', direction: SortDirection.ASC }] // default sort when one is not provided.
})
export class TodoItemDTO {

  @FilterableField(() => ID)
  id!: string

  @FilterableField()
  title!: string

  @FilterableField()
  completed!: boolean

  @FilterableField(() => GraphQLISODateTime)
  created!: Date

  @FilterableField(() => GraphQLISODateTime)
  updated!: Date
}
```

[Edit this page](https://github.com/tripss/nestjs-query/edit/master/docs/migration-guides/v0.23.x-to-v0.24.x)
