Skip to content

Commit

Permalink
make order by optional in groupBy
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-dulaimi committed Dec 31, 2022
1 parent 11db7c2 commit ef9075a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
} from './helpers';
import { isAggregateInputType } from './helpers/aggregate-helpers';
import { AggregateOperationSupport, TransformerParams } from './types';
import { writeIndexFile } from './utils/writeIndexFile';
import { writeFileSafely } from './utils/writeFileSafely';
import { writeIndexFile } from './utils/writeIndexFile';

export default class Transformer {
name: string;
Expand Down Expand Up @@ -65,7 +65,7 @@ export default class Transformer {
}

static async generateIndex() {
const indexPath = path.join(Transformer.outputPath, "schemas/index.ts");
const indexPath = path.join(Transformer.outputPath, 'schemas/index.ts');
await writeIndexFile(indexPath);
}

Expand Down Expand Up @@ -718,7 +718,7 @@ export default class Transformer {
imports,
)}${this.generateExportSchemaStatement(
`${modelName}GroupBy`,
`z.object({ where: ${modelName}WhereInputObjectSchema.optional(), orderBy: z.union([${modelName}OrderByWithAggregationInputObjectSchema, ${modelName}OrderByWithAggregationInputObjectSchema.array()]), having: ${modelName}ScalarWhereWithAggregatesInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), by: z.array(${modelName}ScalarFieldEnumSchema) })`,
`z.object({ where: ${modelName}WhereInputObjectSchema.optional(), orderBy: z.union([${modelName}OrderByWithAggregationInputObjectSchema, ${modelName}OrderByWithAggregationInputObjectSchema.array()]).optional(), having: ${modelName}ScalarWhereWithAggregatesInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), by: z.array(${modelName}ScalarFieldEnumSchema) })`,
)}`,
);
}
Expand Down

0 comments on commit ef9075a

Please sign in to comment.