Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaicaaan committed Jan 4, 2018
1 parent 3a9b44c commit adf406e
Show file tree
Hide file tree
Showing 27 changed files with 45 additions and 71 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"tslint.autoFixOnSave": true
}
2 changes: 1 addition & 1 deletion config/ormconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"port": 5432,
"username": "sample",
"password": "sample",
"database": "sample-test",
"database": "sample",
"synchronize": true,
"logging": true
}
15 changes: 3 additions & 12 deletions config/ormconfig.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,9 @@
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "jmsantos17",
"username": "sample",
"password": "sample",
"database": "sample",
"synchronize": true,
"logging": false,
"entities": [
"dist/entities/*.js"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
]
"logging": false
}
5 changes: 0 additions & 5 deletions local.md

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"@types/mocha": "^2.2.44",
"@types/node": "^8.0.56",
"chai": "^4.1.2",
"chakram": "^1.5.0",
"cross-env": "^5.1.3",
"gulp": "^3.9.1",
"gulp-delete-lines": "0.0.7",
Expand Down
5 changes: 2 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'reflect-metadata';
import { Container } from 'typedi';
import { bootstrapContainers } from './lib/bootstrap-containers';
import { bootstrapDB } from './lib/bootstrap-db';
import { BootstrapServer } from './lib/bootstrap-server';

import { bootstrapContainers, bootstrapDB, BootstrapServer } from './utils';

bootstrapContainers();

Expand Down
1 change: 1 addition & 0 deletions src/controllers/user/deleteUser.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { JsonController, Param, Post } from 'routing-controllers';
import { OrmRepository } from 'typeorm-typedi-extensions';

import { UserRepository } from '../../repositories';

@JsonController('/users/:id')
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/user/getUser.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Get, JsonController, QueryParam, Req, QueryParams } from 'routing-controllers';
import { Get, JsonController, QueryParam, QueryParams } from 'routing-controllers';
import { OrmRepository } from 'typeorm-typedi-extensions';

import { UserRepository } from '../../repositories';

@JsonController('/users')
Expand All @@ -11,8 +12,7 @@ export class GetUserController {

@Get()
async execute(
@QueryParams() query: any,
@Req() request: any
@QueryParams() query: any
) {
const users = await this.userRepository.getUsers(query.options);
return users;
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/user/postUser.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { JsonController, Post, Body } from 'routing-controllers';
import { Body, JsonController, Post } from 'routing-controllers';
import { Service } from 'typedi';
import { OrmRepository } from 'typeorm-typedi-extensions';

import { User } from '../../entities';
import { UserRepository } from '../../repositories';

Expand Down
1 change: 1 addition & 0 deletions src/entities/accessToken.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Column, Entity, ManyToOne, PrimaryColumn, PrimaryGeneratedColumn } from 'typeorm';

import { User } from '../entities';

@Entity()
Expand Down
1 change: 1 addition & 0 deletions src/entities/role.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';

import { RoleMapping } from '../entities';

@Entity()
Expand Down
1 change: 1 addition & 0 deletions src/entities/roleMapping.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';

import { Role, User } from '../entities';

@Entity()
Expand Down
1 change: 1 addition & 0 deletions src/entities/user.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';

import { AccessToken, RoleMapping } from '../entities';

@Entity()
Expand Down
2 changes: 0 additions & 2 deletions src/middlewares/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/middlewares/intro.middleware.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/repositories/user.repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Service } from 'typedi';
import { EntityRepository, Repository, FindManyOptions } from 'typeorm';
import { EntityRepository, FindManyOptions, Repository } from 'typeorm';
import { OrmRepository } from 'typeorm-typedi-extensions';

import { User } from '../entities';

@EntityRepository(User)
Expand Down
6 changes: 2 additions & 4 deletions src/server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'reflect-metadata';

import { Container } from 'typedi';
import { bootstrapContainers } from './lib/bootstrap-containers';
import { bootstrapDB } from './lib/bootstrap-db';
import { BootstrapServer } from './lib/bootstrap-server';

import { bootstrapContainers, bootstrapDB, BootstrapServer } from './utils';

bootstrapContainers();

Expand Down
4 changes: 2 additions & 2 deletions src/tests/after.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Container } from "typedi";
import { Connection } from "typeorm";
import { Container } from 'typedi';
import { Connection } from 'typeorm';

after(async () => {
const dbConnection = Container.get(Connection);
Expand Down
8 changes: 3 additions & 5 deletions src/tests/before.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Container } from "typedi/Container";
import { BootstrapServer } from "../lib/bootstrap-server";
import { Container } from 'typedi/Container';
import { Connection } from 'typeorm';

import { bootstrapDB } from "../lib/bootstrap-db";
import { Connection } from "typeorm";
import { bootstrapContainers } from "../lib/bootstrap-containers";
import { bootstrapContainers, bootstrapDB, BootstrapServer } from '../utils';

before(async () => {
bootstrapContainers();
Expand Down
12 changes: 5 additions & 7 deletions src/tests/user/deleteUser.controller.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'reflect-metadata';
import supertest = require('supertest');
import { expect } from 'chai'

import { Container } from 'typedi/Container';
import { BootstrapServer } from '../../lib/bootstrap-server';
import { expect } from 'chai';
import { Container } from 'typedi';
import { Connection } from 'typeorm';

import { User } from '../../entities';
import { bootstrapContainers } from '../../lib/bootstrap-containers';
import { bootstrapDB } from '../../lib/bootstrap-db';
import { BootstrapServer } from '../../utils';

const app = Container.get(BootstrapServer).bootApp();
const server = supertest(app);
Expand All @@ -31,7 +29,7 @@ describe('#deleteUserController', () => {
const response = await server
.post('/users/' + createdUser.id)
.expect(200);
const options = { where: { id: createdUser.id } }
const options = { where: { id: createdUser.id } };
const findResponse = await server
.get('/users/')
.query({ options })
Expand Down
10 changes: 4 additions & 6 deletions src/tests/user/getUser.controller.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'reflect-metadata';
import supertest = require('supertest');
import { expect } from 'chai'

import { Container } from 'typedi/Container';
import { BootstrapServer } from '../../lib/bootstrap-server';
import { expect } from 'chai';
import { Container } from 'typedi';
import { Connection } from 'typeorm';

import { User } from '../../entities';
import { bootstrapContainers } from '../../lib/bootstrap-containers';
import { bootstrapDB } from '../../lib/bootstrap-db';
import { BootstrapServer } from '../../utils';

const app = Container.get(BootstrapServer).bootApp();
const server = supertest(app);
Expand Down
10 changes: 4 additions & 6 deletions src/tests/user/postUser.controller.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import 'reflect-metadata';
import supertest = require('supertest');
import { expect } from 'chai'

import { Container } from 'typedi/Container';
import { BootstrapServer } from '../../lib/bootstrap-server';
import { expect } from 'chai';
import { Container } from 'typedi';
import { Connection } from 'typeorm';
import { bootstrapContainers } from '../../lib/bootstrap-containers';
import { bootstrapDB } from '../../lib/bootstrap-db';

import { BootstrapServer } from '../../utils';

const app = Container.get(BootstrapServer).bootApp();
const server = supertest(app);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './bootstrap-containers';
export * from './bootstrap-db';
export * from './bootstrap-server';
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es2016",
"module": "commonjs",
"sourceMap": true,
"outDir": "./dist",
Expand All @@ -9,7 +9,7 @@
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"lib": [
"es2015"
"es6"
]
},
"exclude": [
Expand Down

0 comments on commit adf406e

Please sign in to comment.