chore(backend): Aanpassingen Dwengo Learning-Object-Repository

Processing uit Dwengo Learning-Object-Repository geconverteerd naar TypeScript en aangepast aan onze app.

Functionaliteit van Dwengo Learning-Object-Repository in ons project gekopiëerd en deels aanBestanden die enkel types of interfaces exporteren hernoemd naar *.d.tsgepast aan TypeScript en ons project.
This commit is contained in:
Gerald Schmittinger 2025-03-07 23:20:57 +01:00
parent ba3da01d2d
commit 463c8c9fc0
45 changed files with 1258 additions and 3747 deletions

View file

@ -1,6 +1,6 @@
import {LearningObject} from "../../../entities/content/learning-object.entity";
import {ProcessingError} from "./processing-error";
import {DwengoContentType} from "./content_type";
import {DwengoContentType} from "./content-type";
/**
* Abstract base class for all processors.
@ -19,7 +19,9 @@ abstract class Processor<T> {
* @return Rendered HTML-string
* @throws ProcessingError if the rendering fails.
*/
abstract render(toRender: T): string;
render(toRender: T): string {
return this.renderFn(toRender);
}
/**
* Render a learning object with the content type for which this processor is responsible.
@ -35,6 +37,15 @@ abstract class Processor<T> {
return this.renderLearningObjectFn(toRender);
}
/**
* Function which actually renders the content.
*
* @param toRender Content to be rendered
* @return Rendered HTML as a string
* @protected
*/
protected abstract renderFn(toRender: T): string;
/**
* Function which actually executes the rendering of a learning object.
* By default, this just means rendering the content in the content property of the learning object.