aboutsummaryrefslogtreecommitdiff
path: root/src/FileRouter.ts
diff options
context:
space:
mode:
authorTom Harley2018-02-09 05:59:48 +0000
committerTom Harley2018-02-09 05:59:48 +0000
commit7913e19e2f83296dc96a67e6437f6006b1d894ac (patch)
tree728e9ac392f6d6fbb179586659329355a36826a5 /src/FileRouter.ts
parentMerge branch 'auth' into trh/middleware (diff)
downloadmedicine-7913e19e2f83296dc96a67e6437f6006b1d894ac.tar.gz
medicine-7913e19e2f83296dc96a67e6437f6006b1d894ac.zip

various work I forgot to commit

Diffstat (limited to 'src/FileRouter.ts')
-rw-r--r--src/FileRouter.ts30
1 files changed, 22 insertions, 8 deletions
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<any>(
(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<any>(
(p: Project) => p.getProjectFullInfo()
));