forked from ecaminero/nestjs-ddd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test providers and fix multiple connection errors
- Loading branch information
ecaminero
committed
Jul 7, 2019
1 parent
30b6b5e
commit 7b23f59
Showing
15 changed files
with
286 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,16 +7,104 @@ | |
POST http://{{host}} HTTP/1.1 | ||
Content-Type: {{contentType}} | ||
|
||
{ | ||
"name": "Waldo Daniel", | ||
"lastname": "Schmeler", | ||
"age": 19436, | ||
"picture": "http://lorempixel.com/640/480", | ||
"company": "Borer - Jakubowski", | ||
"email": "[email protected]", | ||
"phone": "1-961-579-6644", | ||
"balance": "795.61" | ||
{ | ||
"name" : "Mertie Beier Sr.", | ||
"lastname" : "Ziemann", | ||
"age" : 90402, | ||
"picture" : "http://lorempixel.com/640/480", | ||
"company" : "Schaefer LLC", | ||
"email" : "[email protected]", | ||
"phone" : "1-666-252-6434 x715", | ||
"balance" : "934.61", | ||
"jobTitle" : "Direct Infrastructure Assistant", | ||
"avatar" : "https://s3.amazonaws.com/uifaces/faces/twitter/coderdiaz/128.jpg", | ||
"ipv6" : "4e82:20d3:2695:6a75:a5a4:0ad9:bc26:2e35", | ||
"id" : "cb9d7866-a355-4c6c-9a69-4d8a7d97620b", | ||
"finance" : { | ||
"account" : "23856570", | ||
"accountName" : "Money Market Account" | ||
}, | ||
"address" : { | ||
"zipCode" : "35626", | ||
"city" : "West Elnora", | ||
"streetAddress" : "968 Emmerich Points", | ||
"country" : "Czech Republic" | ||
}, | ||
"shopping" : [ | ||
{ | ||
"productName" : "Intelligent Frozen Chips", | ||
"price" : "664.00", | ||
"productAdjective" : "Tasty", | ||
"productMaterial" : "Steel", | ||
"product" : "Sausages", | ||
"department" : "Beauty" | ||
}, | ||
{ | ||
"productName" : "Unbranded Cotton Keyboard", | ||
"price" : "401.00", | ||
"productAdjective" : "Rustic", | ||
"productMaterial" : "Soft", | ||
"product" : "Bacon", | ||
"department" : "Electronics" | ||
}, | ||
{ | ||
"productName" : "Licensed Concrete Computer", | ||
"price" : "772.00", | ||
"productAdjective" : "Sleek", | ||
"productMaterial" : "Cotton", | ||
"product" : "Computer", | ||
"department" : "Beauty" | ||
}, | ||
{ | ||
"productName" : "Fantastic Frozen Cheese", | ||
"price" : "789.00", | ||
"productAdjective" : "Handcrafted", | ||
"productMaterial" : "Plastic", | ||
"product" : "Fish", | ||
"department" : "Beauty" | ||
}, | ||
{ | ||
"productName" : "Tasty Frozen Shoes", | ||
"price" : "422.00", | ||
"productAdjective" : "Awesome", | ||
"productMaterial" : "Frozen", | ||
"product" : "Chicken", | ||
"department" : "Baby" | ||
}, | ||
{ | ||
"productName" : "Gorgeous Plastic Mouse", | ||
"price" : "317.00", | ||
"productAdjective" : "Sleek", | ||
"productMaterial" : "Wooden", | ||
"product" : "Salad", | ||
"department" : "Computers" | ||
}, | ||
{ | ||
"productName" : "Practical Cotton Fish", | ||
"price" : "174.00", | ||
"productAdjective" : "Practical", | ||
"productMaterial" : "Fresh", | ||
"product" : "Bike", | ||
"department" : "Books" | ||
}, | ||
{ | ||
"productName" : "Refined Plastic Hat", | ||
"price" : "170.00", | ||
"productAdjective" : "Sleek", | ||
"productMaterial" : "Soft", | ||
"product" : "Chips", | ||
"department" : "Music" | ||
}, | ||
{ | ||
"productName" : "Tasty Soft Pizza", | ||
"price" : "223.00", | ||
"productAdjective" : "Incredible", | ||
"productMaterial" : "Cotton", | ||
"product" : "Mouse", | ||
"department" : "Movies" | ||
} | ||
], | ||
"__v" : 0 | ||
} | ||
|
||
### Get all services | ||
GET http://localhost:4000/all HTTP/1.1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import * as dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
export const SERVICE = 'DB_MONGO_SERVICE'; | ||
export const APP_NAME = process.env.APP_NAME || 'mongo.database.service'; | ||
export const DATABASE_SERVICE = process.env.DATABASE_SERVICE || 'DATABASE_SERVICE'; | ||
export const MONGO_DB_SERVER = process.env.MONGO_DB_SERVER || 'mongodb://localhost/walmartpci'; | ||
export const APP_PORT = process.env.PORT || 4000; | ||
export const DB_SERVER = process.env.DB_SERVER || 'mongodb://localhost/testing'; | ||
export const APP_PORT = process.env.PORT || 4000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import * as mongoose from 'mongoose'; | ||
import { MONGO_DB_SERVER } from './../config'; | ||
import { DB_SERVER } from './../config'; | ||
|
||
export const databaseProviders = [{ | ||
provide: 'DATABASE_CONNECTION', | ||
useFactory: async (): Promise<typeof mongoose> => | ||
await mongoose.connect(MONGO_DB_SERVER, { useNewUrlParser: true }), | ||
await mongoose.connect(DB_SERVER, { useNewUrlParser: true }), | ||
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { UserController } from './user.controller'; | ||
import { UserService } from './user.service'; | ||
import { MongooseModule } from '@nestjs/mongoose'; | ||
import { UserSchema } from './schemas/user.schema'; | ||
const schemas = [ | ||
{ name: 'User', schema: UserSchema }, | ||
]; | ||
import { DatabaseModule } from '../database/database.module'; | ||
import { userProviders } from './user.provider'; | ||
|
||
@Module({ | ||
imports: [MongooseModule.forFeature(schemas)], | ||
imports: [DatabaseModule], | ||
controllers: [UserController], | ||
providers: [ | ||
UserService, | ||
...userProviders, | ||
], | ||
}) | ||
export class UserModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Connection } from 'mongoose'; | ||
import { UserSchema } from './schemas/user.schema'; | ||
|
||
export const userProviders = [ | ||
{ | ||
provide: 'USER_MODEL', | ||
useFactory: (connection: Connection) => connection.model('User', UserSchema), | ||
inject: ['DATABASE_CONNECTION'], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.