Skip to content

Commit

Permalink
chore(): update to 0.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic-Preap committed Sep 13, 2021
1 parent 2c1ea1f commit 91dbd62
Show file tree
Hide file tree
Showing 33 changed files with 2,852 additions and 3,351 deletions.
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged

21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# CHANGELOG

## 0.13.0

_*Sep 14, 2021*_

- upgrade **@nestjs** to v8
- upgrade `husky` to v7
- add `@nest/axios` for HttpModule (Wowza, Sendbird, Social)
- fix some errors and typo of typescript
- fix deprecation of rxjs `.toPromise()` to `lastValueFrom()`
- update dependencies in `package.json`
- update plopfile on replace dependencies below
- replace dependencies
- `twitter` to `twitter-api-v2`
- `i18next-express-middleware` to `i18next-http-middleware`
- `i18next-node-fs-backend` to `i18next-fs-backend`
- `keycloak-admin` to `@keycloak/keycloak-admin-client`
- remove dependencies
- `@types/mongoose`
- `@types/socket.io`
- `@types/socket.io-redis`

## 0.12.2

_*Jun 21, 2021*_
Expand Down
177 changes: 85 additions & 92 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "backend-core-project",
"description": "backend-core-project description",
"version": "0.12.2",
"version": "0.13.0",
"private": true,
"engines": {
"node": ">= 12.13.0"
Expand All @@ -20,13 +20,8 @@
"e2e": "jest --config=e2e/jest-e2e.json --forceExit --detectOpenHandles",
"e2e:watch": "jest --watch --config=e2e/jest-e2e.json",
"compodoc": "compodoc -p tsconfig.json -s",
"generate": "plop"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS"
}
"generate": "plop",
"prepare": "husky install"
},
"lint-staged": {
"*.ts": [
Expand All @@ -39,122 +34,120 @@
"dependencies": {
"@aws/dynamodb-data-mapper": "0.7.3",
"@aws/dynamodb-data-mapper-annotations": "0.7.3",
"@google-cloud/storage": "5.8.5",
"@nestjs/common": "7.6.15",
"@nestjs/config": "0.6.3",
"@nestjs/core": "7.6.15",
"@nestjs/jwt": "7.2.0",
"@nestjs/passport": "7.1.5",
"@nestjs/platform-express": "7.6.15",
"@nestjs/platform-socket.io": "7.6.15",
"@nestjs/schedule": "0.4.3",
"@nestjs/sequelize": "0.2.0",
"@nestjs/swagger": "4.8.0",
"@nestjs/typeorm": "7.1.5",
"@nestjs/websockets": "7.6.15",
"@typegoose/typegoose": "7.6.0",
"@google-cloud/storage": "5.14.1",
"@keycloak/keycloak-admin-client": "^15.0.2",
"@nestjs/axios": "^0.0.1",
"@nestjs/common": "8.0.6",
"@nestjs/config": "1.0.1",
"@nestjs/core": "8.0.6",
"@nestjs/jwt": "8.0.0",
"@nestjs/passport": "8.0.1",
"@nestjs/platform-express": "8.0.6",
"@nestjs/platform-socket.io": "8.0.6",
"@nestjs/schedule": "1.0.1",
"@nestjs/sequelize": "8.0.0",
"@nestjs/swagger": "5.0.9",
"@nestjs/typeorm": "8.0.2",
"@nestjs/websockets": "8.0.6",
"@typegoose/typegoose": "8.3.0",
"archiver": "5.3.0",
"auth0": "2.34.2",
"aws-sdk": "2.904.0",
"auth0": "2.36.1",
"aws-sdk": "2.987.0",
"bcryptjs": "2.4.3",
"cache-manager": "3.4.3",
"callsites": "3.1.0",
"cache-manager": "3.4.4",
"callsites": "4.0.0",
"class-transformer": "0.4.0",
"class-validator": "0.13.1",
"compression": "1.7.4",
"cross-env": "7.0.3",
"debug": "4.3.1",
"exceljs": "4.2.1",
"firebase-admin": "9.8.0",
"debug": "4.3.2",
"exceljs": "4.3.0",
"firebase-admin": "9.11.1",
"form-data": "4.0.0",
"google-auth-library": "7.0.4",
"graphql-request": "3.4.0",
"google-auth-library": "7.9.1",
"graphql-request": "3.5.0",
"helmet": "4.6.0",
"html-entities": "2.3.2",
"i18next": "20.2.2",
"i18next-express-middleware": "2.0.0",
"i18next-node-fs-backend": "2.1.3",
"ioredis": "4.27.2",
"jwks-rsa": "2.0.3",
"keycloak-admin": "1.14.16",
"libphonenumber-js": "1.9.17",
"i18next": "20.6.1",
"i18next-fs-backend": "^1.1.1",
"i18next-http-middleware": "^3.1.4",
"ioredis": "4.27.9",
"jwks-rsa": "2.0.4",
"libphonenumber-js": "1.9.32",
"lodash": "4.17.21",
"mime-types": "2.1.30",
"mime-types": "2.1.32",
"moment": "2.29.1",
"moment-range": "4.0.2",
"moment-timezone": "0.5.33",
"mongoose": "5.10.18",
"mongoose": "5.13.8",
"morgan": "1.10.0",
"mysql2": "2.2.5",
"node-media-server": "2.2.5",
"nodemailer": "6.6.0",
"openid-client": "4.7.3",
"mysql2": "2.3.0",
"node-media-server": "2.3.8",
"nodemailer": "6.6.3",
"openid-client": "4.7.5",
"passport": "0.4.1",
"passport-jwt": "4.0.0",
"pdfmake": "0.1.71",
"pdfmake": "0.2.2",
"pug": "3.0.2",
"randomatic": "3.1.1",
"reflect-metadata": "0.1.13",
"rxjs": "6.6.3",
"sanitize-html": "2.3.3",
"rxjs": "7.3.0",
"sanitize-html": "2.5.0",
"sequelize": "6.6.2",
"sequelize-typescript": "2.1.0",
"sharp": "0.28.2",
"sharp": "0.29.1",
"shelljs": "0.8.4",
"soap": "0.37.0",
"socket.io-redis": "6.1.0",
"soap": "0.42.0",
"socket.io-redis": "6.1.1",
"string-template": "1.0.0",
"swagger-ui-express": "4.1.6",
"twilio": "3.62.0",
"twitter": "1.7.1",
"typeorm": "0.2.32"
"twilio": "3.67.2",
"twitter-api-v2": "^1.5.1",
"typeorm": "0.2.37"
},
"devDependencies": {
"@commitlint/cli": "11.0.0",
"@commitlint/config-angular": "11.0.0",
"@commitlint/cli": "13.1.0",
"@commitlint/config-angular": "13.1.0",
"@commitlint/config-conventional": "11.0.0",
"@nestjs/cli": "7.6.0",
"@nestjs/testing": "7.6.15",
"@types/archiver": "5.1.0",
"@types/auth0": "2.33.3",
"@nestjs/cli": "8.1.1",
"@nestjs/testing": "8.0.6",
"@types/archiver": "5.1.1",
"@types/auth0": "2.33.5",
"@types/bcryptjs": "2.4.2",
"@types/compression": "1.7.0",
"@types/express": "4.17.11",
"@types/html-entities": "1.2.16",
"@types/ioredis": "4.26.3",
"@types/jest": "26.0.23",
"@types/lodash": "4.14.168",
"@types/mime-types": "2.1.0",
"@types/mongoose": "5.10.5",
"@types/morgan": "1.9.2",
"@types/multer": "1.4.5",
"@types/node": "15.0.2",
"@types/nodemailer": "6.4.1",
"@types/passport-jwt": "3.0.5",
"@types/pug": "2.0.4",
"@types/compression": "1.7.2",
"@types/express": "4.17.13",
"@types/html-entities": "1.3.4",
"@types/ioredis": "4.27.2",
"@types/jest": "27.0.1",
"@types/lodash": "4.14.172",
"@types/mime-types": "2.1.1",
"@types/morgan": "1.9.3",
"@types/multer": "1.4.7",
"@types/node": "16.9.1",
"@types/nodemailer": "6.4.4",
"@types/passport-jwt": "3.0.6",
"@types/pug": "2.0.5",
"@types/sanitize-html": "^2.3.1",
"@types/sharp": "0.28.1",
"@types/shelljs": "0.8.8",
"@types/socket.io": "2.1.13",
"@types/socket.io-redis": "1.0.27",
"@types/sharp": "0.29.1",
"@types/shelljs": "0.8.9",
"@types/string-template": "1.0.2",
"@types/supertest": "2.0.11",
"@types/uuid": "8.3.0",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"eslint": "7.26.0",
"@types/uuid": "8.3.1",
"@typescript-eslint/eslint-plugin": "4.31.1",
"@typescript-eslint/parser": "4.31.1",
"eslint": "7.32.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-prettier": "3.4.0",
"graphql": "15.5.0",
"husky": "4.3.6",
"jest": "26.6.3",
"lint-staged": "10.5.3",
"eslint-plugin-import": "2.24.2",
"eslint-plugin-prettier": "4.0.0",
"graphql": "15.5.3",
"husky": "^7.0.0",
"jest": "27.2.0",
"lint-staged": "11.1.2",
"plop": "2.7.4",
"prettier": "2.3.0",
"supertest": "6.1.3",
"ts-jest": "26.5.6",
"ts-loader": "9.1.2",
"typescript": "4.2.4"
"prettier": "2.4.0",
"supertest": "6.1.6",
"ts-jest": "27.0.5",
"ts-loader": "9.2.5",
"typescript": "4.4.3"
}
}
16 changes: 7 additions & 9 deletions plopfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,19 +328,19 @@ module.exports = function (
keycloak: [
'@nestjs/passport',
'jwks-rsa',
'keycloak-admin',
'@keycloak/keycloak-admin-client',
'openid-client',
'passport',
'passport-jwt',
'@types/passport-jwt'
],
i18next: ['i18next', 'i18next-express-middleware', 'i18next-node-fs-backend'],
i18next: ['i18next', 'i18next-http-middleware', 'i18next-fs-backend'],
ioredis: ['ioredis', '@types/ioredis'],
jwt: [],
mailer: ['nodemailer', '@types/nodemailer'],
mongoose: ['mongoose', '@typegoose/typegoose', '@types/mongoose'],
mongoose: ['mongoose', '@typegoose/typegoose'],
pagination: [],
sendbird: ['form-data'],
sendbird: ['@nestjs/axios', 'form-data'],
sequelize: [
'callsites',
'mysql2',
Expand All @@ -351,21 +351,19 @@ module.exports = function (
'@types/node',
'@types/string-template'
],
social: ['google-auth-library', 'twitter'],
social: ['@nestjs/axios', 'google-auth-library', 'twitter-api-v2'],
socket: [
'@nestjs/websockets',
'@nestjs/platform-socket.io',
'@types/socket.io',
'socket.io-redis',
'@types/socket.io-redis'
],
tile38: ['ioredis', '@types/ioredis'],
typeorm: ['@nestjs/typeorm', 'mysql2', 'typeorm', 'callsites'],
twilio: ['twilio'],
wowza: [],
wowza: ['@nestjs/axios'],
// -------------------------------------------------
'cache-manager': ['cache-manager'],
'sanitize-html': ['sanitize-html', '@types/sanitize-html', 'html-entities', '@types/html-entities'],
'sanitize-html': ['sanitize-html', '@types/sanitize-html', 'html-entities'],
archiver: ['archiver', '@types/archiver'],
dayoff: ['moment-range'],
excel: ['exceljs'],
Expand Down
2 changes: 1 addition & 1 deletion src/api/auth/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class AuthGuard implements CanActivate {
try {
decoded = await this.service.verifyAsync<JWTPayload>(token);
console.log('jwtDecoded', decoded);
} catch (e) {
} catch (e: any) {
throw new UnauthorizedException(e.name + ' ' + e.message);
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/auth/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('AuthService', () => {
it('should throw error when account is incorrect', async () => {
try {
await authService.login({ username: 'fake', password: 'wrong' });
} catch (e) {
} catch (e: any) {
expect(e).toBeInstanceOf(InvalidAccountError);
expect(e.message).toMatch('Invalid username or password.');
}
Expand Down
10 changes: 6 additions & 4 deletions src/api/auth/google-api.guard.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { HttpService } from '@nestjs/axios';
import {
CanActivate,
ExecutionContext,
ForbiddenException,
HttpService,
Injectable,
UnauthorizedException
} from '@nestjs/common';
import { Request } from 'express';
import { lastValueFrom } from 'rxjs';

@Injectable()
export class GoogleAPIGuard implements CanActivate {
Expand Down Expand Up @@ -34,9 +35,10 @@ export class GoogleAPIGuard implements CanActivate {

async decode(token: string) {
try {
const { data } = await this.http
.get<GoogleTokenInfo>(this.URL, { params: { id_token: token } })
.toPromise();
const { data } = await lastValueFrom(
this.http.get<GoogleTokenInfo>(this.URL, { params: { id_token: token } })
);

return data;
} catch (error) {
throw new UnauthorizedException('Cannot validate token from google');
Expand Down
2 changes: 1 addition & 1 deletion src/api/upload/upload.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class UploadController {
@ApiFileBody('filename')
@ApiOperation({ summary: 'Upload CSV file' })
@UseInterceptors(FileInterceptor('filename', CSVMulterOption))
uploadVideo(@UploadedFile() file: Express.Multer.File) {
uploadCSV(@UploadedFile() file: Express.Multer.File) {
return this.service.upload(file, 'csv');
}
}
Loading

0 comments on commit 91dbd62

Please sign in to comment.