-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(loader): correct interface loader inherit
- Loading branch information
1 parent
7911127
commit 6e6357f
Showing
7 changed files
with
98 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Query, Resolver } from '@nestjs/graphql'; | ||
import { CustomerType } from '../../../types/customer.type'; | ||
import { CustomerService } from '../services/customer.service'; | ||
|
||
@Resolver(() => CustomerType) | ||
export class CustomerResolver { | ||
constructor(private readonly customerService: CustomerService) {} | ||
|
||
@Query(() => [CustomerType]) | ||
customers() { | ||
return this.customerService.customers(); | ||
} | ||
} |
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,20 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { CustomerType } from '../../../types/customer.type'; | ||
|
||
const customers: CustomerType[] = [ | ||
{ | ||
id: '1', | ||
name: 'C1', | ||
}, | ||
{ | ||
id: '2', | ||
name: 'C2', | ||
}, | ||
]; | ||
|
||
@Injectable() | ||
export class CustomerService { | ||
customers() { | ||
return customers; | ||
} | ||
} |
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,14 @@ | ||
import { Extensions, Field, ID, ObjectType } from '@nestjs/graphql'; | ||
import { Person } from './person.interface'; | ||
|
||
@ObjectType('Customer', { | ||
implements: Person, | ||
}) | ||
export class CustomerType implements Person { | ||
@Field(() => ID) | ||
id: string; | ||
|
||
@Extensions({ role: 'ADMIN' }) | ||
@Field(() => String, { nullable: true }) | ||
name?: string; | ||
} |
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