diff options
author | Catalan Lover <48515417+FSG-Cat@users.noreply.github.com> | 2022-08-23 23:50:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 23:50:01 +0200 |
commit | d63451b3fe6c0c6ab175adec82361834bb3633f5 (patch) | |
tree | b738ee25bf9819300e1802ba9a8e2813e9dc2588 /src/api/routes/applications/#id/index.ts | |
parent | Merge pull request #1 from FSG-Cat/FSG-Cat-patch-1 (diff) | |
parent | Check Captcha (diff) | |
download | server-d63451b3fe6c0c6ab175adec82361834bb3633f5.tar.xz |
Merge branch 'fosscord:staging' into Bug-Report-Template
Diffstat (limited to 'src/api/routes/applications/#id/index.ts')
-rw-r--r-- | src/api/routes/applications/#id/index.ts | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/api/routes/applications/#id/index.ts b/src/api/routes/applications/#id/index.ts index 0aced582..398227fd 100644 --- a/src/api/routes/applications/#id/index.ts +++ b/src/api/routes/applications/#id/index.ts @@ -1,22 +1,22 @@ -import { Request, Response, Router } from "express"; import { route } from "@fosscord/api"; -import { Application, OrmUtils, Team, trimSpecial, User } from "@fosscord/util"; +import { Application, OrmUtils } from "@fosscord/util"; +import { Request, Response, Router } from "express"; const router: Router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { - let results = await Application.findOne({where: {id: req.params.id}, relations: ["owner", "bot"] }); + let results = await Application.findOne({ where: { id: req.params.id }, relations: ["owner", "bot"] }); res.json(results).status(200); }); router.patch("/", route({}), async (req: Request, res: Response) => { delete req.body.icon; - let app = OrmUtils.mergeDeep(await Application.findOne({where: {id: req.params.id}, relations: ["owner", "bot"]}), req.body); - if(app.bot) { - app.bot.bio = req.body.description + let app = OrmUtils.mergeDeep(await Application.findOne({ where: { id: req.params.id }, relations: ["owner", "bot"] }), req.body); + if (app.bot) { + app.bot.bio = req.body.description; app.bot?.save(); } - if(req.body.tags) app.tags = req.body.tags; + if (req.body.tags) app.tags = req.body.tags; await app.save(); res.json(app).status(200); }); @@ -26,5 +26,4 @@ router.post("/delete", route({}), async (req: Request, res: Response) => { res.send().status(200); }); - -export default router; \ No newline at end of file +export default router; |