add support for different recommendation levels: strict and standard

This commit is contained in:
undergroundwires
2020-10-19 14:51:42 +01:00
parent 978bab0b81
commit 14be3017c5
20 changed files with 954 additions and 654 deletions

View File

@@ -15,8 +15,8 @@ export class ApplicationStub implements IApplication {
return this.getAllCategories().find(
(category) => category.id === categoryId);
}
public getRecommendedScripts(): readonly IScript[] {
throw new Error('Method not implemented: getRecommendedScripts');
public getScriptsByLevel(): readonly IScript[] {
throw new Error('Method not implemented: getScriptsByLevel');
}
public findScript(scriptId: string): IScript {
return this.getAllScripts().find((script) => scriptId === script.id);

View File

@@ -1,32 +1,37 @@
import { BaseEntity } from '@/infrastructure/Entity/BaseEntity';
import { IScript } from '@/domain/IScript';
import { RecommendationLevel } from '@/domain/RecommendationLevel';
export class ScriptStub extends BaseEntity<string> implements IScript {
public name = `name${this.id}`;
public code = `REM code${this.id}`;
public revertCode = `REM revertCode${this.id}`;
public readonly documentationUrls = new Array<string>();
public isRecommended = true;
public level = RecommendationLevel.Standard;
constructor(public readonly id: string) {
super(id);
}
public canRevert(): boolean {
return Boolean(this.revertCode);
}
public withIsRecommended(value: boolean): ScriptStub {
this.isRecommended = value;
public withLevel(value: RecommendationLevel): ScriptStub {
this.level = value;
return this;
}
public withCode(value: string): ScriptStub {
this.code = value;
return this;
}
public withName(name: string): ScriptStub {
this.name = name;
return this;
}
public withRevertCode(revertCode: string): ScriptStub {
this.revertCode = revertCode;
return this;