Skip to content

Frontend Developer Test - #11

Open
claudiugabriel15 wants to merge 1 commit into
wearewiser:masterfrom
claudiugabriel15:master
Open

claudiugabriel15 wants to merge 1 commit into
wearewiser:masterfrom
claudiugabriel15:master

Conversation

@claudiugabriel15

Copy link
Copy Markdown

Completed the assignment.

@johnfedoruk johnfedoruk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Testing:

  • Lint: passes
  • test: passes
  • coverage: 89/100
  • build: pass

Manual Review

  • Has Angular animations
  • Good use of services
  • Has auth guards
  • Decent README
  • Good use of forms
  • Lazy loading modules (
  • RxJS looks good
  • Use of local storage for a JWT is a security vulnerability - should use sessionStorage
  • Decent directory structure
  • Good use of typescript features (privacy modifiers / return types / type setting)

Comment thread README.md
- The Secure Module (direcotry path: src/app/secure)

Please commit your code regularly. There is no time limit, though we will be looking at the commit metrics. We will be looking for DRY code and good coding practices with high code coverage. Update the README to explain the code-base.
They are independent of each other and don't share any code.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

) {}

canActivate() {
return this.authService.checkTokenValidity().then(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and concise

import { Account } from './models/account';
import { HttpClient, HttpHeaders } from '@angular/common/http';

import 'rxjs/add/operator/map';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ps: now RxJS says to use Observable pipes for operators


@Injectable()
export class AuthService {
private loginURL = 'https://dev-test-service.madebywiser.com/login';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be loaded from environment - read about defining a static forRoot method in the module class in order to gain access to configuration by the importing module.

Comment thread src/app/app.module.ts
HttpStatusModule
HttpStatusModule,

AuthModule,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hint: Importing the AuthModule kills the benefit of lazy loading. AuthModule should be split into two modules - one that contains the views which can be lazy loaded, and one that contains the services/guards.


const AUTH_ROUTES = [
{
path: 'auth',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be path: '',

trigger('loginFailed', [
state('true', style({
})),
transition('* => true', [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

export class ContentComponent {
public selectedUserId;

users = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would've been good to make a dumb service to provide this data

routeSubscription: any;

// mock user details
users = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would've been good to use a dumb service to provide this


const SECURE_ROUTES = [
{
path: 'secure',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be path: '', - otherwise would not work with lazy-loading without first importing into the parent module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants