Skip to content

Commit

Permalink
Merge pull request #132 from cosmin-techoff/master
Browse files Browse the repository at this point in the history
fix(query-graphql): Added shareable directive to common types
  • Loading branch information
TriPSs committed Apr 21, 2023
2 parents 38d75a1 + 73debd5 commit 4a06092
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, ObjectType } from '@nestjs/graphql'
import { Directive, Field, ObjectType } from '@nestjs/graphql'
import { Class } from '@ptc-org/nestjs-query-core'

import { ConnectionCursorScalar, ConnectionCursorType } from '../../cursor.scalar'
Expand All @@ -21,6 +21,7 @@ export const getOrCreatePageInfoType = (): PageInfoTypeConstructor => {
return pageInfoType
}

@Directive('@shareable')
@ObjectType('PageInfo')
class PageInfoTypeImpl implements PageInfoType {
constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NotImplementedException } from '@nestjs/common'
import { Field, Int, ObjectType } from '@nestjs/graphql'
import { Directive, Field, Int, ObjectType } from '@nestjs/graphql'
import { Class, MapReflector, Query } from '@ptc-org/nestjs-query-core'

import { getGraphqlObjectName } from '../../../common'
Expand Down Expand Up @@ -39,6 +39,7 @@ export function getOrCreateOffsetConnectionType<DTO>(
const pager = createPager<DTO>()
const PIT = getOrCreateOffsetPageInfoType()

@Directive('@shareable')
@ObjectType(connectionName)
class AbstractConnection implements OffsetConnectionType<DTO> {
static get resolveType() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, ObjectType } from '@nestjs/graphql'
import { Directive, Field, ObjectType } from '@nestjs/graphql'
import { Class } from '@ptc-org/nestjs-query-core'

import { OffsetPageInfoType } from '../interfaces'
Expand All @@ -15,6 +15,7 @@ export const getOrCreateOffsetPageInfoType = (): OffsetPageInfoTypeConstructor =
return pageInfoType
}

@Directive('@shareable')
@ObjectType('OffsetPageInfo')
class PageInfoTypeImpl implements OffsetPageInfoType {
constructor(hasNextPage: boolean, hasPreviousPage: boolean) {
Expand Down
4 changes: 2 additions & 2 deletions packages/query-graphql/src/types/delete-many-reponse.type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, Int, ObjectType } from '@nestjs/graphql'
import { Directive, Field, Int, ObjectType } from '@nestjs/graphql'
import { Class, DeleteManyResponse } from '@ptc-org/nestjs-query-core'

/** @internal */
Expand All @@ -8,7 +8,7 @@ export const DeleteManyResponseType = (): Class<DeleteManyResponse> => {
if (deleteManyResponseType) {
return deleteManyResponseType
}

@Directive('@shareable')
@ObjectType('DeleteManyResponse')
class DeleteManyResponseTypeImpl implements DeleteManyResponse {
@Field(() => Int, { description: 'The number of records deleted.' })
Expand Down
4 changes: 2 additions & 2 deletions packages/query-graphql/src/types/update-many-response.type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, Int, ObjectType } from '@nestjs/graphql'
import { Directive, Field, Int, ObjectType } from '@nestjs/graphql'
import { Class, UpdateManyResponse } from '@ptc-org/nestjs-query-core'

/** @internal */
Expand All @@ -8,7 +8,7 @@ export const UpdateManyResponseType = (): Class<UpdateManyResponse> => {
if (updateManyResponseType) {
return updateManyResponseType
}

@Directive('@shareable')
@ObjectType('UpdateManyResponse')
class UpdateManyResponseTypeImpl implements UpdateManyResponse {
@Field(() => Int, { description: 'The number of records updated.' })
Expand Down

0 comments on commit 4a06092

Please sign in to comment.