Skip to content

Commit

Permalink
fix: pagination conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
iansamz committed Mar 29, 2023
1 parent 85932bb commit 314dab5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion starters/express-apollo-prisma/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ indent_size = 2
max_line_length = off
trim_trailing_whitespace = false

[{package.json.eslintrc.json}]
[{package.json, eslintrc.json}]
indent_style = space
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type TechnologyEntityId = TechnologyEntity['id'];

export type TechnologyEntityCollectionPage = {
totalCount: number;
items: TechnologyEntity[];
edges: TechnologyEntity[];
};

export class TechnologyDataSource {
Expand All @@ -31,7 +31,7 @@ export class TechnologyDataSource {
}

async getTechnologies(limit: number, offset: number): Promise<TechnologyEntityCollectionPage> {
const [totalCount, items] = await this.prismaClient.$transaction([
const [totalCount, edges] = await this.prismaClient.$transaction([
this.prismaClient.technologyEntity.count(),
this.prismaClient.technologyEntity.findMany({
take: limit,
Expand All @@ -40,7 +40,7 @@ export class TechnologyDataSource {
]);
return {
totalCount,
items,
edges,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const technologyTypeDefs = gql`
"""
A page of technology items
"""
type Collection {
type TechnologyCollection {
"Identifies the total count of technology records in data source"
totalCount: Int!
"A list of records of the requested page"
items: [Technology]!
edges: [Technology]!
}
"""
Expand All @@ -32,7 +32,7 @@ export const technologyTypeDefs = gql`
"Returns a single Technology by ID"
technology(id: ID!): Technology
"Returns a list of Technologies"
technologies(limit: Int = 5, offset: Int = 0): Collection!
technologies(limit: Int = 5, offset: Int = 0): TechnologyCollection!
}
input CreateTechnology {
Expand Down

0 comments on commit 314dab5

Please sign in to comment.