Skip to content

Commit

Permalink
Updated package.json (#2)(#66)
Browse files Browse the repository at this point in the history
* Updated BaseEntity navigation properties to reference User type

* Used auto mapper's array mapper for mapping array to DTO

* Removed vscode local settings from version control

* Updated createdBy field in user entity

* Added user auto mapper profile

* Added user auto mapper profile

* Updated package.json and set tenant and user globally. Closes #16, closes #17

* Implement save or update feature. Closes #11

* Moved hooks to base entity class and implemented soft-delete

* Implement soft delete feature. Closes #56

* Fixed #63, and refactor some part of test files (#14)

* A sample swagger integration/implementation (#2)

* A sample swagger integration/implementation (#2)

* Fix breaking change

* Implement auto swagger generation

* Sample swagger doc integration/implementation #2 #66

* Refactoring

* Updated NPM package and refactor test
  • Loading branch information
ofuochi authored Oct 14, 2019
1 parent 1dbea51 commit 809885d
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 20 deletions.
62 changes: 56 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"no-build": "npx ts-node src/index.ts",
"non-build:start": "npx ts-code src/index.ts",
"nyc": "nyc npm run test",
"rm-files": "rm -r -f coverage .nyc_output dist",
"start": "npm run rm-files && npm run tsc && npm run start-node",
"clean": "rimraf coverage .nyc_output dist",
"start": "npm run clean && npm run tsc && npm run start-node",
"dev": "nodemon -e ts --exec \"npx ts-node -r tsconfig-paths/register -T --pretty --project tsconfig.json src/index.ts\"",
"start-node": "node dist/src/index.js",
"test": "ts-mocha --paths",
"test-watch": "nodemon -e ts --exec \"ts-mocha --paths\"",
"test-cover": "npm run rm-files && npm run nyc",
"test-cover": "npm run clean && npm run nyc",
"tsc": "tsc -p tsconfig.json",
"lint": "eslint \"**/*.ts\"",
"build": "npm run lint && npm run tsc",
Expand All @@ -55,7 +55,7 @@
"@hapi/joi": "^16.1.7",
"@hasezoey/typegoose": "^5.9.2",
"agenda": "^2.1.0",
"automapper-nartc": "^3.1.2",
"automapper-nartc": "^4.0.0",
"bcrypt": "^3.0.6",
"body-parser": "^1.19.0",
"class-transformer": "^0.2.3",
Expand All @@ -76,6 +76,7 @@
"method-override": "^3.0.0",
"mongoose": "^5.7.4",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.0",
"swagger-ui-express": "^4.1.2",
"tsconfig-paths": "^3.9.0",
"tsoa": "^2.5.6",
Expand Down
1 change: 0 additions & 1 deletion src/infrastructure/bootstrapping/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Container, ContainerModule, decorate, injectable } from "inversify";
import { buildProviderModule } from "inversify-binding-decorators";
import { InversifyExpressServer } from "inversify-express-utils";
import swaggerUi from "swagger-ui-express";

import { Controller } from "tsoa";
import swaggerJsonDoc from "../../../swagger.json";
import { TYPES } from "../../domain/constants/types";
Expand Down
6 changes: 5 additions & 1 deletion src/infrastructure/config/swagger.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { X_TENANT_ID } from "../../ui/constants/header_constants";

const basePath = config.api.prefix;
const entryFile = "./src/index.ts";
const protocol =
process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test"
? "http"
: "https";
export const swaggerGen = async () => {
const swaggerOptions: SwaggerConfig = {
basePath,
Expand All @@ -31,7 +35,7 @@ export const swaggerGen = async () => {
version: "1.0.0",
name: "node-typescript-boilerplate",
specVersion: 3,
schemes: ["http", "https"],
schemes: [protocol],
tags: [
{
name: "Foos",
Expand Down
21 changes: 13 additions & 8 deletions test/infrastructure/db/repository/tenant_repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@ describe("Tenant Repository", () => {
username: "admin"
};
});
it("should create user using the foo endpoint", async () => {
const tenant = await tenantRepository.findOneByQuery({ name: "T2" });
const { body } = await req
.post(`${endpoint}/auth/signUp`)
.send(signUpInput)
.set(X_TENANT_ID, tenant.id)
.expect(httpStatus.OK);
userDto = body.userDto;
it("should create user using the foo endpoint", done => {
tenantRepository
.findOneByQuery({ name: "T2" })
.then(async tenant => {
const { body } = await req
.post(`${endpoint}/auth/signUp`)
.send(signUpInput)
.set(X_TENANT_ID, tenant.id)
.expect(httpStatus.OK);
userDto = body.userDto;
done();
})
.catch(done);
});

it("should get all the tenants but without the deleted ones", async () => {
Expand Down

0 comments on commit 809885d

Please sign in to comment.