Skip to content

Commit 885c1d4

Browse files
committed
add id to feed query
1 parent d03832c commit 885c1d4

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

nexus-typegen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export interface NexusGenObjects {
5656
}
5757
Feed: { // root type
5858
count: number; // Int!
59+
id?: string | null; // ID
5960
links: NexusGenRootTypes['Link'][]; // [Link!]!
6061
}
6162
Link: { // root type
@@ -94,6 +95,7 @@ export interface NexusGenFieldTypes {
9495
}
9596
Feed: { // field return type
9697
count: number; // Int!
98+
id: string | null; // ID
9799
links: NexusGenRootTypes['Link'][]; // [Link!]!
98100
}
99101
Link: { // field return type
@@ -133,6 +135,7 @@ export interface NexusGenFieldTypeNames {
133135
}
134136
Feed: { // field return type name
135137
count: 'Int'
138+
id: 'ID'
136139
links: 'Link'
137140
}
138141
Link: { // field return type name

schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ scalar DateTime
1414

1515
type Feed {
1616
count: Int!
17+
id: ID
1718
links: [Link!]!
1819
}
1920

src/graphql/Link.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const Feed = objectType({
4242
definition(t) {
4343
t.nonNull.list.nonNull.field("links", { type: Link });
4444
t.nonNull.int("count");
45+
t.id("id");
4546
},
4647
});
4748

@@ -89,10 +90,12 @@ export const LinkQuery = extendType({
8990
});
9091

9192
const count = await context.prisma.link.count({ where });
92-
93+
const id = `main-feed:${JSON.stringify(args)}`;
94+
9395
return {
9496
links,
9597
count,
98+
id,
9699
};
97100
},
98101
});

0 commit comments

Comments
 (0)