Skip to content

Commit

Permalink
style(app): format code
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Oct 26, 2018
1 parent 3679b2c commit f0c14a7
Show file tree
Hide file tree
Showing 24 changed files with 116 additions and 79 deletions.
30 changes: 22 additions & 8 deletions apps/api/src/auth/user.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,34 @@ export enum AccountSourceType {
@Entity('user')
export class User extends Base {
@ApiModelProperty({ type: String })
@IsString() @IsNotEmpty()
@Index() @Column() firstName: string;
@IsString()
@IsNotEmpty()
@Index()
@Column()
firstName: string;

@ApiModelProperty({ type: String })
@IsString() @IsNotEmpty()
@Index() @Column() lastName: string;
@IsString()
@IsNotEmpty()
@Index()
@Column()
lastName: string;

@ApiModelProperty({ type: String, minLength: 10, maxLength: 100 })
@IsEmail() @IsNotEmpty()
@Index() @Column() email: string;
@IsEmail()
@IsNotEmpty()
@Index()
@Column()
email: string;

@ApiModelProperty({ type: String, minLength: 8, maxLength: 20 })
@IsAscii() @IsNotEmpty() @MinLength(8) @MaxLength(20)
@Index({ unique: true }) @Column() userId: string;
@IsAscii()
@IsNotEmpty()
@MinLength(8)
@MaxLength(20)
@Index({ unique: true })
@Column()
userId: string;

@CreateDateColumn()
createdAt?: Date;
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/core/crud/crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export abstract class CrudService<T extends Base> implements ICrudService<T> {
return records;
}

public async getOne(filter: string ): Promise<T> {
public async getOne(filter: string): Promise<T> {
const record = await this.repository.findOne(filter);
if (!record) {
throw new NotFoundException(`The requested record was not found`);
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const environment = {
production: true
production: true,
};
2 changes: 1 addition & 1 deletion apps/backend/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// The list of file replacements can be found in `angular.json`.

export const environment = {
production: false
production: false,
};
4 changes: 2 additions & 2 deletions apps/backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const app = express();

const corsOptions = {
origin: '*',
optionsSuccessStatus: 200
optionsSuccessStatus: 200,
};

app.use(cors(corsOptions));
Expand All @@ -18,7 +18,7 @@ app.get('/', (req, res) => {
});

const port = 8000;
app.listen(port, (err) => {
app.listen(port, err => {
if (err) {
console.error(err);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/backend/src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export default function upload(req, res) {
});

form.on('end', () => {
res.status(204).json({'message' : 'success' });
res.status(204).json({ message: 'success' });
});

form.on('error', (err) => {
form.on('error', err => {
console.log('An error has occured: \n' + err);
});

Expand Down
13 changes: 7 additions & 6 deletions apps/webapp/src/styles/fu/_var.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ $config: mat-typography-config(
$body-1: mat-typography-level(14px, 22px, 400),
$caption: mat-typography-level(13px, 22px, 400),
$button: mat-typography-level(14px, 14px, 500),
// Line-height must be unit-less fraction of the font-size.
$input: mat-typography-level(16px, 1.125, 400)
// Line-height must be unit-less fraction of the font-size. $input: mat-typography-level(16px, 1.125, 400),
);

/**
Expand Down Expand Up @@ -130,15 +129,15 @@ $footer-z-index: 700;

// Sidenav Toolbar

$sidenav-toolbar-background: #272B35;
$sidenav-toolbar-background: #272b35;
$sidenav-toolbar-height: $toolbar-height;
$sidenav-toolbar-elevation: $elevation;

// Sidenav

$sidenav-color: #A7A9AE;
$sidenav-color: #a7a9ae;

$sidenav-background: #2B303B;
$sidenav-background: #2b303b;
$sidenav-background-hover: darken($sidenav-background, 4);
$sidenav-background-active: $sidenav-background-hover;

Expand Down Expand Up @@ -185,7 +184,9 @@ $sidenav-item-padding-left-level5: $sidenav-item-padding-left-level4 + 8px;
$sidenav-item-padding-left-level6: $sidenav-item-padding-left-level5 + 8px;

$sidenav-width: 270px; // If you change this, you also need to adjust the animations in sidenav.component.ts
$sidenav-collapsed-width: ($sidenav-item-padding-left + $sidenav-item-padding-right + $sidenav-item-icon-font-size); // If you change this, you also need to adjust the animations in sidenav.component.ts
$sidenav-collapsed-width: (
$sidenav-item-padding-left + $sidenav-item-padding-right + $sidenav-item-icon-font-size
); // If you change this, you also need to adjust the animations in sidenav.component.ts
$sidenav-z-index: 1000;

/**
Expand Down
27 changes: 26 additions & 1 deletion libs/animations/src/lib/route.animation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { trigger, animate, transition, style, query } from '@angular/animations';
import { trigger, transition, state, group, query, style, animate, animateChild } from '@angular/animations';

export const routeAnimation = trigger('routeAnimation', [
transition('* <=> *', [
Expand Down Expand Up @@ -45,3 +45,28 @@ export const routeAnimation2 = trigger('routeAnimation', [
),
]),
]);

export const hierarchicalRouteAnimation = trigger('routeAnimation', [
transition('1 => 2, 2 => 3', [
style({ height: '!' }),
query(':enter', style({ transform: 'translateX(100%)' })),
query(':enter, :leave', style({ position: 'absolute', top: 0, left: 0, right: 0 })),
// animate the leave page away
group([
query(':leave', [animate('0.3s cubic-bezier(.35,0,.25,1)', style({ transform: 'translateX(-100%)' }))]),
// and now reveal the enter
query(':enter', animate('0.3s cubic-bezier(.35,0,.25,1)', style({ transform: 'translateX(0)' }))),
]),
]),
transition('3 => 2, 2 => 1', [
style({ height: '!' }),
query(':enter', style({ transform: 'translateX(-100%)' })),
query(':enter, :leave', style({ position: 'absolute', top: 0, left: 0, right: 0 })),
// animate the leave page away
group([
query(':leave', [animate('0.3s cubic-bezier(.35,0,.25,1)', style({ transform: 'translateX(100%)' }))]),
// and now reveal the enter
query(':enter', animate('0.3s cubic-bezier(.35,0,.25,1)', style({ transform: 'translateX(0)' }))),
]),
]),
]);
6 changes: 4 additions & 2 deletions libs/auth/src/lib/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Observable, Subscription , throwError } from 'rxjs';
import { Observable, Subscription, throwError } from 'rxjs';
import { catchError, filter, mergeMap, tap } from 'rxjs/operators';
import { AuthMode, Logout, LogoutSuccess } from './auth.actions';
import { Store, Select } from '@ngxs/store';
Expand Down Expand Up @@ -100,7 +100,9 @@ export class AuthService {
// for Password Flow
this._refresher = this.oauthService.events
.pipe(
tap(e => { console.log(`sumo: type: $e.type, `, e); }),
tap(e => {
console.log(`sumo: type: $e.type, `, e);
}),
filter((e: OAuthEvent) => e.type === 'token_expires'),
mergeMap(_ => fromPromise(this.oauthService.refreshToken())),
catchError((error: HttpErrorResponse) => {
Expand Down
2 changes: 1 addition & 1 deletion libs/chat-box/src/lib/services/speech-to-text.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class SpeechToTextService {

this.speechRecognition.onnomatch = (err: any): void => {
console.log('No Match');
reject('I didn\'t recognise your question.');
reject("I didn't recognise your question.");
};

this.speechRecognition.onerror = (err: any): void => {
Expand Down
32 changes: 16 additions & 16 deletions libs/core/src/lib/services/page-title.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ export class PageTitleService {
this.defaultTitle = bodyTitle.getTitle() || 'WebApp';

// Automatically set pageTitle from route data
router.events
.pipe(filter((event: any) => event instanceof NavigationEnd))
.subscribe((n: NavigationEnd) => {
const titleSet = new Set();
let root = this.router.routerState.snapshot.root;
do {
root = root.children[0];
if (root.data['title']) {
titleSet.add(root.data['title']);
}
} while (root.children.length > 0);
router.events.pipe(filter((event: any) => event instanceof NavigationEnd)).subscribe((n: NavigationEnd) => {
const titleSet = new Set();
let root = this.router.routerState.snapshot.root;
do {
root = root.children[0];
if (root.data['title']) {
titleSet.add(root.data['title']);
}
} while (root.children.length > 0);

this.titleSet = titleSet;
bodyTitle.setTitle(`${Array.from(titleSet).reverse().join(' | ')} | ${this.defaultTitle}`);
this.titleSet = titleSet;
bodyTitle.setTitle(
`${Array.from(titleSet)
.reverse()
.join(' | ')} | ${this.defaultTitle}`,
);

ga('send', 'pageview', n.urlAfterRedirects);
ga('send', 'pageview', n.urlAfterRedirects);
});
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ export class DashboardLayoutComponent implements OnInit, OnDestroy {
private store: Store,
private actions$: Actions,
private media: ObservableMedia,
private oauthService: OAuthService
private oauthService: OAuthService,
) {}

ngOnInit() {

this._mediaSubscription = this.media.subscribe((change: MediaChange) => {
const isMobile = change.mqAlias === 'xs' || change.mqAlias === 'sm';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('CardComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CardComponent ]
})
.compileComponents();
declarations: [CardComponent],
}).compileComponents();
}));

beforeEach(() => {
Expand Down
6 changes: 2 additions & 4 deletions libs/experiments/src/lib/components/card/card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { Component } from '@angular/core';
@Component({
selector: 'ngx-card',
templateUrl: './card.component.html',
styleUrls: ['./card.component.scss']
styleUrls: ['./card.component.scss'],
})
export class CardComponent {

constructor() { }

constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { FileUploadService } from './file-upload.service';
selector: 'ngx-file-upload',
templateUrl: './file-upload.component.html',
styleUrls: ['./file-upload.component.scss'],
providers: [
FileUploadService
]
providers: [FileUploadService],
})
export class FileUploadComponent {
crumbs: ReadonlyArray<Crumb> = [
Expand All @@ -32,18 +30,17 @@ export class FileUploadComponent {
data => {
this.myPond.removeFiles();
this.snackBar.open(`Uploaded Successfully`, '', {
duration: 3000
duration: 3000,
});
},
err => {
console.error(`File Upload Error: ${err.message}`);
this.snackBar.open(`File Upload Error: ${err.message}`, '', {
duration: 3000
duration: 3000,
});
}
},
);


// Progress indicator supported, set progress to 25% of 1
progress(true, 0.25, 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { environment } from '@env/environment';


@Injectable()
export class FileUploadService {
baseUrl = environment.DOCS_BASE_URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Crumb } from '@ngx-starter-kit/breadcrumbs';
styleUrls: ['./knob-demo.component.scss'],
})
export class KnobDemoComponent implements OnInit {

crumbs: ReadonlyArray<Crumb> = [
{ name: 'Dashboard', link: '/dashboard' },
{ name: 'Experiments', link: '/dashboard/experiments' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
padding: 1.5%;
position: relative;
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('LayoutComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LayoutComponent ]
})
.compileComponents();
declarations: [LayoutComponent],
}).compileComponents();
}));

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import { Crumb } from '@ngx-starter-kit/breadcrumbs';
@Component({
selector: 'ngx-layout',
templateUrl: './layout.component.html',
styleUrls: ['./layout.component.scss']
styleUrls: ['./layout.component.scss'],
})
export class LayoutComponent implements OnInit {
crumbs: ReadonlyArray<Crumb> = [
{ name: 'Dashboard', link: '/dashboard' },
{ name: 'Experiments', link: '/dashboard/experiments' },
{ name: 'Layout Demo' },
];
constructor() { }

ngOnInit() {
}
constructor() {}

ngOnInit() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface State {
@Component({
selector: 'ngx-virtual-scroll',
templateUrl: './virtual-scroll.component.html',
styleUrls: ['./virtual-scroll.component.scss']
styleUrls: ['./virtual-scroll.component.scss'],
})
export class VirtualScrollComponent implements OnInit {
crumbs: ReadonlyArray<Crumb> = [
Expand Down
14 changes: 12 additions & 2 deletions libs/grid/src/lib/grid.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,19 @@ import { AccountEditComponent } from './components/account-edit/account-edit.com
path: 'crud-table',
component: AccountsTableComponent,
data: { title: 'Accounts Table', animation: 'accounts-table' },
children: [{ path: ':id', component: AccountDetailComponent, data: { title: 'Account Detail', animation: 'account-detail' } }],
children: [
{
path: ':id',
component: AccountDetailComponent,
data: { title: 'Account Detail', animation: 'account-detail' },
},
],
},
{
path: 'grid-list',
component: AccountsGridListComponent,
data: { title: 'Accounts Grid List', animation: 'accounts-grid-list' },
},
{ path: 'grid-list', component: AccountsGridListComponent, data: { title: 'Accounts Grid List', animation: 'accounts-grid-list' } },
]),
],
declarations: [AccountsTableComponent, AccountsGridListComponent, AccountDetailComponent, AccountEditComponent],
Expand Down

0 comments on commit f0c14a7

Please sign in to comment.