import { dataSource } from "../../../data-source"; import { templateUsage } from "../../../entity/configuration/templateUsage"; import DatabaseActionException from "../../../exceptions/databaseActionException"; import InternalException from "../../../exceptions/internalException"; import { UpdateTemplateUsageCommand } from "./templateUsageCommand"; export default abstract class TemplateUsageCommandHandler { /** * @description update templateUsage * @param {UpdateTemplateUsageCommand} updateTemplateUsage * @returns {Promise} */ static async update(updateTemplateUsage: UpdateTemplateUsageCommand): Promise { return await dataSource .createQueryBuilder() .update(templateUsage) .set({ headerId: updateTemplateUsage.headerId, bodyId: updateTemplateUsage.bodyId, footerId: updateTemplateUsage.footerId, headerHeight: updateTemplateUsage.headerHeight, footerHeight: updateTemplateUsage.footerHeight, }) .where("scope = :scope", { scope: updateTemplateUsage.scope }) .execute() .then(() => {}) .catch((err) => { throw new DatabaseActionException("SET", "templateUsage", err); }); } }