From a72bce583862ed1902ee81974d7b530e7caac4d1 Mon Sep 17 00:00:00 2001 From: doug-martin Date: Tue, 28 Apr 2020 16:09:20 -0500 Subject: [PATCH] feat(sequelize): More clean up of code --- .github/workflows/test-e2e.yml | 1 + examples/nest-graphql-sequelize/e2e/sub-task.resolver.spec.ts | 3 +-- examples/nest-graphql-sequelize/package.json | 2 +- .../__tests__/__fixtures__/sequelize.fixture.ts | 2 +- packages/query-sequelize/src/query/filter-query.builder.ts | 2 +- packages/query-sequelize/src/query/where.builder.ts | 2 -- .../query-sequelize/src/services/sequelize-query.service.ts | 2 +- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 6e4327043..d8cdcffb9 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -23,6 +23,7 @@ jobs: - run: docker-compose -f ./examples/nest-graphql-typeorm/docker-compose.yml up -d - run: docker-compose -f ./examples/federation/docker-compose.yml up -d - run: docker-compose -f ./examples/nest-graphql-typeorm-soft-delete/docker-compose.yml up -d + - run: docker-compose -f ./examples/nest-graphql-sequelize/docker-compose.yml up -d - run: npm ci - run: npm run bootstrap -- --ignore-scripts - run: npm run build diff --git a/examples/nest-graphql-sequelize/e2e/sub-task.resolver.spec.ts b/examples/nest-graphql-sequelize/e2e/sub-task.resolver.spec.ts index 446ca8a48..e0296a751 100644 --- a/examples/nest-graphql-sequelize/e2e/sub-task.resolver.spec.ts +++ b/examples/nest-graphql-sequelize/e2e/sub-task.resolver.spec.ts @@ -1,7 +1,6 @@ import { Test } from '@nestjs/testing'; import request from 'supertest'; import { INestApplication, ValidationPipe } from '@nestjs/common'; -import { Connection } from 'typeorm'; import { Sequelize } from 'sequelize-typescript'; import { AppModule } from '../src/app.module'; import { refresh } from './fixtures'; @@ -30,7 +29,7 @@ describe('SubTaskResolver (sequelize - e2e)', () => { await refresh(app.get(Sequelize)); }); - afterAll(() => refresh(app.get(Connection))); + afterAll(() => refresh(app.get(Sequelize))); const subTasks = [ { id: '1', title: 'Create Nest App - Sub Task 1', completed: true, description: null, todoItemId: 1 }, diff --git a/examples/nest-graphql-sequelize/package.json b/examples/nest-graphql-sequelize/package.json index 4351a143e..9bc9b5b72 100644 --- a/examples/nest-graphql-sequelize/package.json +++ b/examples/nest-graphql-sequelize/package.json @@ -21,7 +21,7 @@ "@nestjs/core": "7.0.9", "@nestjs/graphql": "7.3.4", "@nestjs/platform-express": "7.0.9", - "@nestjs/typeorm": "7.0.0", + "@nestjs/sequelize": "0.1.0", "apollo-server-express": "2.12.0", "graphql": "15.0.0", "graphql-tools": "5.0.0", diff --git a/packages/query-sequelize/__tests__/__fixtures__/sequelize.fixture.ts b/packages/query-sequelize/__tests__/__fixtures__/sequelize.fixture.ts index 42585ab39..40e5aa5c5 100644 --- a/packages/query-sequelize/__tests__/__fixtures__/sequelize.fixture.ts +++ b/packages/query-sequelize/__tests__/__fixtures__/sequelize.fixture.ts @@ -1,4 +1,4 @@ -// this is needed to create a query builder in typeorm :( +// this is needed to create a query builder in sequelize :( import { Sequelize } from 'sequelize-typescript'; import { TestEntityTestRelationEntity } from './test-entity-test-relation.entity'; import { TestRelation } from './test-relation.entity'; diff --git a/packages/query-sequelize/src/query/filter-query.builder.ts b/packages/query-sequelize/src/query/filter-query.builder.ts index 4cd25f624..d1dd2ea4a 100644 --- a/packages/query-sequelize/src/query/filter-query.builder.ts +++ b/packages/query-sequelize/src/query/filter-query.builder.ts @@ -5,7 +5,7 @@ import { WhereBuilder } from './where.builder'; /** * @internal * - * Interface that for Typeorm query builders that are sortable. + * Interface that for `sequelize` query builders that are sortable. */ interface Sortable { order?: Order; diff --git a/packages/query-sequelize/src/query/where.builder.ts b/packages/query-sequelize/src/query/where.builder.ts index 9a6f9219d..708d77aa3 100644 --- a/packages/query-sequelize/src/query/where.builder.ts +++ b/packages/query-sequelize/src/query/where.builder.ts @@ -11,7 +11,6 @@ export class WhereBuilder { /** * Builds a WHERE clause from a Filter. - * @param where - the `typeorm` WhereExpression * @param filter - the filter to build the WHERE clause from. */ build(filter: Filter): WhereOptions { @@ -40,7 +39,6 @@ export class WhereBuilder { /** * Creates field comparisons from a filter. This method will ignore and/or properties. - * @param where - the `typeorm` WhereExpression * @param filter - the filter with fields to create comparisons for. */ private filterFields(filter: Filter): WhereOptions | undefined { diff --git a/packages/query-sequelize/src/services/sequelize-query.service.ts b/packages/query-sequelize/src/services/sequelize-query.service.ts index b2290b93f..6f5f02fc9 100644 --- a/packages/query-sequelize/src/services/sequelize-query.service.ts +++ b/packages/query-sequelize/src/services/sequelize-query.service.ts @@ -5,7 +5,7 @@ import { FilterQueryBuilder } from '../query'; import { RelationQueryService } from './relation-query.service'; /** - * Base class for all query services that use a `typeorm` Repository. + * Base class for all query services that use a `sequelize` Model. * * @example *