Created the POST /project/:id/regenerate route
This commit is contained in:
parent
265447f068
commit
c80e7707ed
@ -1,5 +1,5 @@
|
|||||||
import { Request, Response, Router } from "express";
|
import { Request, Response, Router } from "express";
|
||||||
import { createProject, deleteProject, patchProject } from "@controller/projects";
|
import { createProject, deleteProject, patchProject, regenerateKey } from "@controller/projects";
|
||||||
import { validateSchema } from "@utils/error";
|
import { validateSchema } from "@utils/error";
|
||||||
import { patchProjectValidation, projectCreationValidation } from "./validations/project";
|
import { patchProjectValidation, projectCreationValidation } from "./validations/project";
|
||||||
|
|
||||||
@ -30,4 +30,11 @@ app.patch("/:id", async (req: Request, res: Response) => {
|
|||||||
res.json({ message: "The project has been successfully updated" });
|
res.json({ message: "The project has been successfully updated" });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post("/:id/regenerate", async (req: Request, res: Response) => {
|
||||||
|
const tokenError = await regenerateKey(req.params.id);
|
||||||
|
if (tokenError) return res.json(tokenError);
|
||||||
|
|
||||||
|
res.json({ message: "The validation key has been regenerated" });
|
||||||
|
});
|
||||||
|
|
||||||
export default app;
|
export default app;
|
Loading…
x
Reference in New Issue
Block a user