Skip to content

Commit

Permalink
Merge pull request #69 from omar-dulaimi:support-bytes-type
Browse files Browse the repository at this point in the history
Support Bytes type
  • Loading branch information
omar-dulaimi committed Jan 1, 2023
2 parents d03f4e9 + 22c8406 commit c3a26da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ model Post {
author User? @relation(fields: [authorId], references: [id])
authorId Int?
likes BigInt
bytes Bytes
}

/// @@Gen.model(hide: true)
Expand Down
8 changes: 6 additions & 2 deletions src/transformer.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type {
ConnectorType,
DMMF as PrismaDMMF,
DMMF as PrismaDMMF
} from '@prisma/generator-helper';
import path from 'path';
import {
checkModelHasModelRelation,
findModelByName,
isMongodbRawOp,
isMongodbRawOp
} from './helpers';
import { isAggregateInputType } from './helpers/aggregate-helpers';
import { AggregateOperationSupport, TransformerParams } from './types';
Expand Down Expand Up @@ -155,6 +155,10 @@ export default class Transformer {
result.push(
this.wrapWithZodValidators('z.literal(true)', field, inputType),
);
} else if (inputType.type === 'Bytes') {
result.push(
this.wrapWithZodValidators('z.instanceof(Buffer)', field, inputType),
);
} else {
const isEnum = inputType.location === 'enumTypes';

Expand Down

0 comments on commit c3a26da

Please sign in to comment.