Skip to content

Commit

Permalink
fix(): minor fixes to the resource (gql) schematic
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Aug 23, 2020
1 parent 2b87e50 commit 9ea32ef
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/lib/resource/files/ts/__name__.graphql
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
type <%= singular(classify(name)) %> {}
type <%= singular(classify(name)) %> {
# Example field (placeholder)
exampleField: Int
}

type Create<%= singular(classify(name)) %>Input {}
input Create<%= singular(classify(name)) %>Input {
# Example field (placeholder)
exampleField: Int
}

type Update<%= singular(classify(name)) %>Input {
input Update<%= singular(classify(name)) %>Input {
id: Int!
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<% if (type === 'graphql-code-first') { %>import { InputType } from '@nestjs/graphql';
<% if (type === 'graphql-code-first') { %>import { InputType, Int, Field } from '@nestjs/graphql';

@InputType()
export class Create<%= singular(classify(name)) %>Input {}<% } else { %>export class Create<%= singular(classify(name)) %>Input {}<% } %>
export class Create<%= singular(classify(name)) %>Input {
@Field(() => Int, { description: 'Example field (placeholder)' })
exampleField: number;
}<% } else { %>export class Create<%= singular(classify(name)) %>Input {}<% } %>
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<% if (type === 'graphql-code-first') { %>import { ObjectType } from '@nestjs/graphql';
<% if (type === 'graphql-code-first') { %>import { ObjectType, Field, Int } from '@nestjs/graphql';

@ObjectType()
export class <%= singular(classify(name)) %> {}<% } else { %>export class <%= singular(classify(name)) %> {}<% } %>
export class <%= singular(classify(name)) %> {
@Field(() => Int, { description: 'Example field (placeholder)' })
exampleField: number;
}<% } else { %>export class <%= singular(classify(name)) %> {}<% } %>

0 comments on commit 9ea32ef

Please sign in to comment.