diff --git a/extensions/typeorm/README.md b/extensions/typeorm/README.md index 7e6e49fcf7ca..546a70a0cde2 100644 --- a/extensions/typeorm/README.md +++ b/extensions/typeorm/README.md @@ -73,10 +73,11 @@ supported databases and the underlying drivers. ### Creating Entities [Entities](https://typeorm.io/#/entities) are equivalent to LoopBack's Models. -Define the entities as usual and keep them in a directory named `entities`. +Define the entities as usual and keep them in a directory named +`typeorm-entities`. ```ts -// src/entities/book.entity.ts +// src/typeorm-entities/book.entity.ts import {Entity, Column, PrimaryColumn} from 'typeorm'; @Entity() export class Photo { @@ -102,7 +103,7 @@ repository API is 100% TypeORM // src/controllers/book.controller.ts import {get, post, Request, requestBody} from '@loopback/rest'; import {getModelSchema, Repository, typeorm} from '@loopback/typeorm'; -import {Book} from '../entities'; +import {Book} from '../typeorm-entities'; export class BookController { @typeorm.repository(Book) private bookRepo: Repository; diff --git a/extensions/typeorm/package.json b/extensions/typeorm/package.json index d42aafa5c0b7..b7fcae335d0a 100644 --- a/extensions/typeorm/package.json +++ b/extensions/typeorm/package.json @@ -47,6 +47,6 @@ "repository": { "type": "git", "url": "https://github.com/strongloop/loopback-next.git", - "directory": "packages/typeorm" + "directory": "extensions/typeorm" } } diff --git a/extensions/typeorm/src/__tests__/fixtures/application.ts b/extensions/typeorm/src/__tests__/fixtures/application.ts index d9fb63022c74..d4d4725dafa0 100644 --- a/extensions/typeorm/src/__tests__/fixtures/application.ts +++ b/extensions/typeorm/src/__tests__/fixtures/application.ts @@ -1,5 +1,5 @@ -// Copyright IBM Corp. 2019. All Rights Reserved. -// Node module: @loopback/boot +// Copyright IBM Corp. 2020. All Rights Reserved. +// Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT diff --git a/extensions/typeorm/src/__tests__/fixtures/controllers/book.controller.ts b/extensions/typeorm/src/__tests__/fixtures/controllers/book.controller.ts index d5454f80a1d2..c82f071660cf 100644 --- a/extensions/typeorm/src/__tests__/fixtures/controllers/book.controller.ts +++ b/extensions/typeorm/src/__tests__/fixtures/controllers/book.controller.ts @@ -1,11 +1,11 @@ // Copyright IBM Corp. 2020. All Rights Reserved. -// Node module: @loopback/rest +// Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT import {get, param, post, requestBody} from '@loopback/rest'; import {getModelSchema, Repository, typeorm} from '../../../'; -import {Book} from '../entities/book.entity'; +import {Book} from '../typeorm-entities/book.entity'; export class BookController { constructor() {} diff --git a/extensions/typeorm/src/__tests__/fixtures/typeorm-connections/sqlite.connection.ts b/extensions/typeorm/src/__tests__/fixtures/typeorm-connections/sqlite.connection.ts index fdc70233436f..480966c0208e 100644 --- a/extensions/typeorm/src/__tests__/fixtures/typeorm-connections/sqlite.connection.ts +++ b/extensions/typeorm/src/__tests__/fixtures/typeorm-connections/sqlite.connection.ts @@ -1,11 +1,11 @@ // Copyright IBM Corp. 2020. All Rights Reserved. -// Node module: @loopback/boot +// Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT import path from 'path'; import {ConnectionOptions} from '../../../'; -import {Book} from '../entities/book.entity'; +import {Book} from '../typeorm-entities/book.entity'; export const SqliteConnection: ConnectionOptions = { name: 'my-db', diff --git a/extensions/typeorm/src/__tests__/fixtures/entities/book.entity.ts b/extensions/typeorm/src/__tests__/fixtures/typeorm-entities/book.entity.ts similarity index 100% rename from extensions/typeorm/src/__tests__/fixtures/entities/book.entity.ts rename to extensions/typeorm/src/__tests__/fixtures/typeorm-entities/book.entity.ts diff --git a/extensions/typeorm/src/__tests__/integration/booter.integration.ts b/extensions/typeorm/src/__tests__/integration/booter.integration.ts index 534b7ea897dc..b44661606580 100644 --- a/extensions/typeorm/src/__tests__/integration/booter.integration.ts +++ b/extensions/typeorm/src/__tests__/integration/booter.integration.ts @@ -1,5 +1,5 @@ -// Copyright IBM Corp. 2019,2020. All Rights Reserved. -// Node module: @loopback/boot +// Copyright IBM Corp. 2020. All Rights Reserved. +// Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT @@ -33,8 +33,8 @@ describe('TypeORM connection booter integration tests', () => { 'typeorm-connections/sqlite.connection.js', ); await sandbox.copyFile( - resolve(__dirname, '../fixtures/entities/book.entity.js'), - 'entities/book.entity.js', + resolve(__dirname, '../fixtures/typeorm-entities/book.entity.js'), + 'typeorm-entities/book.entity.js', ); const MyApp = require(resolve(sandbox.path, 'application.js')).TypeOrmApp; app = new MyApp(); diff --git a/extensions/typeorm/src/__tests__/integration/rest.integration.ts b/extensions/typeorm/src/__tests__/integration/rest.integration.ts index 55b72c46061e..9f49e04a0b95 100644 --- a/extensions/typeorm/src/__tests__/integration/rest.integration.ts +++ b/extensions/typeorm/src/__tests__/integration/rest.integration.ts @@ -1,5 +1,5 @@ -// Copyright IBM Corp. 2019,2020. All Rights Reserved. -// Node module: @loopback/boot +// Copyright IBM Corp. 2020. All Rights Reserved. +// Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT @@ -56,8 +56,8 @@ describe('REST with TypeORM (integration)', () => { 'typeorm-connections/sqlite.connection.js', ); await sandbox.copyFile( - resolve(__dirname, '../fixtures/entities/book.entity.js'), - 'entities/book.entity.js', + resolve(__dirname, '../fixtures/typeorm-entities/book.entity.js'), + 'typeorm-entities/book.entity.js', ); await sandbox.copyFile( resolve(__dirname, '../fixtures/controllers/book.controller.js'), diff --git a/extensions/typeorm/src/__tests__/unit/booter.unit.ts b/extensions/typeorm/src/__tests__/unit/booter.unit.ts index 18f9ad86fca1..c8a7a7d3660b 100644 --- a/extensions/typeorm/src/__tests__/unit/booter.unit.ts +++ b/extensions/typeorm/src/__tests__/unit/booter.unit.ts @@ -1,5 +1,5 @@ -// Copyright IBM Corp. 2019,2020. All Rights Reserved. -// Node module: @loopback/boot +// Copyright IBM Corp. 2020. All Rights Reserved. +// Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT @@ -38,8 +38,8 @@ describe('TypeORM connection booter unit tests', () => { 'typeorm-connections/sqlite.connection.js', ); await sandbox.copyFile( - resolve(__dirname, '../fixtures/entities/book.entity.js'), - 'entities/book.entity.js', + resolve(__dirname, '../fixtures/typeorm-entities/book.entity.js'), + 'typeorm-entities/book.entity.js', ); const booterInst = new TypeOrmConnectionBooter( normalApp as ApplicationUsingTypeOrm, @@ -85,8 +85,8 @@ describe('TypeORM connection booter unit tests', () => { 'typeorm-connections/sqlite.connection.js', ); await sandbox.copyFile( - resolve(__dirname, '../fixtures/entities/book.entity.js'), - 'entities/book.entity.js', + resolve(__dirname, '../fixtures/typeorm-entities/book.entity.js'), + 'typeorm-entities/book.entity.js', ); const booterInst = new TypeOrmConnectionBooter(app, sandbox.path); const NUM_CONNECTIONS = 1; // 1 connection in above file. diff --git a/extensions/typeorm/src/__tests__/unit/mixin.unit.ts b/extensions/typeorm/src/__tests__/unit/mixin.unit.ts index 55b0953b21bb..ebc4e6b7d97e 100644 --- a/extensions/typeorm/src/__tests__/unit/mixin.unit.ts +++ b/extensions/typeorm/src/__tests__/unit/mixin.unit.ts @@ -1,5 +1,5 @@ -// Copyright IBM Corp. 2019,2020. All Rights Reserved. -// Node module: @loopback/boot +// Copyright IBM Corp. 2020. All Rights Reserved. +// Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT diff --git a/extensions/typeorm/src/index.ts b/extensions/typeorm/src/index.ts index 08b3f4c6a5a6..d8d49c59bd20 100644 --- a/extensions/typeorm/src/index.ts +++ b/extensions/typeorm/src/index.ts @@ -1,9 +1,9 @@ -// Copyright IBM Corp. 2017,2020. All Rights Reserved. +// Copyright IBM Corp. 2020. All Rights Reserved. // Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -export * from './typeorm.booter'; +export * from './typeorm-connection.booter'; export * from './typeorm.decorators'; export * from './typeorm.keys'; export * from './typeorm.mixin'; diff --git a/extensions/typeorm/src/typeorm.booter.ts b/extensions/typeorm/src/typeorm-connection.booter.ts similarity index 100% rename from extensions/typeorm/src/typeorm.booter.ts rename to extensions/typeorm/src/typeorm-connection.booter.ts diff --git a/extensions/typeorm/src/typeorm.mixin.ts b/extensions/typeorm/src/typeorm.mixin.ts index b08830777fc2..6b0250e6a39c 100644 --- a/extensions/typeorm/src/typeorm.mixin.ts +++ b/extensions/typeorm/src/typeorm.mixin.ts @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2018,2020. All Rights Reserved. +// Copyright IBM Corp. 2020. All Rights Reserved. // Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT diff --git a/extensions/typeorm/src/typeorm.utils.ts b/extensions/typeorm/src/typeorm.utils.ts index 86a7d8e6be92..aaa5d6c9ccd8 100644 --- a/extensions/typeorm/src/typeorm.utils.ts +++ b/extensions/typeorm/src/typeorm.utils.ts @@ -1,4 +1,4 @@ -// Copyright IBM Corp. 2017,2020. All Rights Reserved. +// Copyright IBM Corp. 2020. All Rights Reserved. // Node module: @loopback/typeorm // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT