ff-admin-server/src/command/settings/templateUsage/templateUsageCommandHandler.ts

31 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-01-05 14:14:00 +01:00
import { dataSource } from "../../../data-source";
import { templateUsage } from "../../../entity/settings/templateUsage";
import InternalException from "../../../exceptions/internalException";
2024-12-23 14:00:50 +01:00
import { UpdateTemplateUsageCommand } from "./templateUsageCommand";
export default abstract class TemplateUsageCommandHandler {
/**
* @description update templateUsage
* @param UpdateTemplateUsageCommand
* @returns {Promise<void>}
*/
static async update(updateTemplateUsage: UpdateTemplateUsageCommand): Promise<void> {
return await dataSource
.createQueryBuilder()
.update(templateUsage)
.set({
headerId: updateTemplateUsage.headerId,
bodyId: updateTemplateUsage.bodyId,
footerId: updateTemplateUsage.footerId,
2025-01-01 13:21:28 +01:00
headerHeight: updateTemplateUsage.headerHeight,
footerHeight: updateTemplateUsage.footerHeight,
2024-12-23 14:00:50 +01:00
})
.where("scope = :scope", { scope: updateTemplateUsage.scope })
.execute()
.then(() => {})
.catch((err) => {
throw new InternalException("Failed updating templateUsage", err);
});
}
}