changed data structure to single html

This commit is contained in:
Julian Krauser 2024-12-22 17:29:11 +01:00
parent 160d82459d
commit 5f18e614be
7 changed files with 8 additions and 28 deletions

View file

@ -8,9 +8,7 @@ export interface UpdateTemplateCommand {
template: string;
description: string | null;
design: object;
headerHTML: string;
bodyHTML: string;
footerHTML: string;
html: string;
}
export interface DeleteTemplateCommand {

View file

@ -40,9 +40,7 @@ export default abstract class TemplateCommandHandler {
template: updateTemplate.template,
description: updateTemplate.description,
design: updateTemplate.design,
headerHTML: updateTemplate.headerHTML,
bodyHTML: updateTemplate.bodyHTML,
footerHTML: updateTemplate.footerHTML,
html: updateTemplate.html,
})
.where("id = :id", { id: updateTemplate.id })
.execute()

View file

@ -59,18 +59,14 @@ export async function updateTemplate(req: Request, res: Response): Promise<any>
const template = req.body.template;
const description = req.body.description;
const design = req.body.design;
const headerHTML = req.body.headerHTML;
const bodyHTML = req.body.bodyHTML;
const footerHTML = req.body.footerHTML;
const html = req.body.html;
let updateTemplate: UpdateTemplateCommand = {
id: id,
template: template,
description: description,
design: design,
headerHTML: headerHTML,
bodyHTML: bodyHTML,
footerHTML: footerHTML,
html: html,
};
await TemplateCommandHandler.update(updateTemplate);

View file

@ -26,11 +26,5 @@ export class template {
design: object;
@Column({ type: "text", default: "" })
headerHTML: string;
@Column({ type: "text", default: "" })
bodyHTML: string;
@Column({ type: "text", default: "" })
footerHTML: string;
html: string;
}

View file

@ -13,9 +13,7 @@ export default abstract class TemplateFactory {
template: record.template,
description: record.description,
design: record.design,
headerHTML: record.headerHTML,
bodyHTML: record.bodyHTML,
footerHTML: record.footerHTML,
html: record.html,
};
}

View file

@ -15,9 +15,7 @@ export class Template1734854680201 implements MigrationInterface {
{ name: "template", type: "varchar", length: "255", isNullable: false },
{ name: "description", type: "varchar", length: "255", isNullable: true },
{ name: "design", type: "text", isNullable: false, default: "'{}'" },
{ name: "headerHTML", type: "text", isNullable: false, default: "''" },
{ name: "bodyHTML", type: "text", isNullable: false, default: "''" },
{ name: "footerHTML", type: "text", isNullable: false, default: "''" },
{ name: "html", type: "text", isNullable: false, default: "''" },
],
}),
true

View file

@ -3,7 +3,5 @@ export interface TemplateViewModel {
template: string;
description: string | null;
design: object;
headerHTML: string;
bodyHTML: string;
footerHTML: string;
html: string;
}