Skip to content

Commit

Permalink
fix(nestjs): fix typescript types
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Sep 20, 2018
1 parent 6904ba9 commit 97f855a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions PLAYBOOK-NEST.md
Expand Up @@ -3,6 +3,8 @@ DIY NestJS Playbook

creating NestJS project and generate nest artifacts with-in monorepo.

> An Introduction to [NestJS](https://www.joshmorony.com/an-introduction-to-nestjs-for-ionic-developers/)
### Prerequisites

#### Install Global Packages
Expand Down
2 changes: 1 addition & 1 deletion PLAYBOOK.md
Expand Up @@ -101,7 +101,7 @@ ng update --all
# also run `npm outdated` and update versions in package.json then run `npm install`

# generate webapp app
ng g app webapp --routing --style=scss --prefix=ngx --tags=app-module
ng g app webapp --routing --style=scss --prefix=ngx --unit-test-runner=jest --tags=app-module

# add Jest to replace karma as testing framework
ng generate jest
Expand Down
10 changes: 3 additions & 7 deletions apps/api/src/core/interceptors/transform.interceptor.ts
Expand Up @@ -3,13 +3,9 @@ import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { classToPlain } from 'class-transformer';

export interface Response<T> {
data: T;
}

@Injectable()
export class TransformInterceptor<T> implements NestInterceptor<T, Response<T>> {
intercept(context: ExecutionContext, call$: Observable<T>): Observable<Response<T>> {
return call$.pipe(map((data: Observable<T>) => classToPlain(data, { excludePrefixes: ['_id'] })));
export class TransformInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, call$: Observable<any>): Observable<any> {
return call$.pipe(map(data => classToPlain(data, { excludePrefixes: ['_id'] })));
}
}
5 changes: 5 additions & 0 deletions stories/faq.md
Expand Up @@ -59,6 +59,7 @@ once you are conferable , then you can delete demo `default` app
> Read [medium-clap](https://medium.com/@yonatandoron/how-i-implemented-the-medium-clap-from-scratch-4a16ac90ad3b)
> Read [Must-have animations for Chatbots](https://uxdesign.cc/must-have-animations-for-chatbots-15c031fd6bd3)
> Read [The ultimate guide to proper use of animation in UX](https://uxdesign.cc/the-ultimate-guide-to-proper-use-of-animation-in-ux-10bd98614fa9)
> Read [Microinteractions: small details matter](https://uxdesign.cc/microinteractions-detailed-design-9113c88946d0)
* Why I Prefer NGXS over NGRX
> Read [NGXS vs NGRX](https://blog.singular.uk/why-i-prefer-ngxs-over-ngrx-df727cd868b5?gi=405262c5a9c5)
Expand Down Expand Up @@ -151,6 +152,10 @@ semantic-release is a fully automated library/system for versioning, changelog g
> Refer [Example 1](https://github.com/angular-university/angular-material-course/tree/2-data-table-finished/src/app/course)
> Refer [Example 2](https://github.com/angular/material2/blob/master/src/material-examples/table-http/table-http-example.ts)
* How to setup NestJS Project?

> Refer [An Introduction to NestJS](https://www.joshmorony.com/an-introduction-to-nestjs-for-ionic-developers/)
* Shoud I use mergeMap or concatMap or switchMap or forkJoin for my usecase?

> *Short Answer*: concatMap for writes, mergeMap for reads, switchMap when you have to cancel http call.
Expand Down

0 comments on commit 97f855a

Please sign in to comment.