diff --git a/src/command/settings/newsletterConfig/newsletterConfigCommand.ts b/src/command/settings/newsletterConfig/newsletterConfigCommand.ts index f07de54..be28649 100644 --- a/src/command/settings/newsletterConfig/newsletterConfigCommand.ts +++ b/src/command/settings/newsletterConfig/newsletterConfigCommand.ts @@ -4,7 +4,3 @@ export interface SetNewsletterConfigCommand { comTypeId: number; config: NewsletterConfigType; } - -export interface DeleteNewsletterConfigCommand { - comTypeId: number; -} diff --git a/src/command/settings/newsletterConfig/newsletterConfigCommandHandler.ts b/src/command/settings/newsletterConfig/newsletterConfigCommandHandler.ts index 56b41bd..4f26df4 100644 --- a/src/command/settings/newsletterConfig/newsletterConfigCommandHandler.ts +++ b/src/command/settings/newsletterConfig/newsletterConfigCommandHandler.ts @@ -1,7 +1,7 @@ import { dataSource } from "../../../data-source"; import { newsletterConfig } from "../../../entity/settings/newsletterConfig"; import InternalException from "../../../exceptions/internalException"; -import { DeleteNewsletterConfigCommand, SetNewsletterConfigCommand } from "./newsletterConfigCommand"; +import { SetNewsletterConfigCommand } from "./newsletterConfigCommand"; export default abstract class NewsletterConfigCommandHandler { /** @@ -27,21 +27,4 @@ export default abstract class NewsletterConfigCommandHandler { throw new InternalException("Failed setting newsletterConfig", err); }); } - /** - * @description delete newsletterConfig - * @param {DeleteNewsletterConfigCommand} deleteNewsletterConfig - * @returns {Promise} - */ - static async delete(deleteNewsletterConfig: DeleteNewsletterConfigCommand): Promise { - return await dataSource - .createQueryBuilder() - .delete() - .from(newsletterConfig) - .where("comTypeId = :comTypeId", { comTypeId: deleteNewsletterConfig.comTypeId }) - .execute() - .then(() => {}) - .catch((err) => { - throw new InternalException("Failed setting newsletterConfig", err); - }); - } } diff --git a/src/controller/admin/settings/newsletterConfigController.ts b/src/controller/admin/settings/newsletterConfigController.ts index f047816..7d0ff95 100644 --- a/src/controller/admin/settings/newsletterConfigController.ts +++ b/src/controller/admin/settings/newsletterConfigController.ts @@ -2,7 +2,7 @@ import { Request, Response } from "express"; import NewsletterConfigService from "../../../service/settings/newsletterConfigService"; import NewsletterConfigFactory from "../../../factory/admin/settings/newsletterConfig"; import NewsletterConfigCommandHandler from "../../../command/settings/newsletterConfig/newsletterConfigCommandHandler"; -import { DeleteNewsletterConfigCommand, SetNewsletterConfigCommand } from "../../../command/settings/newsletterConfig/newsletterConfigCommand"; +import { SetNewsletterConfigCommand } from "../../../command/settings/newsletterConfig/newsletterConfigCommand"; /** * @description get all newsletterConfigs @@ -47,20 +47,3 @@ export async function setNewsletterConfig(req: Request, res: Response): Promise< res.send(id); } - -/** - * @description delete award - * @param req {Request} Express req object - * @param res {Response} Express res object - * @returns {Promise<*>} - */ -export async function deleteNewsletterConfig(req: Request, res: Response): Promise { - const comTypeId = parseInt(req.params.comTypeId); - - let deleteNewsletterConfig: DeleteNewsletterConfigCommand = { - comTypeId: comTypeId, - }; - await NewsletterConfigCommandHandler.delete(deleteNewsletterConfig); - - res.sendStatus(204); -} diff --git a/src/routes/admin/settings/newsletterConfig.ts b/src/routes/admin/settings/newsletterConfig.ts index a874cc7..94fe205 100644 --- a/src/routes/admin/settings/newsletterConfig.ts +++ b/src/routes/admin/settings/newsletterConfig.ts @@ -1,6 +1,5 @@ import express, { Request, Response } from "express"; import { - deleteNewsletterConfig, getAllNewsletterConfigs, getNewsletterConfigById, setNewsletterConfig, @@ -25,12 +24,4 @@ router.put( } ); -router.delete( - "/:comTypeId", - PermissionHelper.passCheckMiddleware("create", "settings", "newsletter_config"), - async (req: Request, res: Response) => { - await deleteNewsletterConfig(req, res); - } -); - export default router;