From 04dff41b6e98bb844087a96384aafc9423fe0ffc Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 15:23:44 +0000 Subject: [PATCH 01/15] refactor: metadata method, use reduce --- src/polymorphic.repository.ts | 50 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/src/polymorphic.repository.ts b/src/polymorphic.repository.ts index 78c2801..280c0c4 100644 --- a/src/polymorphic.repository.ts +++ b/src/polymorphic.repository.ts @@ -36,41 +36,37 @@ const PrimaryColumn = (options: PolymorphicMetadataInterface): string => export abstract class AbstractPolymorphicRepository extends Repository { private getPolymorphicMetadata(): Array { - let keys = Reflect.getMetadataKeys( + const keys = Reflect.getMetadataKeys( (this.metadata.target as Function)['prototype'], ); - if (!Array.isArray(keys)) { - return []; - } - - keys = keys.filter((key: string) => { - const parts = key.split('::'); - return parts[0] === POLYMORPHIC_OPTIONS; - }); - if (!keys) { return []; } - return keys - .map((key: string): PolymorphicMetadataInterface | undefined => { - const data: PolymorphicMetadataOptionsInterface & { - propertyKey: string; - } = Reflect.getMetadata( - key, - (this.metadata.target as Function)['prototype'], - ); - - if (typeof data === 'object') { - const classType = data.classType(); - return { - ...data, - classType, - }; + return keys.reduce>( + (keys: PolymorphicMetadataInterface[], key: string) => { + if (key.split('::')[0] === POLYMORPHIC_OPTIONS) { + const data: PolymorphicMetadataOptionsInterface & { + propertyKey: string; + } = Reflect.getMetadata( + key, + (this.metadata.target as Function)['prototype'], + ); + + if (data && typeof data === 'object') { + const classType = data.classType(); + keys.push({ + ...data, + classType, + }); + } } - }) - .filter((val) => typeof val !== 'undefined'); + + return keys; + }, + [], + ); } protected isPolymorph(): boolean { From f254768cccfc0a7cb727e8ea1fd238ec8dbb3a4a Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:00:49 +0000 Subject: [PATCH 02/15] refactor: save method clean up --- src/__tests__/polymorphic.repository.spec.ts | 54 ++++++++++--------- src/polymorphic.repository.ts | 56 +++++++++----------- 2 files changed, 54 insertions(+), 56 deletions(-) diff --git a/src/__tests__/polymorphic.repository.spec.ts b/src/__tests__/polymorphic.repository.spec.ts index 805c1aa..9127a68 100644 --- a/src/__tests__/polymorphic.repository.spec.ts +++ b/src/__tests__/polymorphic.repository.spec.ts @@ -4,7 +4,7 @@ import { UserEntity } from './entities/user.entity'; import { config } from 'dotenv'; import { resolve } from 'path'; import { AdvertRepository } from './repository/advert.repository'; -import { AbstractPolymorphicRepository } from '../../dist'; +import { AbstractPolymorphicRepository } from '../'; describe('AbstractPolymorphicRepository', () => { let connection: Connection; @@ -41,38 +41,42 @@ describe('AbstractPolymorphicRepository', () => { ]); }); - describe('child', () => { - it('Can create with parent', async () => { - const repository = connection.getCustomRepository(AdvertRepository); + describe('Childen', () => { + describe('create', () => { + it('Can create with parent', async () => { + const repository = connection.getCustomRepository(AdvertRepository); - const user = new UserEntity(); + const user = new UserEntity(); - const result = repository.create({ - owner: user, - }); + const result = repository.create({ + owner: user, + }); - expect(result).toBeInstanceOf(AdvertEntity); - expect(result.owner).toBeInstanceOf(UserEntity); + expect(result).toBeInstanceOf(AdvertEntity); + expect(result.owner).toBeInstanceOf(UserEntity); + }); }); - it('Can save cascade parent', async () => { - const repository = connection.getCustomRepository(AdvertRepository); - const userRepository = connection.getRepository(UserEntity); + describe('save', () => { + it('Can save cascade parent', async () => { + const repository = connection.getCustomRepository(AdvertRepository); + const userRepository = connection.getRepository(UserEntity); - const user = await userRepository.save(new UserEntity()); + const user = await userRepository.save(new UserEntity()); - const result = await repository.save( - repository.create({ - owner: user, - }), - ); + const result = await repository.save( + repository.create({ + owner: user, + }), + ); - expect(result).toBeInstanceOf(AdvertEntity); - expect(result.owner).toBeInstanceOf(UserEntity); - expect(result.id).toBeTruthy(); - expect(result.owner.id).toBeTruthy(); - expect(result.entityType).toBe(UserEntity.name); - expect(result.entityId).toBe(result.owner.id); + expect(result).toBeInstanceOf(AdvertEntity); + expect(result.owner).toBeInstanceOf(UserEntity); + expect(result.id).toBeTruthy(); + expect(result.owner.id).toBeTruthy(); + expect(result.entityType).toBe(UserEntity.name); + expect(result.entityId).toBe(result.owner.id); + }); }); }); }); diff --git a/src/polymorphic.repository.ts b/src/polymorphic.repository.ts index 280c0c4..3a97047 100644 --- a/src/polymorphic.repository.ts +++ b/src/polymorphic.repository.ts @@ -226,13 +226,9 @@ export abstract class AbstractPolymorphicRepository extends Repository { options?: SaveOptions & { reload: false }, ): Promise<(T & E) | Array | T | Array> { if (!this.isPolymorph()) { - return Array.isArray(entityOrEntities) && options - ? await super.save(entityOrEntities, options) - : Array.isArray(entityOrEntities) - ? await super.save(entityOrEntities) - : options - ? await super.save(entityOrEntities, options) - : await super.save(entityOrEntities); + return Array.isArray(entityOrEntities) + ? super.save(entityOrEntities, options) + : super.save(entityOrEntities, options); } const metadata = this.getPolymorphicMetadata(); @@ -248,6 +244,10 @@ export abstract class AbstractPolymorphicRepository extends Repository { if (!parent || entity[entityIdColumn(options)] !== undefined) { return entity; } + + /** + * Add parent's id and type to child's id and type field + */ entity[entityIdColumn(options)] = parent[PrimaryColumn(options)]; entity[entityTypeColumn(options)] = parent.constructor.name; return entity; @@ -255,46 +255,40 @@ export abstract class AbstractPolymorphicRepository extends Repository { } }); - const savedEntities = - Array.isArray(entityOrEntities) && options - ? await super.save(entityOrEntities, options) - : Array.isArray(entityOrEntities) - ? await super.save(entityOrEntities) - : options - ? await super.save(entityOrEntities, options) - : await super.save(entityOrEntities); - - return savedEntities; - - // return Promise.all( - // (Array.isArray(savedEntities) ? savedEntities : [savedEntities]).map( - // entity => - // new Promise(async resolve => { - // // @ts-ignore - // await this.deletePolymorphs(entity as E, metadata); - // // @ts-ignore - // resolve(await this.savePolymorphs(entity as E, metadata)); - // }), - // ), - // ); + /** + * Check deleteBeforeUpdate + */ + Array.isArray(entityOrEntities) + ? await Promise.all( + (entityOrEntities as Array).map((entity) => + this.deletePolymorphs(entity, metadata), + ), + ) + : await this.deletePolymorphs(entityOrEntities as T, metadata); + + return Array.isArray(entityOrEntities) + ? super.save(entityOrEntities, options) + : super.save(entityOrEntities, options); } private async deletePolymorphs( - entity: E, + entity: DeepPartial, options: PolymorphicMetadataInterface[], ): Promise { await Promise.all( options.map( (option: PolymorphicMetadataInterface) => new Promise((resolve) => { + console.log('delete', option.deleteBeforeUpdate); if (!option.deleteBeforeUpdate) { - return Promise.resolve(); + resolve(Promise.resolve()); } const entityTypes = Array.isArray(option.classType) ? option.classType : [option.classType]; + // resolve to singular query? resolve( Promise.all( entityTypes.map((type: () => Function | Function[]) => { From 1890554f7cf9b031a48467b3026686accd14811b Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:14:37 +0000 Subject: [PATCH 03/15] feat: added more tests --- src/__tests__/polymorphic.repository.spec.ts | 84 ++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/__tests__/polymorphic.repository.spec.ts b/src/__tests__/polymorphic.repository.spec.ts index 9127a68..e7c849f 100644 --- a/src/__tests__/polymorphic.repository.spec.ts +++ b/src/__tests__/polymorphic.repository.spec.ts @@ -42,6 +42,14 @@ describe('AbstractPolymorphicRepository', () => { }); describe('Childen', () => { + // describe('helper methods', () => { + // it('Is child', async () => { + // const repository: AdvertRepository = connection.getCustomRepository(AdvertRepository); + + // expect(repository.isChildren({})).toBeTruthy(); + // }); + // }); + describe('create', () => { it('Can create with parent', async () => { const repository = connection.getCustomRepository(AdvertRepository); @@ -77,6 +85,82 @@ describe('AbstractPolymorphicRepository', () => { expect(result.entityType).toBe(UserEntity.name); expect(result.entityId).toBe(result.owner.id); }); + + it('Can save many with cascade parent', async () => { + const repository = connection.getCustomRepository(AdvertRepository); + const userRepository = connection.getRepository(UserEntity); + + const user = await userRepository.save(new UserEntity()); + + const result = await repository.save([ + repository.create({ + owner: user, + }), + repository.create({ + owner: user, + }), + ]); + + result.forEach((res) => { + expect(res).toBeInstanceOf(AdvertEntity); + expect(res.owner).toBeInstanceOf(UserEntity); + expect(res.id).toBeTruthy(); + expect(res.owner.id).toBeTruthy(); + expect(res.entityType).toBe(UserEntity.name); + expect(res.entityId).toBe(res.owner.id); + }); + }); + }); + + describe('findOne', () => { + it('Can find entity with parent', async () => { + const repository = connection.getCustomRepository(AdvertRepository); + const userRepository = connection.getRepository(UserEntity); + + const user = await userRepository.save(new UserEntity()); + + const advert = await repository.save( + repository.create({ + owner: user, + }), + ); + + const result = await repository.findOne(advert.id); + + expect(result).toBeInstanceOf(AdvertEntity); + expect(result.owner).toBeInstanceOf(UserEntity); + expect(result.owner.id).toBe(result.entityId); + expect(result.entityType).toBe(UserEntity.name); + }); + }); + + describe('find', () => { + it('Can find entities with parent', async () => { + const repository = connection.getCustomRepository(AdvertRepository); + const userRepository = connection.getRepository(UserEntity); + + const user = await userRepository.save(new UserEntity()); + + await repository.save([ + repository.create({ + owner: user, + }), + repository.create({ + owner: user, + }), + ]); + + const result = await repository.find(); + + result.forEach((res) => { + expect(res).toBeInstanceOf(AdvertEntity); + expect(res.owner).toBeInstanceOf(UserEntity); + expect(res.id).toBeTruthy(); + expect(res.owner.id).toBeTruthy(); + expect(res.entityType).toBe(UserEntity.name); + expect(res.entityId).toBe(res.owner.id); + }); + }); }); }); }); From 3565e5d3b9c236cbb2de26b532af4775b999ba7c Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:19:25 +0000 Subject: [PATCH 04/15] chore: updated description --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f244994..ebf1be6 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/bashleigh/typeorm-polymorphic" }, - "description": "A simple pagination function to build a pagination object with types", + "description": "A repository for building typed polymorphic relationships", "keywords": [ "nestjs", "typeorm", From 1c636b78f46c594b1a017de21afdbfa5fb8fdb70 Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:22:50 +0000 Subject: [PATCH 05/15] chore: removed duplicate interface --- src/decorators.ts | 7 +++---- src/polymorphic.interface.ts | 12 +----------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/decorators.ts b/src/decorators.ts index 1ef1d92..74ba630 100644 --- a/src/decorators.ts +++ b/src/decorators.ts @@ -1,7 +1,6 @@ import { POLYMORPHIC_OPTIONS } from './constants'; import { - PolymorphicChildrenDecoratorOptionsInterface, - PolymorphicParentDecoratorOptionsInterface, + PolymorphicDecoratorOptionsInterface, PolymorphicMetadataOptionsInterface, } from './polymorphic.interface'; @@ -21,7 +20,7 @@ const polymorphicPropertyDecorator = ( export const PolymorphicChildren = ( classType: () => Function[] | Function, - options: PolymorphicChildrenDecoratorOptionsInterface = {}, + options: PolymorphicDecoratorOptionsInterface = {}, ): PropertyDecorator => polymorphicPropertyDecorator({ type: 'children', @@ -35,7 +34,7 @@ export const PolymorphicChildren = ( export const PolymorphicParent = ( classType: () => Function[] | Function, - options: PolymorphicParentDecoratorOptionsInterface = {}, + options: PolymorphicDecoratorOptionsInterface = {}, ): PropertyDecorator => polymorphicPropertyDecorator({ type: 'parent', diff --git a/src/polymorphic.interface.ts b/src/polymorphic.interface.ts index df669cb..999fd85 100644 --- a/src/polymorphic.interface.ts +++ b/src/polymorphic.interface.ts @@ -24,17 +24,7 @@ export interface PolymorphicMetadataInterface extends PolymorphicInterface { propertyKey: string; } -export interface PolymorphicChildrenDecoratorOptionsInterface { - primaryColumn?: string; - hasMany?: boolean; - cascade?: boolean; - eager?: boolean; - deleteBeforeUpdate?: boolean; - entityTypeColumn?: string; - entityTypeId?: string; -} - -export interface PolymorphicParentDecoratorOptionsInterface { +export interface PolymorphicDecoratorOptionsInterface { deleteBeforeUpdate?: boolean; primaryColumn?: string; hasMany?: boolean; From 3415a5bfc5f9fb2e6ca4b898aa38381f4ca93cbc Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:23:35 +0000 Subject: [PATCH 06/15] chore: removed unused file --- src/repository.token.exception.ts | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 src/repository.token.exception.ts diff --git a/src/repository.token.exception.ts b/src/repository.token.exception.ts deleted file mode 100644 index abe5503..0000000 --- a/src/repository.token.exception.ts +++ /dev/null @@ -1,13 +0,0 @@ -export class RepositoryTokenNotFoundException extends Error { - constructor(classType: string) { - super( - `Repository token cannot be found for given classType [${classType}]`, - ); - } -} - -export class RepositoryNotFoundException extends Error { - constructor(token: Function | string) { - super(`Repository cannot be found for given token [${token}]`); - } -} From 54d9a4990e28845118dfa1fa89b8c0552d96110e Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:30:20 +0000 Subject: [PATCH 07/15] chore: readded removed file, needed for other exception --- src/repository.token.exception.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/repository.token.exception.ts diff --git a/src/repository.token.exception.ts b/src/repository.token.exception.ts new file mode 100644 index 0000000..f4d3bac --- /dev/null +++ b/src/repository.token.exception.ts @@ -0,0 +1,13 @@ +export class RepositoryTokenNotFoundException extends Error { + constructor(classType: string) { + super( + `Repository token cannot be found for given classType [${classType}]`, + ); + } +} + +export class RepositoryNotFoundException extends Error { + constructor(token: Function | string) { + super(`Repository cannot be found for given token [${token}]`); + } +} From 49733034b02be6c22ffb7696e9bdf92b533017a5 Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:31:05 +0000 Subject: [PATCH 08/15] refactor: added constant for separator --- src/constants.ts | 1 + src/decorators.ts | 4 ++-- src/polymorphic.repository.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index a4ec66c..1505ba7 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1 +1,2 @@ export const POLYMORPHIC_OPTIONS = 'POLYMORPHIC_OPTIONS'; +export const POLYMORPHIC_KEY_SEPARATOR = '::'; diff --git a/src/decorators.ts b/src/decorators.ts index 74ba630..ec4cd6f 100644 --- a/src/decorators.ts +++ b/src/decorators.ts @@ -1,4 +1,4 @@ -import { POLYMORPHIC_OPTIONS } from './constants'; +import { POLYMORPHIC_KEY_SEPARATOR, POLYMORPHIC_OPTIONS } from './constants'; import { PolymorphicDecoratorOptionsInterface, PolymorphicMetadataOptionsInterface, @@ -9,7 +9,7 @@ const polymorphicPropertyDecorator = ( ): PropertyDecorator => (target: Object, propertyKey: string) => { Reflect.defineMetadata(POLYMORPHIC_OPTIONS, true, target); Reflect.defineMetadata( - `${POLYMORPHIC_OPTIONS}::${propertyKey}`, + `${POLYMORPHIC_OPTIONS}${POLYMORPHIC_KEY_SEPARATOR}${propertyKey}`, { propertyKey, ...options, diff --git a/src/polymorphic.repository.ts b/src/polymorphic.repository.ts index 3a97047..c8002ad 100644 --- a/src/polymorphic.repository.ts +++ b/src/polymorphic.repository.ts @@ -9,7 +9,7 @@ import { FindOneOptions, ObjectID, } from 'typeorm'; -import { POLYMORPHIC_OPTIONS } from './constants'; +import { POLYMORPHIC_KEY_SEPARATOR, POLYMORPHIC_OPTIONS } from './constants'; import { PolymorphicChildType, PolymorphicParentType, @@ -46,7 +46,7 @@ export abstract class AbstractPolymorphicRepository extends Repository { return keys.reduce>( (keys: PolymorphicMetadataInterface[], key: string) => { - if (key.split('::')[0] === POLYMORPHIC_OPTIONS) { + if (key.split(POLYMORPHIC_KEY_SEPARATOR)[0] === POLYMORPHIC_OPTIONS) { const data: PolymorphicMetadataOptionsInterface & { propertyKey: string; } = Reflect.getMetadata( From 567cb8588a35024b2f129794c06664ba3afed1b3 Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:31:27 +0000 Subject: [PATCH 09/15] chore: formatting --- src/repository.token.exception.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/repository.token.exception.ts b/src/repository.token.exception.ts index f4d3bac..abe5503 100644 --- a/src/repository.token.exception.ts +++ b/src/repository.token.exception.ts @@ -1,13 +1,13 @@ -export class RepositoryTokenNotFoundException extends Error { - constructor(classType: string) { - super( - `Repository token cannot be found for given classType [${classType}]`, - ); - } -} +export class RepositoryTokenNotFoundException extends Error { + constructor(classType: string) { + super( + `Repository token cannot be found for given classType [${classType}]`, + ); + } +} -export class RepositoryNotFoundException extends Error { - constructor(token: Function | string) { - super(`Repository cannot be found for given token [${token}]`); - } +export class RepositoryNotFoundException extends Error { + constructor(token: Function | string) { + super(`Repository cannot be found for given token [${token}]`); + } } From 712097a19eae1ea0afb5f53159e467253d03d681 Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:35:12 +0000 Subject: [PATCH 10/15] chore: remove unused class --- src/repository.token.exception.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/repository.token.exception.ts b/src/repository.token.exception.ts index abe5503..ab54437 100644 --- a/src/repository.token.exception.ts +++ b/src/repository.token.exception.ts @@ -1,11 +1,3 @@ -export class RepositoryTokenNotFoundException extends Error { - constructor(classType: string) { - super( - `Repository token cannot be found for given classType [${classType}]`, - ); - } -} - export class RepositoryNotFoundException extends Error { constructor(token: Function | string) { super(`Repository cannot be found for given token [${token}]`); From 1ddf43f86e9c5225611ede76d9d80281bea7734f Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:36:21 +0000 Subject: [PATCH 11/15] chore: removed unused commented test --- src/__tests__/polymorphic.repository.spec.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/__tests__/polymorphic.repository.spec.ts b/src/__tests__/polymorphic.repository.spec.ts index e7c849f..ff9babd 100644 --- a/src/__tests__/polymorphic.repository.spec.ts +++ b/src/__tests__/polymorphic.repository.spec.ts @@ -42,13 +42,6 @@ describe('AbstractPolymorphicRepository', () => { }); describe('Childen', () => { - // describe('helper methods', () => { - // it('Is child', async () => { - // const repository: AdvertRepository = connection.getCustomRepository(AdvertRepository); - - // expect(repository.isChildren({})).toBeTruthy(); - // }); - // }); describe('create', () => { it('Can create with parent', async () => { From aca3896792fef02cf1a1c89792edf98f28984a5d Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:37:40 +0000 Subject: [PATCH 12/15] chore: attempt to appease the travis gods --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6369b54..d88977b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ node_js: services: - mysql before_install: + - cp .env.dist .env - mysql -e 'CREATE DATABASE IF NOT EXISTS polymorphic;' - npm i -g npm@latest - npm i -g yarn From 0fcce43334b4d4f6f5e34200669a01b796e247d5 Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 16:39:02 +0000 Subject: [PATCH 13/15] chore: clean up --- src/__tests__/polymorphic.repository.spec.ts | 1 - src/polymorphic.repository.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/__tests__/polymorphic.repository.spec.ts b/src/__tests__/polymorphic.repository.spec.ts index ff9babd..7342e45 100644 --- a/src/__tests__/polymorphic.repository.spec.ts +++ b/src/__tests__/polymorphic.repository.spec.ts @@ -42,7 +42,6 @@ describe('AbstractPolymorphicRepository', () => { }); describe('Childen', () => { - describe('create', () => { it('Can create with parent', async () => { const repository = connection.getCustomRepository(AdvertRepository); diff --git a/src/polymorphic.repository.ts b/src/polymorphic.repository.ts index c8002ad..9a40306 100644 --- a/src/polymorphic.repository.ts +++ b/src/polymorphic.repository.ts @@ -279,7 +279,6 @@ export abstract class AbstractPolymorphicRepository extends Repository { options.map( (option: PolymorphicMetadataInterface) => new Promise((resolve) => { - console.log('delete', option.deleteBeforeUpdate); if (!option.deleteBeforeUpdate) { resolve(Promise.resolve()); } From a506b16b1da4551b202b7b7ca0dc31a775941a10 Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 19:15:56 +0000 Subject: [PATCH 14/15] fix: changed mysql settings for travis --- .env.dist | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.env.dist b/.env.dist index 12b43d2..d912ba7 100644 --- a/.env.dist +++ b/.env.dist @@ -1,14 +1,15 @@ -MYSQL_ROOT_PASSWORD=root MYSQL_DATABASE=polymorphic MYSQL_USER=root -MYSQL_PASSWORD=root +MYSQL_PASSWORD= +MYSQL_ROOT_PASSWORD= +MYSQL_ALLOW_EMPTY_PASSWORD=true TYPEORM_CONNECTION=mysql TYPEORM_HOST=localhost TYPEORM_PORT=3306 TYPEORM_DATABASE=polymorphic TYPEORM_USERNAME=root -TYPEORM_PASSWORD=root +TYPEORM_PASSWORD= TYPEORM_ENTITIES=src/__tests__/**/*.entity.ts TYPEORM_SYNCHRONIZE=true TYPEORM_LOGGING=true From d97c69071ae854537adc9a4cf804f1e0fc4fef6d Mon Sep 17 00:00:00 2001 From: Aaryanna Simonelli Date: Mon, 4 Jan 2021 20:39:02 +0000 Subject: [PATCH 15/15] fix: capital is important for badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b5e8dd..f868bef 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # typeorm-polymorphic - + An extension package for polymorphic relationship management, declaration and repository queries for [typeorm](https://typeorm.io/)