template preparation
This commit is contained in:
parent
5f18e614be
commit
6cb8ca0a12
16 changed files with 414 additions and 21 deletions
6
src/command/templateUsageCommand.ts
Normal file
6
src/command/templateUsageCommand.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export interface UpdateTemplateUsageCommand {
|
||||
scope: string;
|
||||
headerId: number | null;
|
||||
bodyId: number | null;
|
||||
footerId: number | null;
|
||||
}
|
28
src/command/templateUsageCommandHandler.ts
Normal file
28
src/command/templateUsageCommandHandler.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { templateUsage } from "../entity/templateUsage";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
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,
|
||||
})
|
||||
.where("scope = :scope", { scope: updateTemplateUsage.scope })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating templateUsage", err);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue