Skip to content

Commit

Permalink
fix: import NumericField for BigDecimal type
Browse files Browse the repository at this point in the history
  • Loading branch information
metmirr committed Jul 8, 2020
1 parent c7b79da commit 6740e8c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions substrate-query-framework/cli/src/generate/ModelRenderer.ts
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path';
import { ObjectType, WarthogModel, FieldResolver } from '../model';
import Debug from 'debug';
import { GeneratorContext } from './SourcesGenerator';
import { buildFieldContext, TYPE_FIELDS } from './field-context';
import { buildFieldContext } from './field-context';
import * as utils from './utils';
import { GraphQLEnumType } from 'graphql';
import { AbstractRenderer } from './AbstractRenderer';
Expand Down Expand Up @@ -83,9 +83,10 @@ export class ModelRenderer extends AbstractRenderer {

withHasProps(): GeneratorContext {
const has: GeneratorContext = {};
for (const key in TYPE_FIELDS) {
const _key: string = key === 'numeric' ? 'numeric' || 'decimal' : key;
has[key] = this.objType.fields.some(f => f.columnType() === _key);
for (const field of this.objType.fields) {
let ct = field.columnType();
if (ct === 'numeric' || ct === 'decimal') ct = 'numeric';
has[ct] = true;
}
has['array'] = this.objType.fields.some(f => f.isArray());
has['enum'] = this.objType.fields.some(f => f.isEnum());
Expand Down

0 comments on commit 6740e8c

Please sign in to comment.