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
import { Controller, Get, Post, Body, Put, Delete, Param } from '@nestjs/common'; | |
import { InMemoryDBService } from '@nestjs-addons/in-memory-db'; | |
import { ProductEntity } from './product/entities/product.entity'; | |
import { AppService } from './app.service'; | |
@Controller() | |
export class AppController { | |
constructor(private readonly appService: AppService, | |
private productService: InMemoryDBService<ProductEntity>) { | |
} |
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
import { Controller, Get, Post, Body } from '@nestjs/common'; | |
import { InMemoryDBService } from '@nestjs-addons/in-memory-db'; | |
import { ProductEntity } from './product/entities/product.entity'; | |
import { AppService } from './app.service'; | |
@Controller() | |
export class AppController { | |
constructor(private readonly appService: AppService, | |
private productService: InMemoryDBService<ProductEntity>) {} | |
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
import { InMemoryDBEntity } from '@nestjs-addons/in-memory-db'; | |
export interface ProductEntity extends InMemoryDBEntity { | |
name: string; | |
price: number; | |
seller: string; | |
discount: number; | |
} |
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
import { LoggerService } from '../logger/logger.service'; | |
@Injectable() | |
export class ProductService { | |
constructor(@Inject(PRODUCT) product: Product, | |
private loggerService: LoggerService) { | |
} | |
} |
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
import { LoggerService } from '../logger/logger.service'; | |
@Controller('product') | |
export class ProductController { | |
constructor(private productService: ProductService, | |
private loggerService: LoggerService) { } | |
} |
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
import { Injectable, Scope } from '@nestjs/common'; | |
@Injectable({ | |
scope: Scope.REQUEST | |
}) | |
export class LoggerService { | |
constructor() { | |
console.log('new instance of request') | |
} | |
} |
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
import { ClientService } from "./client/client.service"; | |
import { DbproviderService } from "./dbprovider/dbprovider.service"; | |
export const dbConnectionFactory = { | |
provide: 'ClientConnection', | |
useFactory : (clientSerice: ClientService) => { | |
return new DbproviderService(clientSerice.getClientDetails().db); | |
}, | |
inject: [ClientService] | |
} |
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
import { Injectable } from '@nestjs/common'; | |
@Injectable() | |
export class DbproviderService { | |
constructor(private connection: string) { } | |
getProductsForClient() { | |
return this.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
import { Injectable } from '@nestjs/common'; | |
@Injectable() | |
export class ClientService { | |
getClientDetails() { | |
return { | |
client: 'test', | |
db: 'databaseconnection' | |
} |
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
import { Component } from '@angular/core'; | |
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; | |
import { Observable } from 'rxjs'; | |
import { map, shareReplay } from 'rxjs/operators'; | |
import { ScullyRoutesService } from '@scullyio/ng-lib'; | |
@Component({ | |
selector: 'app-main-nav', | |
templateUrl: './main-nav.component.html', | |
styleUrls: ['./main-nav.component.css'] |