fix: update core and apply stricter tslint rules

This commit is contained in:
Michel Jonathan Schmitz
2019-07-10 12:38:29 +02:00
parent 03c317430a
commit 911492d064
67 changed files with 1291 additions and 507 deletions

View File

@@ -20,10 +20,11 @@ import {SCAcademicEvent, SCArticle, SCBook, SCBuilding, SCCatalog,
import {Observable, of} from 'rxjs';
import {sampleResources} from './resources/test-resources';
// tslint:disable:no-magic-numbers
const sampleMessages: SCMessage[] = [
{
audiences: ['students'],
message: 'Foo Message Text',
messageBody: 'Foo Message Text',
name: 'Foo Message',
origin: {
indexed: 'SOME-DATE',
@@ -35,7 +36,7 @@ const sampleMessages: SCMessage[] = [
},
{
audiences: ['employees'],
message: 'Bar Message Text',
messageBody: 'Bar Message Text',
name: 'Bar Message',
origin: {
indexed: 'SOME-DATE',
@@ -363,31 +364,46 @@ export const sampleThingsMap: {[key in SCThingType | string]: SCThing[]} = {
tour: [],
video: [],
};
// tslint:enable:no-magic-numbers
// provides all or certain sample things to be used in tests or backendless development
/**
* TODO
*
* provides all or certain sample things to be used in tests or backendless development
*/
export function getSampleThings(...uids: string[]): SCThing[] {
const sampleThings: SCThing[] = [];
if (typeof uids !== 'undefined' && uids.length > 0) {
uids.forEach((uid) => {
Object.keys(sampleThingsMap).forEach((key) => {
sampleThingsMap[key].forEach((thing) => {
if (thing.uid === uid) {
sampleThings.push(thing);
}
Object.keys(sampleThingsMap)
.forEach((key) => {
sampleThingsMap[key].forEach((thing) => {
if (thing.uid === uid) {
sampleThings.push(thing);
}
});
});
});
});
} else {
Object.keys(sampleThingsMap).forEach((key) => {
sampleThings.push(...sampleThingsMap[key]);
});
Object.keys(sampleThingsMap)
.forEach((key) => {
sampleThings.push(...sampleThingsMap[key]);
});
}
return sampleThings;
}
/**
* TODO
*/
@Injectable()
export class SampleThings {
/**
* TODO
*/
http: HttpClient;
constructor(http: HttpClient) {
this.http = http;
}
@@ -396,6 +412,28 @@ export class SampleThings {
// // return of(sampleDishes[0]);
// }
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
getSampleThing(uid: string): Observable<any[]> {
// const jsonContent: any[] = await this.http.get('http://localhost:8100/assets/json/joined.json').toPromise();
const sampleThings: any[] = [];
for (const resource of sampleResources) {
if (resource.instance.uid as SCThingType === uid) {
sampleThings.push(resource.instance);
return of(sampleThings);
}
}
return of(sampleThings);
}
/**
* TODO
*/
// tslint:disable-next-line:prefer-function-over-method
getSampleThings(): Observable<any[]> {
// const jsonContent: any[] = await this.http.get('http://localhost:8100/assets/json/joined.json').toPromise();
const sampleThings: any[] = [];
@@ -405,18 +443,7 @@ export class SampleThings {
sampleThings.push(resource.instance);
// }
});
return of(sampleThings);
}
getSampleThing(uid: string): Observable<any[]> {
// const jsonContent: any[] = await this.http.get('http://localhost:8100/assets/json/joined.json').toPromise();
const sampleThings: any[] = [];
for (const resource of sampleResources) {
if (resource.instance.uid as SCThingType === uid) {
sampleThings.push(resource.instance);
return of(sampleThings);
}
}
return of(sampleThings);
}
}