forked from doug-martin/nestjs-query
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(graphql,federation,doug-martin#1051): added test for federation …
…null reference
- Loading branch information
Showing
20 changed files
with
911 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
examples/federation/todo-item-graphql/src/todo-item/dto/user-reference.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ObjectType, Directive, Field, ID } from '@nestjs/graphql'; | ||
|
||
@ObjectType('User') | ||
@Directive('@extends') | ||
@Directive('@key(fields: "id")') | ||
export class UserReferenceDTO { | ||
@Field(() => ID) | ||
@Directive('@external') | ||
id!: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Connection } from 'typeorm'; | ||
import { UserEntity } from '../src/user/user.entity'; | ||
import { executeTruncate } from '../../../helpers'; | ||
|
||
const tables = ['user']; | ||
export const truncate = async (connection: Connection): Promise<void> => executeTruncate(connection, tables); | ||
|
||
export const refresh = async (connection: Connection): Promise<void> => { | ||
await truncate(connection); | ||
|
||
const userRepo = connection.getRepository(UserEntity); | ||
await userRepo.save([ | ||
{ name: 'User 1', email: 'user1@example.com' }, | ||
{ name: 'User 2', email: 'user2@example.com' }, | ||
{ name: 'User 3', email: 'user3@example.com' }, | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export const userFields = ` | ||
id | ||
name | ||
`; | ||
|
||
export const pageInfoField = ` | ||
pageInfo{ | ||
hasNextPage | ||
hasPreviousPage | ||
startCursor | ||
endCursor | ||
} | ||
`; | ||
|
||
export const edgeNodes = (fields: string): string => ` | ||
edges { | ||
node{ | ||
${fields} | ||
} | ||
cursor | ||
} | ||
`; |
Oops, something went wrong.