change: remove unused command
This commit is contained in:
parent
d206d7a77c
commit
a2cc408e85
4 changed files with 2 additions and 49 deletions
|
@ -4,7 +4,3 @@ export interface SetNewsletterConfigCommand {
|
|||
comTypeId: number;
|
||||
config: NewsletterConfigType;
|
||||
}
|
||||
|
||||
export interface DeleteNewsletterConfigCommand {
|
||||
comTypeId: number;
|
||||
}
|
||||
|
|
|
@ -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<void>}
|
||||
*/
|
||||
static async delete(deleteNewsletterConfig: DeleteNewsletterConfigCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(newsletterConfig)
|
||||
.where("comTypeId = :comTypeId", { comTypeId: deleteNewsletterConfig.comTypeId })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed setting newsletterConfig", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<any> {
|
||||
const comTypeId = parseInt(req.params.comTypeId);
|
||||
|
||||
let deleteNewsletterConfig: DeleteNewsletterConfigCommand = {
|
||||
comTypeId: comTypeId,
|
||||
};
|
||||
await NewsletterConfigCommandHandler.delete(deleteNewsletterConfig);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue