diff options
author | ChrisChrome <christophercookman@gmail.com> | 2022-08-10 02:53:29 -0600 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-12-18 22:40:25 +1100 |
commit | 1cadcda249875f5c7a6b1c921701b564af99e3e2 (patch) | |
tree | 4d17ebc42c6fe7b4475aa97c8510ed59a99c6431 /src/api/routes/applications/#id/index.ts | |
parent | Remove some old test logs that expose info to console (diff) | |
download | server-1cadcda249875f5c7a6b1c921701b564af99e3e2.tar.xz |
Add basic developer panel functionality - doesn't work yet
> > > Co-authored-by: TheArcaneBrony <myrainbowdash949@gmail.com>
Diffstat (limited to 'src/api/routes/applications/#id/index.ts')
-rw-r--r-- | src/api/routes/applications/#id/index.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/api/routes/applications/#id/index.ts b/src/api/routes/applications/#id/index.ts new file mode 100644 index 00000000..be8c3ba4 --- /dev/null +++ b/src/api/routes/applications/#id/index.ts @@ -0,0 +1,27 @@ +import { Request, Response, Router } from "express"; +import { route } from "@fosscord/api"; +import { Application, OrmUtils, Team, trimSpecial, User } from "@fosscord/util"; + +const router: Router = Router(); + +router.get("/", route({}), async (req: Request, res: Response) => { + //TODO + let results = await Application.findOne({where: {id: req.params.id}, relations: ["owner", "bot"] }); + //debugger; + 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 + app.bot?.save(); + } + if(req.body.tags) app.tags = req.body.tags; + await app.save(); + debugger; + res.json(app).status(200); +}); + +export default router; \ No newline at end of file |