Skip to content

Commit

Permalink
fix: use correct Byte scalar import
Browse files Browse the repository at this point in the history
  • Loading branch information
rfermann committed Apr 17, 2021
1 parent 355361b commit defdd93
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Handlers/BaseHandler/BaseParser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface TSFieldOptions {
export class BaseParser {
readonly dmmf: DMMF.Document;

readonly graphqlScalarImports = new Set(["Byte"]);
readonly graphqlScalarImports = new Set(["ByteResolver"]);

readonly inputTypeList: Set<string> = new Set();

Expand Down Expand Up @@ -227,7 +227,7 @@ export class BaseParser {
private _mapScalarToGraphQLType(scalar: string): string {
switch (scalar) {
case "Bytes":
return "Byte";
return "ByteResolver";

case "DateTime":
return "GraphQLISODateTime";
Expand Down
20 changes: 10 additions & 10 deletions src/Handlers/InputTypeHandler/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ export class BoolWithAggregatesFilter {

exports[`InputTypeHandler should parse input types and create correct shared files from datamodel 7`] = `
"import { Field, InputType } from \\"@nestjs/graphql\\";
import { Byte } from \\"graphql-scalars\\";
import { ByteResolver } from \\"graphql-scalars\\";
@InputType({
isAbstract: true,
})
export class BytesFieldUpdateOperationsInput {
@Field(() => Byte, {
@Field(() => ByteResolver, {
nullable: true
})
set?: Buffer | undefined;
Expand All @@ -257,14 +257,14 @@ export class BytesFieldUpdateOperationsInput {

exports[`InputTypeHandler should parse input types and create correct shared files from datamodel 8`] = `
"import { Field, InputType } from \\"@nestjs/graphql\\";
import { Byte } from \\"graphql-scalars\\";
import { ByteResolver } from \\"graphql-scalars\\";
import { NestedBytesFilter } from \\"./NestedBytesFilter\\";
@InputType({
isAbstract: true,
})
export class BytesFilter {
@Field(() => Byte, {
@Field(() => ByteResolver, {
nullable: true
})
equals?: Buffer | undefined;
Expand All @@ -279,7 +279,7 @@ export class BytesFilter {

exports[`InputTypeHandler should parse input types and create correct shared files from datamodel 9`] = `
"import { Field, InputType } from \\"@nestjs/graphql\\";
import { Byte } from \\"graphql-scalars\\";
import { ByteResolver } from \\"graphql-scalars\\";
import { NestedBytesWithAggregatesFilter } from \\"./NestedBytesWithAggregatesFilter\\";
import { NestedIntFilter } from \\"./NestedIntFilter\\";
import { NestedBytesFilter } from \\"./NestedBytesFilter\\";
Expand All @@ -288,7 +288,7 @@ import { NestedBytesFilter } from \\"./NestedBytesFilter\\";
isAbstract: true,
})
export class BytesWithAggregatesFilter {
@Field(() => Byte, {
@Field(() => ByteResolver, {
nullable: true
})
equals?: Buffer | undefined;
Expand Down Expand Up @@ -1267,13 +1267,13 @@ export class NestedBoolWithAggregatesFilter {

exports[`InputTypeHandler should parse input types and create correct shared files from datamodel 31`] = `
"import { Field, InputType } from \\"@nestjs/graphql\\";
import { Byte } from \\"graphql-scalars\\";
import { ByteResolver } from \\"graphql-scalars\\";
@InputType({
isAbstract: true,
})
export class NestedBytesFilter {
@Field(() => Byte, {
@Field(() => ByteResolver, {
nullable: true
})
equals?: Buffer | undefined;
Expand All @@ -1283,15 +1283,15 @@ export class NestedBytesFilter {

exports[`InputTypeHandler should parse input types and create correct shared files from datamodel 32`] = `
"import { Field, InputType } from \\"@nestjs/graphql\\";
import { Byte } from \\"graphql-scalars\\";
import { ByteResolver } from \\"graphql-scalars\\";
import { NestedIntFilter } from \\"./NestedIntFilter\\";
import { NestedBytesFilter } from \\"./NestedBytesFilter\\";
@InputType({
isAbstract: true,
})
export class NestedBytesWithAggregatesFilter {
@Field(() => Byte, {
@Field(() => ByteResolver, {
nullable: true
})
equals?: Buffer | undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/Handlers/ModelHandler/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("ModelHandler", () => {

expect(sessionModelFile).toMatchInlineSnapshot(`
"import { Field, GraphQLISODateTime, Int, ObjectType } from \\"@nestjs/graphql\\";
import { Byte } from \\"graphql-scalars\\";
import { ByteResolver } from \\"graphql-scalars\\";
import { User } from \\"../User/model\\";
@ObjectType({
Expand Down Expand Up @@ -94,7 +94,7 @@ describe("ModelHandler", () => {
})
bigSize!: bigint;
@Field(() => Byte, {
@Field(() => ByteResolver, {
nullable: false
})
byte!: Buffer;
Expand Down

0 comments on commit defdd93

Please sign in to comment.