Skip to content

Commit 5e537a8

Browse files
author
hirsch88
committed
Merge branch 'release/1.5.3'
2 parents ce7fc08 + 7ec7b9c commit 5e537a8

File tree

13 files changed

+59
-92
lines changed

13 files changed

+59
-92
lines changed

build/tasks/build.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const gulp = require('gulp');
44
const path = require('path');
55
const runSequence = require('run-sequence');
66
const paths = require('../paths');
7-
const util = require('../util');
87
const $ = require('gulp-load-plugins')({
98
lazy: true
109
});
@@ -48,7 +47,6 @@ function transpiler(filePath, isTest, files) {
4847
'./typings/**/*.d.ts',
4948
path.join(filePath, files)
5049
])
51-
.pipe($.plumber({ errorHandler: $.notify.onError('Error: <%= error.message %>') }))
5250
.pipe($.sourcemaps.init({ loadMaps: true }))
5351
.pipe(tsProject())
5452
.pipe($.sourcemaps.write()) // inline sourcemaps

build/tasks/clean.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const gulp = require('gulp');
44
const path = require('path');
55
const paths = require('../paths');
6-
const util = require('../util');
76
const $ = require('gulp-load-plugins')({
87
lazy: true
98
});

build/tasks/lint.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

build/util.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "express-typescript-boilerplate",
3-
"version": "1.5.2",
3+
"version": "1.5.3",
44
"description": "A delightful way to building a RESTful API with NodeJs & TypeScript",
55
"main": "src/index.ts",
66
"scripts": {
7-
"lint": "./node_modules/.bin/gulp lint",
7+
"lint": "./node_modules/.bin/tslint -c ./tslint.json 'src/**/*.ts' --format stylish --force",
88
"test": "NODE_ENV=test ./node_modules/.bin/jest ./test/unit",
99
"test:pretty": "NODE_ENV=test ./node_modules/.bin/jest ./test/unit --verbose",
1010
"test:coverage": "NODE_ENV=test ./node_modules/.bin/jest ./test/unit --coverage",
@@ -82,7 +82,6 @@
8282
"gulp": "^3.9.1",
8383
"gulp-clean": "^0.3.2",
8484
"gulp-load-plugins": "^1.4.0",
85-
"gulp-notify": "^3.0.0",
8685
"gulp-plumber": "^1.1.0",
8786
"gulp-sourcemaps": "^2.6.0",
8887
"gulp-tslint": "^8.0.0",
@@ -122,7 +121,8 @@
122121
"tsx",
123122
"js",
124123
"json"
125-
]
124+
],
125+
"testEnvironment": "node"
126126
},
127127
"license": "MIT"
128128
}

src/api/controllers/HomeController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { injectable } from 'inversify';
77
* information about this api
88
*/
99
@injectable()
10-
@Controller('/v1')
10+
@Controller('/')
1111
export class HomeController {
1212

1313
@Get('/')

src/api/exceptions/DatabaseException.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Exception } from '../../core/api/Exception';
1010
*/
1111
export class DatabaseException extends Exception {
1212
constructor(text: string, error: any) {
13-
let value: string = error.stack.split('\n')[0];
13+
const value: string = error.stack.split('\n')[0];
1414
super(400, text, [
1515
value.substring(7)
1616
]);

src/api/services/UsersService.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export class UserService {
4242
* @returns {Promise<User>}
4343
*/
4444
public async findOne(id: number): Promise<User> {
45-
let user = await this.userRepo.findOne(id);
45+
const user = await this.userRepo.findOne(id);
46+
console.log(user);
47+
console.log(user === null);
48+
console.log(user === undefined);
4649
if (user === null) {
4750
log.warn(`User with the id=${id} was not found!`);
4851
throw new NotFoundException(id);
@@ -57,7 +60,7 @@ export class UserService {
5760
* @returns {Promise<User>}
5861
*/
5962
public async findByUserId(userId: string): Promise<User> {
60-
let user = await this.userRepo.findByUserId(userId);
63+
const user = await this.userRepo.findByUserId(userId);
6164
if (user === null) {
6265
log.warn(`User with the userId=${userId} was not found!`);
6366
throw new NotFoundException(userId);
@@ -78,7 +81,7 @@ export class UserService {
7881
await request.validate();
7982

8083
// If the request body was valid we will create the user
81-
let user = await this.userRepo.create(data);
84+
const user = await this.userRepo.create(data);
8285
return user;
8386
}
8487

@@ -92,7 +95,7 @@ export class UserService {
9295
*/
9396
public async update(id: number, newUser: any): Promise<User> {
9497
const oldUserModel = await this.findOne(id);
95-
let oldUser = oldUserModel.toJSON();
98+
const oldUser = oldUserModel.toJSON();
9699
const request = new UserUpdateRequest(oldUser);
97100

98101
request.setFirstName(newUser.firstName);
@@ -103,7 +106,7 @@ export class UserService {
103106
await request.validate();
104107

105108
// If the request body was valid we will create the user
106-
let user = await this.userRepo.update(id, request.toJSON());
109+
const user = await this.userRepo.update(id, request.toJSON());
107110
return user;
108111
}
109112

src/core/api/RequestBody.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class RequestBody {
2929
* Validates the body on the basis of the validator-annotations
3030
*/
3131
public async validate(): Promise<void> {
32-
let errors = await validate(this);
32+
const errors = await validate(this);
3333
if (errors && errors.length > 0) {
3434
throw new ValidationException('Request body is not valid', errors);
3535
}
@@ -40,7 +40,7 @@ export class RequestBody {
4040
* Returns a new body object
4141
*/
4242
public toJSON(): any {
43-
let json = {};
43+
const json = {};
4444
const keys = Object.keys(this);
4545
keys.forEach((key) => {
4646
if (this[key] !== undefined) {

src/core/database/ModelFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class ModelFactory {
2323
}
2424

2525
public async create(amount: number = 1): Promise<any> {
26-
let results = <any>[];
26+
const results = <any>[];
2727
for (let i = 0; i < amount; i++) {
2828
const obj = await this.build();
2929
results.push(obj);

0 commit comments

Comments
 (0)