Skip to content

Commit

Permalink
Update Nest.js deps (#637)
Browse files Browse the repository at this point in the history
* Upgrade Nest dependencies

via `nest update -f -t latest` (see
nestjs/nest-cli#321 (comment))

TypeORM was also upgraded separately via `yarn upgrade --latest typeorm`
since it seems it was installed as a sibling dependency (see
10fcff9#diff-d57c900a61f2746ea3823bed028e1d81004e1e077149e4b4935269ffb39383e8)
which is also how the docs indicate it should be done (see
https://docs.nestjs.com/techniques/database).

* Update Nest dependency types and fix import

Nest was failing to build since `HandlebarsAdapter` is no longer
exported from the same module. The import was updated as per the current
docs: https://nest-modules.github.io/mailer/docs/mailer

`handlebars` was also added as a peer dependency since the docs said it
should be installed if it is used (there was also a warning about this).

* Downgrade from @nextjs/crud alpha version to stable

* Downgrade to avoid regression in minor version of @nestjsx/crud

When moving to 4.6.1+ an error is thrown at runtime when we try to list
projects:

server_1    | QueryFailedError: column Project.undefined does not exist

This is related to the filtering of the project controller. In looking
at the WHERE condition in the query to fetch the projects we can see
where the query is being built incorrectly (a column
`"Project"."undefined"` is referenced):

server_1    | query failed: SELECT "Project"."id" AS "Project_id",
"Project"."name" AS "Project_name", "Project"."number_of_districts" AS

...

"regionConfig"."id"="Project"."region_config_id"  INNER JOIN "user"
"project_user" ON "project_user"."id"="Project"."user_id" WHERE
("Project"."undefined" = $1) ORDER BY "Project"."updated_dt" DESC --
PARAMETERS: ["07f9966f-facf-42ce-a4ee-48320007f1cc"]

It seems like this should work fine since `user_id` is indeed a column
on the project.

An issue was created for this here:
nestjsx/crud#684

* Finish upgrading all Nest.js deps

This makes it so that all deps which can be upgraded are upgraded.

`class-transformer` had to be held back because upgrading it caused
`@nestjsx/crud-typeorm` to throw an error since it seems to depend on an
older version.

* Pin to exact versions

* Update changelog
  • Loading branch information
pcaisse committed Mar 23, 2021
1 parent e44dd64 commit 32cbc74
Show file tree
Hide file tree
Showing 5 changed files with 737 additions and 761 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update ESLint rules to prohibit console.log, allow conditional statements [#580](https://github.com/PublicMapping/districtbuilder/pull/580)
- Prevent unverified users from joining an organization or using a template [#591](https://github.com/PublicMapping/districtbuilder/pull/591)
- Project districts geojson is now cached in the project table when updated [#594](https://github.com/PublicMapping/districtbuilder/pull/594)
- Upgrade NestJS deps [#637](https://github.com/PublicMapping/districtbuilder/pull/637)

### Fixed

Expand Down
57 changes: 29 additions & 28 deletions src/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,40 @@
"dependencies": {
"@drdgvhbh/postgres-error-codes": "0.0.6",
"@godaddy/terminus": "4.3.1",
"@nestjs-modules/mailer": "1.4.2",
"@nestjs/common": "7.0.9",
"@nestjs/core": "7.0.9",
"@nestjs/jwt": "7.0.0",
"@nestjs/passport": "7.0.0",
"@nestjs/platform-express": "7.0.9",
"@nestjs/serve-static": "2.1.0",
"@nestjs/swagger": "4.5.4",
"@nestjs/terminus": "7.0.1",
"@nestjs/typeorm": "7.0.0",
"@nestjsx/crud": "4.5.0",
"@nestjsx/crud-typeorm": "4.5.0",
"@nestjs-modules/mailer": "1.5.1",
"@nestjs/common": "7.6.14",
"@nestjs/core": "7.6.14",
"@nestjs/jwt": "7.2.0",
"@nestjs/passport": "7.1.5",
"@nestjs/platform-express": "7.6.14",
"@nestjs/serve-static": "2.1.4",
"@nestjs/swagger": "4.7.16",
"@nestjs/terminus": "7.1.0",
"@nestjs/typeorm": "7.1.5",
"@nestjsx/crud": "4.6.0",
"@nestjsx/crud-typeorm": "4.6.0",
"@turf/area": "6.0.1",
"@turf/length": "6.0.2",
"@turf/polygon-to-line": "6.0.3",
"aws-sdk": "2.616.0",
"base64url": "3.0.1",
"bcrypt": "5.0.0",
"class-transformer": "0.3.1",
"class-validator": "0.12.2",
"class-validator": "0.13.1",
"crypto": "1.0.1",
"csv-stringify": "5.5.1",
"geojson2shp": "^0.3.2",
"geojson2shp": "0.3.2",
"handlebars": "4.7.7",
"lodash": "4.17.19",
"nodemailer": "6.4.6",
"passport": "0.4.1",
"passport-jwt": "4.0.0",
"pg": "7.17.1",
"pg": "8.5.1",
"reflect-metadata": "0.1.13",
"rollbar": "2.19.2",
"rxjs": "6.5.4",
"rxjs": "6.6.6",
"topojson-client": "3.1.0",
"typeorm": "0.2.22"
"typeorm": "0.2.31"
},
"devDependencies": {
"@nestjs/cli": "7.1.5",
Expand All @@ -69,19 +70,19 @@
"@types/jest": "24.9.1",
"@types/lodash": "4.14.149",
"@types/node": "12.12.6",
"@types/nodemailer": "6.4.0",
"@types/passport-jwt": "3.0.3",
"@types/nodemailer": "6.4.1",
"@types/passport-jwt": "3.0.5",
"@types/supertest": "2.0.8",
"@types/topojson-client": "3.0.0",
"@typescript-eslint/eslint-plugin": "^3.0.2",
"@typescript-eslint/parser": "^3.0.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-functional": "^3.0.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsdoc": "^26.0.0",
"eslint-plugin-prefer-arrow": "^1.2.1",
"eslint-plugin-prettier": "^3.1.3",
"@typescript-eslint/eslint-plugin": "3.0.2",
"@typescript-eslint/parser": "3.0.2",
"eslint": "6.8.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-functional": "3.0.1",
"eslint-plugin-import": "2.20.2",
"eslint-plugin-jsdoc": "26.0.0",
"eslint-plugin-prefer-arrow": "1.2.1",
"eslint-plugin-prettier": "3.1.3",
"jest": "24.9.0",
"prettier": "1.19.1",
"supertest": "4.0.2",
Expand Down
3 changes: 2 additions & 1 deletion src/server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ServeStaticModule } from "@nestjs/serve-static";
import { TerminusModule } from "@nestjs/terminus";
import { TypeOrmModule } from "@nestjs/typeorm";

import { HandlebarsAdapter, MailerModule } from "@nestjs-modules/mailer";
import { MailerModule } from "@nestjs-modules/mailer";
import { HandlebarsAdapter } from "@nestjs-modules/mailer/dist/adapters/handlebars.adapter";
import { SES } from "aws-sdk";
import * as SESTransport from "nodemailer/lib/ses-transport";
import * as StreamTransport from "nodemailer/lib/stream-transport";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { RegionConfigsService } from "../services/region-configs.service";
})
@UseGuards(JwtAuthGuard)
@Controller("api/region-configs")
// @ts-ignore
export class RegionConfigsController implements CrudController<RegionConfig> {
get base(): CrudController<RegionConfig> {
return this;
Expand Down

0 comments on commit 32cbc74

Please sign in to comment.