Skip to content

Commit

Permalink
fix(node): upgrade typeorm to support node 14+ (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldcaddy77 authored Jun 15, 2021
1 parent b2bcabb commit 09f904a
Show file tree
Hide file tree
Showing 4 changed files with 239 additions and 181 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.13
14
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@types/node": "^12.12.8",
"@types/node-emoji": "^1.8.1",
"@types/open": "^6.2.1",
"@types/pg": "^7.11.2",
"@types/pg": "^7.14.11",
"@types/prettier": "^1.18.3",
"@types/shortid": "^0.0.29",
"@types/ws": "^6.0.3",
Expand Down Expand Up @@ -100,15 +100,15 @@
"mkdirp": "^0.5.1",
"node-emoji": "^1.10.0",
"open": "^7.0.0",
"pg": "^7.12.1",
"pgtools": "^0.3.0",
"pg": "^8.6.0",
"pgtools": "^0.3.1",
"prettier": "^1.19.1",
"reflect-metadata": "^0.1.13",
"shortid": "^2.2.15",
"type-graphql": "^0.17.5",
"typedi": "^0.8.0",
"typeorm": "^0.2.25",
"typeorm-typedi-extensions": "^0.2.3",
"typeorm": "^0.2.32",
"typeorm-typedi-extensions": "^0.4.1",
"typescript": "^3.9.7"
},
"devDependencies": {
Expand Down
14 changes: 6 additions & 8 deletions src/core/BaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@ import {
SelectQueryBuilder
} from 'typeorm';
import { ColumnMetadata } from 'typeorm/metadata/ColumnMetadata';

import { isArray } from 'util';
import { debug } from '../decorators';
import { StandardDeleteResponse } from '../tgql';
import { addQueryBuilderWhereItem } from '../torm';

import { BaseModel } from './';
import { StringMap, WhereInput } from './types';
import { isArray } from 'util';
import { ConnectionInputFields, GraphQLInfoService } from './GraphQLInfoService';
import {
ConnectionResult,
RelayFirstAfter,
RelayLastBefore,
RelayService,
RelayPageOptions,
ConnectionResult
RelayService
} from './RelayService';
import { GraphQLInfoService, ConnectionInputFields } from './GraphQLInfoService';
import { StringMap, WhereInput } from './types';

export interface BaseOptions {
manager?: EntityManager; // Allows consumers to pass in a TransactionManager
Expand Down Expand Up @@ -362,7 +360,7 @@ export class BaseService<E extends BaseModel> {

async create(data: DeepPartial<E>, userId: string, options?: BaseOptions): Promise<E> {
const manager = options?.manager ?? this.manager;
const entity = manager.create(this.entityClass, { ...data, createdById: userId });
const entity = manager.create<E>(this.entityClass, { ...data, createdById: userId });

// Validate against the the data model
// Without `skipMissingProperties`, some of the class-validator validations (like MinLength)
Expand Down
Loading

0 comments on commit 09f904a

Please sign in to comment.