From 7913e19e2f83296dc96a67e6437f6006b1d894ac Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Fri, 9 Feb 2018 05:59:48 +0000 Subject: various work I forgot to commit --- src/FileRouter.ts | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src/FileRouter.ts') diff --git a/src/FileRouter.ts b/src/FileRouter.ts index 151cdf6..bffc454 100644 --- a/src/FileRouter.ts +++ b/src/FileRouter.ts @@ -31,9 +31,12 @@ export class FileRouter { }) */ public getProtocols(req: Request, res: Response, next: NextFunction){ - var returnValue = {}; - returnValue['supported'] = ["BE50"]; - returnValue['required'] = "BE01"; + var returnValue = { + supported: [], + required: [ + "BE01" + ] + }; res.send(JSON.stringify(returnValue)); } @@ -179,8 +182,12 @@ export class FileRouter { }) */ public getUsers(req: Request, res: Response, next: NextFunction){ - User.findAll() - .then((user) => { + User.findAll({ + include: [ + UserGroup, + Project + ] + }).then((user) => { res.json(user.map( (u: User) => u.getUserFullInfo() )); @@ -200,7 +207,11 @@ export class FileRouter { let user: User = await User.findOne({ where: { username: name - } + }, + include: [ + UserGroup, + Project + ] }); return user.getUserFullInfo(); @@ -315,8 +326,11 @@ export class FileRouter { }) */ public getProjects(req: Request, res: Response, next: NextFunction){ - Project.findAll() - .then((projects) => { + Project.findAll({ + include: [ + User + ] + ).then((projects) => { res.json(projects.map( (p: Project) => p.getProjectFullInfo() )); -- cgit v1.2.1