Skip to content

Commit

Permalink
Merge pull request #14 from hackapulco/master
Browse files Browse the repository at this point in the history
Added support for BigInt
  • Loading branch information
omar-dulaimi committed Aug 13, 2022
2 parents f9e7baf + 578b69e commit db35596
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -87,6 +87,7 @@ model Post {
viewCount Int @default(0)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
likes BigInt
}
```

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -8,7 +8,8 @@
},
"scripts": {
"gen-example": "tsc && npx prisma generate",
"package:publish": "./package.sh && cd package && npm publish"
"package:publish": "./package.sh && cd package && npm publish",
"postinstall": "tsc"
},
"author": {
"name": "Omar Dulaimi",
Expand Down
1 change: 1 addition & 0 deletions prisma/schema.prisma
Expand Up @@ -29,4 +29,5 @@ model Post {
viewCount Int @default(0)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
likes BigInt
}
4 changes: 4 additions & 0 deletions src/transformer.ts
Expand Up @@ -107,6 +107,10 @@ export default class Transformer {
inputType.type === 'Decimal'
) {
result.push(this.wrapWithZodValidators('z.number()', field, inputType));
} else if (inputType.type === 'BigInt') {
result.push(
this.wrapWithZodValidators('z.bigint()', field, inputType),
);
} else if (inputType.type === 'Boolean') {
result.push(
this.wrapWithZodValidators('z.boolean()', field, inputType),
Expand Down

0 comments on commit db35596

Please sign in to comment.