Skip to content

Commit dda12aa

Browse files
committed
🐞 fix: incorrect pluralize usage
1 parent a08e50d commit dda12aa

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/object.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { FieldMap } from "@pothos/core";
22
import type { DrizzleObjectFieldBuilder } from "@pothos/plugin-drizzle";
33
import { One, type Table } from "drizzle-orm";
44
import { capitalize } from "es-toolkit";
5-
import { plural, singular } from "pluralize";
5+
import pluralize from "pluralize";
66
import type { AbilityBuilderType } from "./abilityBuilder";
77
import { type EnumImplementerType, isEnumSchema } from "./enum";
88
import { mapSQLTypeToGraphQLType } from "./helpers/sqlTypes/mapSQLTypeToTSType";
@@ -423,7 +423,7 @@ export const createObjectImplementer = <
423423
args,
424424
subscribe,
425425
nullable,
426-
description: `Get the ${plural(relationSchema.tsName)} related to this ${singular(tableSchema.tsName)}`,
426+
description: `Get the ${pluralize.plural(relationSchema.tsName)} related to this ${pluralize.singular(tableSchema.tsName)}`,
427427
query: (args: any, ctx: any) => {
428428
// transform null prototyped object
429429
args = JSON.parse(JSON.stringify(args));

lib/query.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { plural, singular } from "pluralize";
1+
import pluralize from "pluralize";
22
import { assertFindFirstExists } from "./helpers/helper";
33
import {
44
type TableIdentifierTSName,
@@ -112,11 +112,11 @@ export const createQueryImplementer = <
112112
}
113113

114114
return {
115-
[plural(table.toString())]: t.drizzleField({
115+
[pluralize.plural(table.toString())]: t.drizzleField({
116116
type: [table],
117117
nullable: false,
118118
smartSubscription: true,
119-
description: `List all ${plural(table.toString())}`,
119+
description: `List all ${pluralize.plural(table.toString())}`,
120120
subscribe: (subscriptions, _root, _args, _ctx, _info) => {
121121
registerOnInstance({
122122
instance: subscriptions,
@@ -168,11 +168,11 @@ export const createQueryImplementer = <
168168
return db.query[table as any].findMany(queryInstance);
169169
},
170170
}),
171-
[singular(table.toString())]: t.drizzleField({
171+
[pluralize.singular(table.toString())]: t.drizzleField({
172172
type: table,
173173
nullable: false,
174174
smartSubscription: true,
175-
description: `Get a single ${singular(table.toString())} by ID`,
175+
description: `Get a single ${pluralize.singular(table.toString())} by ID`,
176176
args: {
177177
// where: t.arg({ type: WhereArg, required: false }),
178178
id: t.arg.id({ required: true }),

0 commit comments

Comments
 (0)