-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mongodb): Add basic support for MongoDB
- Loading branch information
1 parent
30a5b7c
commit ce4c5e9
Showing
13 changed files
with
866 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
parserOptions: { | ||
project: './tsconfig.build.json', | ||
}, | ||
rules: { | ||
'jest/expect-expect': [ | ||
'error', | ||
{ | ||
assertFunctionNames: [ | ||
'expect', | ||
], | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,277 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [0.18.1](https://github.com/doug-martin/nestjs-query/compare/v0.18.0...v0.18.1) (2020-08-14) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
# [0.18.0](https://github.com/doug-martin/nestjs-query/compare/v0.17.10...v0.18.0) (2020-08-11) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **type:** Pin dev dependencies ([442db4c](https://github.com/doug-martin/nestjs-query/commit/442db4cd9b9d48d0c6a20209f0b44c4a314660ac)) | ||
|
||
|
||
### Features | ||
|
||
* **typeorm:** Switch to use unioned queries for relations ([327c676](https://github.com/doug-martin/nestjs-query/commit/327c6760e3e1a7db6bb0f872928d0502345c925f)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.17.10](https://github.com/doug-martin/nestjs-query/compare/v0.17.9...v0.17.10) (2020-08-01) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.17.8](https://github.com/doug-martin/nestjs-query/compare/v0.17.7...v0.17.8) (2020-07-28) | ||
|
||
|
||
### Features | ||
|
||
* **graphql:** Allow specifying allowed comparisons on filterable fields ([ced2792](https://github.com/doug-martin/nestjs-query/commit/ced27920e5c2278c2a04c027a692e25b3306f6cb)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.17.7](https://github.com/doug-martin/nestjs-query/compare/v0.17.6...v0.17.7) (2020-07-27) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.17.2](https://github.com/doug-martin/nestjs-query/compare/v0.17.1...v0.17.2) (2020-07-17) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **typeorm:** Ensure record is entity instance when saving ([3cdbbaf](https://github.com/doug-martin/nestjs-query/commit/3cdbbaff11b18bcc5e6fd29fd182e2bd66b14f17)), closes [#380](https://github.com/doug-martin/nestjs-query/issues/380) | ||
|
||
|
||
|
||
|
||
|
||
# [0.17.0](https://github.com/doug-martin/nestjs-query/compare/v0.16.2...v0.17.0) (2020-07-16) | ||
|
||
|
||
### Features | ||
|
||
* **aggregations:** Add aggregations to graphql ([af075d2](https://github.com/doug-martin/nestjs-query/commit/af075d2e93b6abbbfbe32afcc917350f803fadaa)) | ||
* **aggregations,typeorm:** Add relation aggregation to typeorm ([2bf35a9](https://github.com/doug-martin/nestjs-query/commit/2bf35a92ce80b1f3026fd87cb62cad17eb6eff03)) | ||
* **aggretations:** Add aggregations support to typeorm ([7233c23](https://github.com/doug-martin/nestjs-query/commit/7233c2397d0ac332e5209ab87ae62f5f555609d6)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.16.2](https://github.com/doug-martin/nestjs-query/compare/v0.16.1...v0.16.2) (2020-07-09) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.16.1](https://github.com/doug-martin/nestjs-query/compare/v0.16.0...v0.16.1) (2020-07-07) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **typeorm:** Fix import path in relation service [#363](https://github.com/doug-martin/nestjs-query/issues/363) ([0e6d484](https://github.com/doug-martin/nestjs-query/commit/0e6d484920960ed1966360a89af979230667b5f7)) | ||
|
||
|
||
|
||
|
||
|
||
# [0.16.0](https://github.com/doug-martin/nestjs-query/compare/v0.15.1...v0.16.0) (2020-07-05) | ||
|
||
|
||
### Features | ||
|
||
* **typeorm:** Add support for filtering on relations ([aa8788c](https://github.com/doug-martin/nestjs-query/commit/aa8788cbbc0c95465e1633b57ca48c91b160038a)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.15.1](https://github.com/doug-martin/nestjs-query/compare/v0.15.0...v0.15.1) (2020-06-27) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
# [0.15.0](https://github.com/doug-martin/nestjs-query/compare/v0.14.3...v0.15.0) (2020-06-23) | ||
|
||
|
||
### Features | ||
|
||
* **graphql,connection:** Add totalCount to connections ([ed1e84a](https://github.com/doug-martin/nestjs-query/commit/ed1e84a2feb6f89c3b270fcbc1d0eaf6aec5e575)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.14.2](https://github.com/doug-martin/nestjs-query/compare/v0.14.1...v0.14.2) (2020-06-19) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **typeorm:** Allow using string based typeorm relations ([55c157d](https://github.com/doug-martin/nestjs-query/commit/55c157dbea9ce8c1186a2c2ea17f847857fd2226)) | ||
|
||
|
||
|
||
|
||
|
||
# [0.14.0](https://github.com/doug-martin/nestjs-query/compare/v0.13.2...v0.14.0) (2020-06-18) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
# [0.13.0](https://github.com/doug-martin/nestjs-query/compare/v0.12.0...v0.13.0) (2020-06-12) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
# [0.12.0](https://github.com/doug-martin/nestjs-query/compare/v0.11.8...v0.12.0) (2020-06-07) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.11.8](https://github.com/doug-martin/nestjs-query/compare/v0.11.7...v0.11.8) (2020-05-30) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.11.7](https://github.com/doug-martin/nestjs-query/compare/v0.11.6...v0.11.7) (2020-05-29) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.11.6](https://github.com/doug-martin/nestjs-query/compare/v0.11.5...v0.11.6) (2020-05-26) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.11.5](https://github.com/doug-martin/nestjs-query/compare/v0.11.4...v0.11.5) (2020-05-21) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.11.4](https://github.com/doug-martin/nestjs-query/compare/v0.11.3...v0.11.4) (2020-05-19) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.11.3](https://github.com/doug-martin/nestjs-query/compare/v0.11.2...v0.11.3) (2020-05-16) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.11.2](https://github.com/doug-martin/nestjs-query/compare/v0.11.1...v0.11.2) (2020-05-14) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.11.1](https://github.com/doug-martin/nestjs-query/compare/v0.11.0...v0.11.1) (2020-05-11) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
# [0.11.0](https://github.com/doug-martin/nestjs-query/compare/v0.10.2...v0.11.0) (2020-05-09) | ||
|
||
|
||
### Features | ||
|
||
* **graphql:** Add graphql module ([282c421](https://github.com/doug-martin/nestjs-query/commit/282c421d0e6f67fe750fa6005f6cb7d960c8fbd0)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.10.2](https://github.com/doug-martin/nestjs-query/compare/v0.10.1...v0.10.2) (2020-05-04) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
# [0.10.0](https://github.com/doug-martin/nestjs-query/compare/v0.9.0...v0.10.0) (2020-04-29) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
# [0.9.0](https://github.com/doug-martin/nestjs-query/compare/v0.8.9...v0.9.0) (2020-04-26) | ||
|
||
|
||
### Features | ||
|
||
* **typeorm:** Add support for soft deletes ([2ab42fa](https://github.com/doug-martin/nestjs-query/commit/2ab42faee2802abae4d8496e2529b8eb23860ed4)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.8.9](https://github.com/doug-martin/nestjs-query/compare/v0.8.8...v0.8.9) (2020-04-24) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm | ||
|
||
|
||
|
||
|
||
|
||
## [0.8.7](https://github.com/doug-martin/nestjs-query/compare/v0.8.6...v0.8.7) (2020-04-23) | ||
|
||
**Note:** Version bump only for package @nestjs-query/query-typeorm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<p align="center"> | ||
<a href="https://doug-martin.github.io/nestjs-query" target="blank"><img src="https://doug-martin.github.io/nestjs-query/img/logo.svg" width="120" alt="Nestjs-query Logo" /></a> | ||
</p> | ||
|
||
[](https://www.npmjs.org/package/@nestjs-query/query-typeorm) | ||
[](https://github.com/doug-martin/nestjs-query/actions?query=workflow%3ATest+and+branch%3Amaster+) | ||
[](https://coveralls.io/github/doug-martin/nestjs-query?branch=master) | ||
[](https://snyk.io/test/github/doug-martin/nestjs-query?targetFile=packages/query-typeorm/package.json) | ||
|
||
# `@nestjs-query/query-typeorm` | ||
|
||
The `query-typeorm` package that provides an implementation of `@nestjs-query/core` `QueryService`, built on top of of [nestjs](https://nestjs.com/) and [typeorm](https://typeorm.io/). | ||
|
||
## Installation | ||
|
||
[Install Guide](https://doug-martin.github.io/nestjs-query/docs/introduction/install) | ||
|
||
## Getting Started | ||
|
||
The get started with the `@nestjs-query/query-typeorm` package checkout the [Getting Started](https://doug-martin.github.io/nestjs-query/docs/persistence/typeorm/getting-started) docs. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { NestjsQueryTypeOrmMongoModule } from '../src'; | ||
|
||
describe('NestjsQueryTypeOrmMongoModule', () => { | ||
it('should create a module', () => { | ||
class TestEntity {} | ||
const typeOrmModule = NestjsQueryTypeOrmMongoModule.forFeature([TestEntity]); | ||
expect(typeOrmModule.imports).toHaveLength(1); | ||
expect(typeOrmModule.module).toBe(NestjsQueryTypeOrmMongoModule); | ||
expect(typeOrmModule.providers).toHaveLength(1); | ||
expect(typeOrmModule.exports).toHaveLength(2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { getQueryServiceToken } from '@nestjs-query/core'; | ||
import { getRepositoryToken } from '@nestjs/typeorm'; | ||
import { Repository } from 'typeorm'; | ||
import { mock, instance } from 'ts-mockito'; | ||
import { createTypeOrmMongoQueryServiceProviders } from '../src/providers'; | ||
import { TypeOrmMongoQueryService } from '../src/services'; | ||
|
||
describe('createTypeOrmMongoQueryServiceProviders', () => { | ||
it('should create a provider for the entity', () => { | ||
class TestEntity {} | ||
const mockRepo = mock<Repository<TestEntity>>(Repository); | ||
const providers = createTypeOrmMongoQueryServiceProviders([TestEntity]); | ||
expect(providers).toHaveLength(1); | ||
expect(providers[0].provide).toBe(getQueryServiceToken(TestEntity)); | ||
expect(providers[0].inject).toEqual([getRepositoryToken(TestEntity)]); | ||
expect(providers[0].useFactory(instance(mockRepo))).toBeInstanceOf(TypeOrmMongoQueryService); | ||
}); | ||
}); |
Oops, something went wrong.